summaryrefslogtreecommitdiff
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-16 16:54:24 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-16 16:54:24 +0200
commitf6acffbe83e622542d9fdf3066f51933e46e4954 (patch)
tree70664752ad37e9760fa63ce2c0f432896022628c /src/message.c
parenta06ecab7a5159e744448ace731036f0dc5f87dd4 (diff)
downloadvim-git-f6acffbe83e622542d9fdf3066f51933e46e4954.tar.gz
patch 7.4.2049v7.4.2049
Problem: There is no way to get a list of the error lists. Solution: Add ":chistory" and ":lhistory".
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/message.c b/src/message.c
index 954152850..72cd79ea6 100644
--- a/src/message.c
+++ b/src/message.c
@@ -313,9 +313,25 @@ trunc_string(
len += n;
}
- /* Set the middle and copy the last part. */
- if (e + 3 < buflen)
+
+ if (i <= e + 3)
+ {
+ /* text fits without truncating */
+ if (s != buf)
+ {
+ len = STRLEN(s);
+ if (len >= buflen)
+ len = buflen - 1;
+ len = len - e + 1;
+ if (len < 1)
+ buf[e - 1] = NUL;
+ else
+ mch_memmove(buf + e, s + e, len);
+ }
+ }
+ else if (e + 3 < buflen)
{
+ /* set the middle and copy the last part */
mch_memmove(buf + e, "...", (size_t)3);
len = (int)STRLEN(s + i) + 1;
if (len >= buflen - e - 3)
@@ -325,7 +341,8 @@ trunc_string(
}
else
{
- buf[e - 1] = NUL; /* make sure it is truncated */
+ /* can't fit in the "...", just truncate it */
+ buf[e - 1] = NUL;
}
}