Patch 8.1.1347 (after 8.1.1327)
Problem: Fractional scroll position not restored after closing window.
Solution: Do restore fraction if topline is not one.
Files: src/window.c, src/testdir/test_window_cmd.vim
*** ../vim-8.1.1346/src/window.c 2019-05-12 14:25:26.321244305 +0200
--- src/window.c 2019-05-18 15:24:40.685277091 +0200
***************
*** 5830,5839 ****
// Don't change w_topline in any of these cases:
// - window height is 0
// - 'scrollbind' is set and this isn't the current window
! // - window height is sufficient to display the whole buffer
if (height > 0
&& (!wp->w_p_scb || wp == curwin)
! && (height < wp->w_buffer->b_ml.ml_line_count))
{
/*
* Find a value for w_topline that shows the cursor at the same
--- 5830,5840 ----
// Don't change w_topline in any of these cases:
// - window height is 0
// - 'scrollbind' is set and this isn't the current window
! // - window height is sufficient to display the whole buffer and first
line
! // is visible.
if (height > 0
&& (!wp->w_p_scb || wp == curwin)
! && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1))
{
/*
* Find a value for w_topline that shows the cursor at the same
*** ../vim-8.1.1346/src/testdir/test_window_cmd.vim 2019-05-12
14:25:26.321244305 +0200
--- src/testdir/test_window_cmd.vim 2019-05-18 15:26:19.588659971 +0200
***************
*** 745,760 ****
func Test_split_noscroll()
let so_save = &so
! new
! only
!
! " Make sure windows can hold all content after split.
! for i in range(1, 20)
! wincmd +
! redraw!
! endfor
!
! call setline (1, range(1, 8))
normal 100%
split
--- 745,752 ----
func Test_split_noscroll()
let so_save = &so
! enew
! call setline(1, range(1, 8))
normal 100%
split
***************
*** 769,780 ****
call assert_equal(1, info1.topline)
call assert_equal(1, info2.topline)
! " Restore original state.
! for i in range(1, 20)
! wincmd -
! redraw!
! endfor
only!
bwipe!
let &so = so_save
endfunc
--- 761,780 ----
call assert_equal(1, info1.topline)
call assert_equal(1, info2.topline)
! " window that fits all lines by itself, but not when split: closing other
! " window should restore fraction.
only!
+ call setline(1, range(1, &lines - 10))
+ exe &lines / 4
+ let winid1 = win_getid()
+ let info1 = getwininfo(winid1)[0]
+ call assert_equal(1, info1.topline)
+ new
+ redraw
+ close
+ let info1 = getwininfo(winid1)[0]
+ call assert_equal(1, info1.topline)
+
bwipe!
let &so = so_save
endfunc
*** ../vim-8.1.1346/src/version.c 2019-05-18 15:02:20.970415904 +0200
--- src/version.c 2019-05-18 15:25:55.980807043 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1347,
/**/
--
If the Universe is constantly expanding, why can't I ever find a parking space?
/// 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/201905181337.x4IDbkgg002725%40masaka.moolenaar.net.
For more options, visit https://groups.google.com/d/optout.