summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1347
blob: 8653c526a3167d6fa312279940ddf877a81cee26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1347
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

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 -- Bram@Moolenaar.net -- 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    ///