]> granicus.if.org Git - vim/commitdiff
patch 8.2.0007: popup menu positioned wrong with folding in two tabs v8.2.0007
authorBram Moolenaar <Bram@vim.org>
Sat, 14 Dec 2019 17:42:15 +0000 (18:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 14 Dec 2019 17:42:15 +0000 (18:42 +0100)
Problem:    Popup menu positioned wrong with folding in two tabs.
Solution:   Update the cursor line height. (closes #5353)

src/move.c
src/popupmenu.c
src/proto/move.pro
src/testdir/dumps/Test_pum_with_folds_two_tabs.dump [new file with mode: 0644]
src/testdir/test_ins_complete.vim
src/version.c

index 8e53d8bcb063f74a8fd657c316e8a75f0346da8d..6121e3e2da7b3a047bb823620e1134c0f6351024 100644 (file)
@@ -816,7 +816,7 @@ validate_virtcol_win(win_T *wp)
 /*
  * Validate curwin->w_cline_height only.
  */
-    static void
+    void
 validate_cheight(void)
 {
     check_cursor_moved(curwin);
index f908bfca4b092e9c110a45fc391754c044f412a6..ab2ce555b82e89fc6c2f1a467e9408101413bc1e 100644 (file)
@@ -180,6 +180,7 @@ pum_display(
            // pum below "pum_win_row"
 
            // Leave two lines of context if possible
+           validate_cheight();
            if (curwin->w_cline_row
                                + curwin->w_cline_height - curwin->w_wrow >= 3)
                context_lines = 3;
index d05eb17537292de874d5550740c2d49eb70c5f96..8efecb9f20486e9c4beba376584b0ffc81dcb5cc 100644 (file)
@@ -21,6 +21,7 @@ void validate_cursor(void);
 void validate_cline_row(void);
 void validate_virtcol(void);
 void validate_virtcol_win(win_T *wp);
+void validate_cheight(void);
 void validate_cursor_col(void);
 int win_col_off(win_T *wp);
 int curwin_col_off(void);
diff --git a/src/testdir/dumps/Test_pum_with_folds_two_tabs.dump b/src/testdir/dumps/Test_pum_with_folds_two_tabs.dump
new file mode 100644 (file)
index 0000000..2414cdc
--- /dev/null
@@ -0,0 +1,10 @@
+| +8#0000001#e0e0e08|+| |[|N|o| |N|a|m|e|]| | +2#0000000#ffffff0|+| |[|N|o| |N|a|m|e|]| | +1&&@47|X+8#0000001#e0e0e08
+|"+0#0000000#ffffff0| |x| |{@2|1| @66
+|"| |a|0> |s|o|m|e| |t|e|x|t| @60
+|"| +0#0000001#e0e0e08|a|0| @12| +0#0000000#0000001| +0&#ffffff0@56
+|"| +0#0000001#ffd7ff255|a|1| @12| +0#0000000#0000001| +0&#ffffff0@56
+|"| +0#0000001#ffd7ff255|a|2| @12| +0#0000000#0000001| +0&#ffffff0@56
+|"| +0#0000001#ffd7ff255|a|3| @12| +0#0000000#a8a8a8255| +0&#ffffff0@56
+|"| +0#0000001#ffd7ff255|a|4| @12| +0#0000000#a8a8a8255| +0&#ffffff0@56
+|"| +0#0000001#ffd7ff255|a|5| @12| +0#0000000#a8a8a8255| +0&#ffffff0@56
+|-+2&&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |1|0| +0#0000000&@32
index e48a72c5d2caafd27be42fc09f104be89aea61ca..ad6294480c042cc7d2c32693ee2cded7039a2333 100644 (file)
@@ -1,3 +1,4 @@
+source screendump.vim
 source check.vim
 
 " Test for insert expansion
@@ -380,3 +381,26 @@ func Test_ins_completeslash()
   set completeslash=
 endfunc
 
+func Test_pum_with_folds_two_tabs()
+  CheckScreendump
+
+  let lines =<< trim END
+    set fdm=marker
+    call setline(1, ['" x {{{1', '" a some text'])
+    call setline(3, range(&lines)->map({_, val -> '" a' .. val}))
+    norm! zm
+    tab sp
+    call feedkeys('2Gzv', 'xt')
+    call feedkeys("0fa", 'xt')
+  END
+
+  call writefile(lines, 'Xpumscript')
+  let buf = RunVimInTerminal('-S Xpumscript', #{rows: 10})
+  call term_wait(buf, 100)
+  call term_sendkeys(buf, "a\<C-N>")
+  call VerifyScreenDump(buf, 'Test_pum_with_folds_two_tabs', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+  call delete('Xpumscript')
+endfunc
index 2ab2e074f1e3aee5ad258d72f4da80c00615cbc0..6c31de8c913611c798302df923c0629dfdda3f6f 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    7,
 /**/
     6,
 /**/