Patch 8.1.1959
Problem:    When using "firstline" in popup window text may jump when
            redrawing it. (Nick Jensen)
Solution:   Set 'scrolloff' to zero in a popup window. (closes #4882)
Files:      src/popupwin.c, src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popupwin_scroll_5.dump,
            src/testdir/dumps/Test_popupwin_scroll_6.dump


*** ../vim-8.1.1958/src/popupwin.c      2019-08-30 22:07:55.950547106 +0200
--- src/popupwin.c      2019-09-01 17:32:41.034371729 +0200
***************
*** 1687,1697 ****
        buf->b_p_swf = FALSE;   // no swap file
        buf->b_p_bl = FALSE;    // unlisted buffer
        buf->b_locked = TRUE;
-       wp->w_p_wrap = TRUE;    // 'wrap' is default on
  
        // Avoid that 'buftype' is reset when this buffer is entered.
        buf->b_p_initialized = TRUE;
      }
  
      if (tp != NULL)
      {
--- 1687,1698 ----
        buf->b_p_swf = FALSE;   // no swap file
        buf->b_p_bl = FALSE;    // unlisted buffer
        buf->b_locked = TRUE;
  
        // Avoid that 'buftype' is reset when this buffer is entered.
        buf->b_p_initialized = TRUE;
      }
