summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0046
blob: 2b9682b93de862a42930701dfc918ff441449759 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0046
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.0046
Problem:    Loading a session file fails if 'winheight' is a big number.
Solution:   Set 'minwinheight' to zero at first.  Don't give an error when
            setting 'minwinheight' while 'winheight' is a big number.
            Fix using vertical splits. Fix setting 'minwinwidth'.
            (closes #2970)
Files:	    src/testdir/test_mksession.vim, src/option.c, src/window.c,
            src/proto/window.pro


*** ../vim-8.1.0045/src/testdir/test_mksession.vim	2018-03-09 21:25:55.000000000 +0100
--- src/testdir/test_mksession.vim	2018-06-12 16:38:40.344105918 +0200
***************
*** 106,118 ****
  
  func Test_mksession_winheight()
    new
!   set winheight=10 winminheight=2
    mksession! Xtest_mks.out
    source Xtest_mks.out
  
    call delete('Xtest_mks.out')
  endfunc
  
  func Test_mksession_arglist()
    argdel *
    next file1 file2 file3 file4
--- 106,127 ----
  
  func Test_mksession_winheight()
    new
!   set winheight=10
!   set winminheight=2
    mksession! Xtest_mks.out
    source Xtest_mks.out
  
    call delete('Xtest_mks.out')
  endfunc
  
+ func Test_mksession_large_winheight()
+   set winheight=999
+   mksession! Xtest_mks_winheight.out
+   set winheight&
+   source Xtest_mks_winheight.out
+   call delete('Xtest_mks_winheight.out')
+ endfunc
+ 
  func Test_mksession_arglist()
    argdel *
    next file1 file2 file3 file4
*** ../vim-8.1.0045/src/option.c	2018-06-04 17:28:04.729961269 +0200
--- src/option.c	2018-06-12 16:34:27.832376913 +0200
***************
*** 8796,8801 ****
--- 8796,8802 ----
       */
      if (pp == &p_wh || pp == &p_hh)
      {
+ 	// 'winheight' and 'helpheight'
  	if (p_wh < 1)
  	{
  	    errmsg = e_positive;
***************
*** 8821,8830 ****
  		win_setheight((int)p_hh);
  	}
      }
- 
-     /* 'winminheight' */
      else if (pp == &p_wmh)
      {
  	if (p_wmh < 0)
  	{
  	    errmsg = e_positive;
--- 8822,8830 ----
  		win_setheight((int)p_hh);
  	}
      }
      else if (pp == &p_wmh)
      {
+ 	// 'winminheight'
  	if (p_wmh < 0)
  	{
  	    errmsg = e_positive;
***************
*** 8839,8844 ****
--- 8839,8845 ----
      }
      else if (pp == &p_wiw)
      {
+ 	// 'winwidth'
  	if (p_wiw < 1)
  	{
  	    errmsg = e_positive;
***************
*** 8854,8863 ****
  	if (!ONE_WINDOW && curwin->w_width < p_wiw)
  	    win_setwidth((int)p_wiw);
      }
- 
-     /* 'winminwidth' */
      else if (pp == &p_wmw)
      {
  	if (p_wmw < 0)
  	{
  	    errmsg = e_positive;
--- 8855,8863 ----
  	if (!ONE_WINDOW && curwin->w_width < p_wiw)
  	    win_setwidth((int)p_wiw);
      }
      else if (pp == &p_wmw)
      {
+ 	// 'winminwidth'
  	if (p_wmw < 0)
  	{
  	    errmsg = e_positive;
***************
*** 8868,8874 ****
  	    errmsg = e_winwidth;
  	    p_wmw = p_wiw;
  	}
! 	win_setminheight();
      }
  
      /* (re)set last window status line */
--- 8868,8874 ----
  	    errmsg = e_winwidth;
  	    p_wmw = p_wiw;
  	}
! 	win_setminwidth();
      }
  
      /* (re)set last window status line */
*** ../vim-8.1.0045/src/window.c	2018-06-10 14:39:47.022412206 +0200
--- src/window.c	2018-06-12 16:41:04.447771813 +0200
***************
*** 5430,5457 ****
  }
  
  /*
!  * Check 'winminheight' for a valid value.
   */
      void
  win_setminheight(void)
  {
      int		room;
      int		first = TRUE;
-     win_T	*wp;
  
!     /* loop until there is a 'winminheight' that is possible */
      while (p_wmh > 0)
      {
! 	/* TODO: handle vertical splits */
! 	room = -p_wh;
! 	FOR_ALL_WINDOWS(wp)
! 	    room += VISIBLE_HEIGHT(wp) - p_wmh;
! 	if (room >= 0)
  	    break;
  	--p_wmh;
  	if (first)
  	{
  	    EMSG(_(e_noroom));
  	    first = FALSE;
  	}
      }
--- 5430,5481 ----
  }
  
  /*
!  * Check 'winminheight' for a valid value and reduce it if needed.
   */
      void
  win_setminheight(void)
  {
      int		room;
+     int		needed;
      int		first = TRUE;
  
!     // loop until there is a 'winminheight' that is possible
      while (p_wmh > 0)
      {
! 	room = Rows - p_ch;
! 	needed = frame_minheight(topframe, NULL);
! 	if (room >= needed)
  	    break;
  	--p_wmh;
  	if (first)
  	{
  	    EMSG(_(e_noroom));
+ 	    first = FALSE;
+ 	}
+     }
+ }
+ 
+ /*
+  * Check 'winminwidth' for a valid value and reduce it if needed.
+  */
+     void
+ win_setminwidth(void)
+ {
+     int		room;
+     int		needed;
+     int		first = TRUE;
+ 
+     // loop until there is a 'winminheight' that is possible
+     while (p_wmw > 0)
+     {
+ 	room = Columns;
+ 	needed = frame_minwidth(topframe, NULL);
+ 	if (room >= needed)
+ 	    break;
+ 	--p_wmw;
+ 	if (first)
+ 	{
+ 	    EMSG(_(e_noroom));
  	    first = FALSE;
  	}
      }
*** ../vim-8.1.0045/src/proto/window.pro	2018-05-17 13:52:56.000000000 +0200
--- src/proto/window.pro	2018-06-12 16:34:10.876376437 +0200
***************
*** 54,59 ****
--- 54,60 ----
  void win_setwidth(int width);
  void win_setwidth_win(int width, win_T *wp);
  void win_setminheight(void);
+ void win_setminwidth(void);
  void win_drag_status_line(win_T *dragwin, int offset);
  void win_drag_vsep_line(win_T *dragwin, int offset);
  void set_fraction(win_T *wp);
*** ../vim-8.1.0045/src/version.c	2018-06-12 15:22:39.640579965 +0200
--- src/version.c	2018-06-12 16:01:12.917283351 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     46,
  /**/

-- 
He who laughs last, thinks slowest.

 /// 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    ///