changeset 18560:81272918c0ea v8.1.2274

patch 8.1.2274: newlines in 'balloonexpr' result only work in the GUI Commit: https://github.com/vim/vim/commit/d1c1c823892d0713065934256f48e7f4e6609f99 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 16:59:14 2019 +0100 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 https://github.com/vim/vim/issues/5193)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 17:00:03 +0100
parents f983bf313b4d
children 279148391b36
files src/popupmenu.c src/testdir/dumps/Test_balloon_eval_term_01.dump src/testdir/dumps/Test_balloon_eval_term_01a.dump src/testdir/dumps/Test_balloon_eval_term_02.dump src/testdir/test_balloon.vim src/version.c
diffstat 6 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -1130,7 +1130,7 @@ split_message(char_u *mesg, pumitem_T **
     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 **
 	{
 	    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 **
 	    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;
--- 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
--- 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
--- 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| 
--- 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]
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2274,
+/**/
     2273,
 /**/
     2272,