+     wp->w_p_wrap = TRUE;      // 'wrap' is default on
+     wp->w_p_so = 0;           // 'scrolloff' zero
  
      if (tp != NULL)
      {
*** ../vim-8.1.1958/src/testdir/test_popupwin.vim       2019-09-01 
15:26:20.043537901 +0200
--- src/testdir/test_popupwin.vim       2019-09-01 17:36:59.884844381 +0200
***************
*** 371,376 ****
--- 371,394 ----
    call popup_close(winid)
  endfunc
  
+ func Test_popup_noscrolloff()
+   set scrolloff=5
+   let winid = popup_create(['xxx']->repeat(50), #{
+       \ maxheight: 5,
+       \ firstline: 11,
+       \ })
+   redraw
+   call assert_equal(11, popup_getoptions(winid).firstline)
+   call assert_equal(11, popup_getpos(winid).firstline)
+ 
+   call popup_setoptions(winid, #{firstline: 0})
+   call win_execute(winid, "normal! \<c-y>")
+   call assert_equal(0, popup_getoptions(winid).firstline)
+   call assert_equal(10, popup_getpos(winid).firstline)
+ 
+   call popup_close(winid)
+ endfunc
+ 
  func Test_popup_drag()
    CheckScreendump
  
***************
*** 1019,1032 ****
    " global/buffer-local
    setlocal path=/there
    " global/window-local
!   setlocal scrolloff=9
  
    let winid = popup_create('hello', {})
    call assert_equal(0, getwinvar(winid, '&number'))
    call assert_equal(1, getwinvar(winid, '&wrap'))
    call assert_equal('', getwinvar(winid, '&omnifunc'))
    call assert_equal(&g:path, getwinvar(winid, '&path'))
!   call assert_equal(&g:scrolloff, getwinvar(winid, '&scrolloff'))
  
    call popup_close(winid)
    bwipe
--- 1037,1054 ----
    " global/buffer-local
    setlocal path=/there
    " global/window-local
!   setlocal statusline=2
  
    let winid = popup_create('hello', {})
    call assert_equal(0, getwinvar(winid, '&number'))
    call assert_equal(1, getwinvar(winid, '&wrap'))
    call assert_equal('', getwinvar(winid, '&omnifunc'))
    call assert_equal(&g:path, getwinvar(winid, '&path'))
!   call assert_equal(&g:statusline, getwinvar(winid, '&statusline'))
! 
!   " 'scrolloff' is reset to zero
!   call assert_equal(5, &scrolloff)
!   call assert_equal(0, getwinvar(winid, '&scrolloff'))
  
    call popup_close(winid)
    bwipe
***************
*** 1713,1718 ****
--- 1735,1741 ----
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
  
    call term_sendkeys(buf, ":call popup_setoptions(winid, 
#{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb', firstline: 
5})\<CR>")
+   " this scrolls two lines (half the window height)
    call term_sendkeys(buf, ":call ScrollUp()\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
  
*** ../vim-8.1.1958/src/testdir/dumps/Test_popupwin_scroll_5.dump       
2019-08-30 17:34:04.380050974 +0200
--- src/testdir/dumps/Test_popupwin_scroll_5.dump       2019-09-01 
17:32:54.014295647 +0200
***************
*** 1,10 ****
  >1+0&#ffffff0| @73
  |2| @73
  |3| @73
! |4| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#ff404010| +0&#ffffff0@32
! |5| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#4040ff13| +0&#ffffff0@32
! |6| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#4040ff13| +0&#ffffff0@32
! |7| @31|s+0#0000001#ffd7ff255|e|v|e|n| @2| +0#0000000#ff404010| +0&#ffffff0@32
  |8| @73
  |9| @73
  |:|c|a|l@1| |S|c|r|o|l@1|U|p|(|)| @40|1|,|1| @10|T|o|p| 
--- 1,10 ----
  >1+0&#ffffff0| @73
  |2| @73
  |3| @73
! |4| @31|t+0#0000001#ffd7ff255|h|r|e@1| @2| +0#0000000#ff404010| +0&#ffffff0@32
! |5| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#4040ff13| +0&#ffffff0@32
! |6| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#4040ff13| +0&#ffffff0@32
! |7| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#ff404010| +0&#ffffff0@32
  |8| @73
  |9| @73
  |:|c|a|l@1| |S|c|r|o|l@1|U|p|(|)| @40|1|,|1| @10|T|o|p| 
*** ../vim-8.1.1958/src/testdir/dumps/Test_popupwin_scroll_6.dump       
2019-08-30 17:34:04.380050974 +0200
--- src/testdir/dumps/Test_popupwin_scroll_6.dump       2019-09-01 
17:33:53.081948794 +0200
***************
*** 1,10 ****
  >1+0&#ffffff0| @73
  |2| @73
  |3| @73
! |4| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#ff404010| +0&#ffffff0@32
! |5| @31|s+0#0000001#ffd7ff255|e|v|e|n| @2| +0#0000000#ff404010| +0&#ffffff0@32
! |6| @31|e+0#0000001#ffd7ff255|i|g|h|t| @2| +0#0000000#4040ff13| +0&#ffffff0@32
! |7| @31|n+0#0000001#ffd7ff255|i|n|e| @3| +0#0000000#4040ff13| +0&#ffffff0@32
  |8| @73
  |9| @73
  |:|c|a|l@1| |S|c|r|o|l@1|D|o|w|n|(|)| @38|1|,|1| @10|T|o|p| 
--- 1,10 ----
  >1+0&#ffffff0| @73
  |2| @73
  |3| @73
! |4| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#ff404010| +0&#ffffff0@32
! |5| @31|s+0#0000001#ffd7ff255|i|x| @4| +0#0000000#ff404010| +0&#ffffff0@32
! |6| @31|s+0#0000001#ffd7ff255|e|v|e|n| @2| +0#0000000#4040ff13| +0&#ffffff0@32
! |7| @31|e+0#0000001#ffd7ff255|i|g|h|t| @2| +0#0000000#4040ff13| +0&#ffffff0@32
  |8| @73
  |9| @73
  |:|c|a|l@1| |S|c|r|o|l@1|D|o|w|n|(|)| @38|1|,|1| @10|T|o|p| 
*** ../vim-8.1.1958/src/version.c       2019-09-01 16:24:53.297677674 +0200
--- src/version.c       2019-09-01 17:37:25.392692807 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1959,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
163. You go outside for the fresh air (at -30 degrees) but open the
     window first to hear new mail arrive.

 /// 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/201909011538.x81FclSL020043%40masaka.moolenaar.net.

Raspunde prin e-mail lui