Patch 8.2.1737
Problem:    Cursor line highlight in popup window is not always updated.
Solution:   Check if the cursor has moved. (closes #7010)
Files:      src/popupwin.c, src/testdir/test_popupwin.vim
            src/testdir/dumps/Test_popupwin_win_execute_cursorline.dump


*** ../vim-8.2.1736/src/popupwin.c      2020-09-23 17:41:09.841606739 +0200
--- src/popupwin.c      2020-09-24 22:55:29.057544964 +0200
***************
*** 3711,3716 ****
--- 3711,3721 ----
        // Draw the popup text, unless it's off screen.
        if (wp->w_winrow < screen_Rows && wp->w_wincol < screen_Columns)
        {
+           // May need to update the "cursorline" highlighting, which may also
+           // change "topline"
+           if (wp->w_popup_last_curline != wp->w_cursor.lnum)
+               popup_highlight_curline(wp);
+ 
            win_update(wp);
  
            // move the cursor into the visible lines, otherwise executing
*** ../vim-8.2.1736/src/testdir/test_popupwin.vim       2020-09-23 
17:41:09.845606730 +0200
--- src/testdir/test_popupwin.vim       2020-09-24 22:52:37.509819822 +0200
***************
*** 1556,1571 ****
    call delete('XtestPopupNormal')
  endfunc
  
! " this tests that we don't get stuck with an error in "win_execute()"
  func Test_popup_filter_win_execute()
    CheckScreendump
  
    let lines =<< trim END
        let g:winid = popup_create('some text', {'filter': 'invalidfilter'})
        call timer_start(0, {-> win_execute(g:winid, 'invalidCommand')})
    END
!   call writefile(lines, 'XtestPopupWinExecute')
!   let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 10, 
wait_for_ruler: 0})
  
    call WaitFor({-> term_getline(buf, 9) =~ 'Not an editor command: 
invalidCommand'})
    call term_sendkeys(buf, "\<CR>")
--- 1556,1596 ----
    call delete('XtestPopupNormal')
  endfunc
  
! " test that cursor line highlight is updated after using win_execute()
  func Test_popup_filter_win_execute()
    CheckScreendump
  
    let lines =<< trim END
+       let lines = range(1, &lines * 2)->map({_, v -> string(v)})
+       let g:id = popup_create(lines, #{
+         \ minheight: &lines - 5,
+         \ maxheight: &lines - 5,
+         \ cursorline: 1,
+         \ })
+       redraw
+   END
+   call writefile(lines, 'XtestPopupWinExecute')
+   let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 14})
+ 
+   call term_sendkeys(buf, ":call win_execute(g:id, ['normal 17Gzz'])\<CR>")
+   call term_sendkeys(buf, ":\<CR>")
+ 
+   call VerifyScreenDump(buf, 'Test_popupwin_win_execute_cursorline', {})
+ 
+   call StopVimInTerminal(buf)
+   call delete('XtestPopupWinExecute')
+ endfunc
+ 
+ " this tests that we don't get stuck with an error in "win_execute()"
+ func Test_popup_filter_win_execute_error()
+   CheckScreendump
+ 
+   let lines =<< trim END
        let g:winid = popup_create('some text', {'filter': 'invalidfilter'})
        call timer_start(0, {-> win_execute(g:winid, 'invalidCommand')})
    END
!   call writefile(lines, 'XtestPopupWinExecuteError')
!   let buf = RunVimInTerminal('-S XtestPopupWinExecuteError', #{rows: 10, 
wait_for_ruler: 0})
  
    call WaitFor({-> term_getline(buf, 9) =~ 'Not an editor command: 
invalidCommand'})
    call term_sendkeys(buf, "\<CR>")
***************
*** 1577,1583 ****
    call VerifyScreenDump(buf, 'Test_popupwin_win_execute', {})
  
    call StopVimInTerminal(buf)
!   call delete('XtestPopupWinExecute')
  endfunc
  
  func ShowDialog(key, result)
--- 1602,1608 ----
    call VerifyScreenDump(buf, 'Test_popupwin_win_execute', {})
  
    call StopVimInTerminal(buf)
!   call delete('XtestPopupWinExecuteError')
  endfunc
  
  func ShowDialog(key, result)
*** ../vim-8.2.1736/src/testdir/dumps/Test_popupwin_win_execute_cursorline.dump 
2020-09-24 22:57:02.309456529 +0200
--- src/testdir/dumps/Test_popupwin_win_execute_cursorline.dump 2020-09-24 
22:54:11.269609578 +0200
***************
*** 0 ****
--- 1,14 ----
+ > +0&#ffffff0@74
+ |~+0#4040ff13&| @73
+ |~| @34|1+0#0000001#ffd7ff255|4| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @34|1+0#0000001#ffd7ff255|5| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @34|1+0#0000001#ffd7ff255|6| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @34|1+0#0000001#e0e0e08|7| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @34|1+0#0000001#ffd7ff255|8| +0#0000000#0000001| +0#4040ff13#ffffff0@35
+ |~| @34|1+0#0000001#ffd7ff255|9| +0#0000000#0000001| +0#4040ff13#ffffff0@35
+ |~| @34|2+0#0000001#ffd7ff255|0| +0#0000000#0000001| +0#4040ff13#ffffff0@35
+ |~| @34|2+0#0000001#ffd7ff255|1| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @34|2+0#0000001#ffd7ff255@1| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@35
+ |~| @73
+ |~| @73
+ |:+0#0000000&| @55|0|,|0|-|1| @8|A|l@1| 
*** ../vim-8.2.1736/src/version.c       2020-09-23 22:38:01.507927503 +0200
--- src/version.c       2020-09-24 22:40:07.371502315 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1737,
  /**/

-- 
I recommend ordering large cargo containers of paper towels to make up
whatever budget underruns you have.  Paper products are always useful and they
have the advantage of being completely flushable if you need to make room in
the storage area later.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009242057.08OKvuGE326145%40masaka.moolenaar.net.

Raspunde prin e-mail lui