summaryrefslogtreecommitdiff
path: root/src/gui_beval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-10-21 14:15:17 +0200
committerBram Moolenaar <Bram@vim.org>2014-10-21 14:15:17 +0200
commitf1b4622366d96c12ff4e01f21358467b4026e016 (patch)
treec0caec7a1308d784435b2a7c290f703dfc29e9d1 /src/gui_beval.c
parent861d80a671747e6535c83356bcffcf80a72f543b (diff)
downloadvim-git-f1b4622366d96c12ff4e01f21358467b4026e016.tar.gz
updated for version 7.4.482v7.4.482
Problem: When 'balloonexpr' results in a list, the text has a trailing newline. (Lcd) Solution: Remove one trailing newline.
Diffstat (limited to 'src/gui_beval.c')
-rw-r--r--src/gui_beval.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui_beval.c b/src/gui_beval.c
index ae7845660..b3e51fb84 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -30,6 +30,7 @@ general_beval_cb(beval, state)
long winnr = 0;
char_u *bexpr;
buf_T *save_curbuf;
+ size_t len;
# ifdef FEAT_WINDOWS
win_T *cw;
# endif
@@ -83,6 +84,16 @@ general_beval_cb(beval, state)
vim_free(result);
result = eval_to_string(bexpr, NULL, TRUE);
+ /* Remove one trailing newline, it is added when the result was a
+ * list and it's hardly every useful. If the user really wants a
+ * trailing newline he can add two and one remains. */
+ if (result != NULL)
+ {
+ len = STRLEN(result);
+ if (len > 0 && result[len - 1] == NL)
+ result[len - 1] = NUL;
+ }
+
if (use_sandbox)
--sandbox;
--textlock;