From d1c1c823892d0713065934256f48e7f4e6609f99 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 9 Nov 2019 16:59:14 +0100 Subject: patch 8.1.2274: newlines in 'balloonexpr' result only work in the GUI Problem: Newlines in 'balloonexpr' result only work in the GUI. Solution: Also recognize newlines in the terminal. (closes #5193) --- src/popupmenu.c | 6 +++++- src/testdir/dumps/Test_balloon_eval_term_01.dump | 10 +++++----- src/testdir/dumps/Test_balloon_eval_term_01a.dump | 8 ++++---- src/testdir/dumps/Test_balloon_eval_term_02.dump | 8 ++++---- src/testdir/test_balloon.vim | 2 +- src/version.c | 2 ++ 6 files changed, 21 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/popupmenu.c b/src/popupmenu.c index 005adb20ba..55845cf2d9 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -1130,7 +1130,7 @@ split_message(char_u *mesg, pumitem_T **array) int item_idx; int indent = 0; int max_cells = 0; - int max_height = Rows / 2 - 2; + int max_height = Rows / 2 - 1; int long_item_count = 0; int split_long_items = FALSE; @@ -1150,6 +1150,8 @@ split_message(char_u *mesg, pumitem_T **array) { if (*p == '"') quoted = !quoted; + else if (*p == '\n') + break; else if (*p == '\\' && p[1] != NUL) ++p; else if (!quoted) @@ -1170,6 +1172,8 @@ split_message(char_u *mesg, pumitem_T **array) p += mb_ptr2len(p); } item->bytelen = p - item->start; + if (*p == '\n') + ++p; if (item->cells > max_cells) max_cells = item->cells; long_item_count += (item->cells - 1) / BALLOON_MIN_WIDTH; diff --git a/src/testdir/dumps/Test_balloon_eval_term_01.dump b/src/testdir/dumps/Test_balloon_eval_term_01.dump index e4fe652e82..ab594951fb 100644 --- a/src/testdir/dumps/Test_balloon_eval_term_01.dump +++ b/src/testdir/dumps/Test_balloon_eval_term_01.dump @@ -1,10 +1,10 @@ |o+0&#ffffff0|n>e| |o|n|e| |o|n|e| @38 @2|o| |t|X|o| |t|w|o| @38 -|t|h|r|e| +0#0000001#ffd7ff255@21| +0#0000000#ffffff0@23 -|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| |t|X|o| | +0#4040ff13#ffffff0@23 -|~| @2| +0#0000001#ffd7ff255@21| +0#4040ff13#ffffff0@23 +|t|h|r|e| +0#0000001#ffd7ff255@17| +0#0000000#ffffff0@27 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| | +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255|t|X|o| @13| +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@27 |~| @48 |~| @48 |~| @48 -|~| @48 -|:+0#0000000&|c|a|l@1| |T|r|i|g@1|e|r|(|)| @16|1|,|3| @10|A|l@1| +|h+0#0000000&|o|l|d| |f|i|r|e|d| @39 diff --git a/src/testdir/dumps/Test_balloon_eval_term_01a.dump b/src/testdir/dumps/Test_balloon_eval_term_01a.dump index d2194c8bfe..ab594951fb 100644 --- a/src/testdir/dumps/Test_balloon_eval_term_01a.dump +++ b/src/testdir/dumps/Test_balloon_eval_term_01a.dump @@ -1,9 +1,9 @@ |o+0&#ffffff0|n>e| |o|n|e| |o|n|e| @38 @2|o| |t|X|o| |t|w|o| @38 -|t|h|r|e| +0#0000001#ffd7ff255@21| +0#0000000#ffffff0@23 -|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| |t|X|o| | +0#4040ff13#ffffff0@23 -|~| @2| +0#0000001#ffd7ff255@21| +0#4040ff13#ffffff0@23 -|~| @48 +|t|h|r|e| +0#0000001#ffd7ff255@17| +0#0000000#ffffff0@27 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255|l|i|n|e| |2| |c|o|l|u|m|n| |6|:| | +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255|t|X|o| @13| +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@27 |~| @48 |~| @48 |~| @48 diff --git a/src/testdir/dumps/Test_balloon_eval_term_02.dump b/src/testdir/dumps/Test_balloon_eval_term_02.dump index 4f4b788444..98532617cd 100644 --- a/src/testdir/dumps/Test_balloon_eval_term_02.dump +++ b/src/testdir/dumps/Test_balloon_eval_term_02.dump @@ -1,10 +1,10 @@ |o+0&#ffffff0|n|e| |o|n|e| |o|n|e| @38 @2|o| |t|X|o| |t|w|o| @38 |t|h|r|e|e+0&#e0e0e08| |t|h>r+0&#ffffff0|e@1| |t|h|r|e@1| @32 -|~+0#4040ff13&| @2| +0#0000001#ffd7ff255@23| +0#4040ff13#ffffff0@21 -|~| @2| +0#0000001#ffd7ff255|l|i|n|e| |3| |c|o|l|u|m|n| |5|:| |e| |t|h|r| | +0#4040ff13#ffffff0@21 -|~| @2| +0#0000001#ffd7ff255@23| +0#4040ff13#ffffff0@21 -|~| @48 +|~+0#4040ff13&| @2| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255|l|i|n|e| |3| |c|o|l|u|m|n| |5|:| | +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255|e| |t|h|r| @11| +0#4040ff13#ffffff0@27 +|~| @2| +0#0000001#ffd7ff255@17| +0#4040ff13#ffffff0@27 |~| @48 |~| @48 |-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@9|5| @8|3|,|9| @10|A|l@1| diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index e4ee855a7d..f32b73c0d4 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -12,7 +12,7 @@ let s:common_script =<< trim [CODE] call setline(1, ["one one one", "two tXo two", "three three three"]) set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100 func MyBalloonExpr() - return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text + return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ":\n" .. v:beval_text endfun redraw [CODE] diff --git a/src/version.c b/src/version.c index 6b6d661bcd..b6bbf983c6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2274, /**/ 2273, /**/ -- cgit v1.2.3