]> granicus.if.org Git - vim/commitdiff
patch 8.1.2274: newlines in 'balloonexpr' result only work in the GUI v8.1.2274
authorBram Moolenaar <Bram@vim.org>
Sat, 9 Nov 2019 15:59:14 +0000 (16:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Nov 2019 15:59:14 +0000 (16:59 +0100)
Problem:    Newlines in 'balloonexpr' result only work in the GUI.
Solution:   Also recognize newlines in the terminal. (closes #5193)

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

index 005adb20ba1abd058911123c47a2afbf8b1a7c5a..55845cf2d9635755b1316f11e47368c1a1340062 100644 (file)
@@ -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;
index e4fe652e82e02d4a2fe433bff67dcc5b80031ef3..ab594951fb7299474a073e7c4f877ed4790f6705 100644 (file)
@@ -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
index d2194c8bfe042079cac48930dc5b38cbbedf340b..ab594951fb7299474a073e7c4f877ed4790f6705 100644 (file)
@@ -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
index 4f4b7884448e70e8cea11bbf78bc4b8bea55fb5a..98532617cda522c25569c03224041d9002fe8b2b 100644 (file)
@@ -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| 
index e4ee855a7dc3583f935813b791a779627b1920c2..f32b73c0d45899c2d36d890fde8199360a62e3bd 100644 (file)
@@ -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]
index 6b6d661bcddf77336163abf4def2afaee47c5680..b6bbf983c6e72d8c4c2789f996f9f1a3e07562f2 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2274,
 /**/
     2273,
 /**/