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
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0333
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.0333
Problem: :mkview does not restore cursor properly after "$". (Dominique
Pelle)
Solution: Position the cursor with "normal! $".
Files: src/ex_docmd.c, src/testdir/test_mksession.vim
*** ../vim-8.1.0332/src/ex_docmd.c 2018-08-23 22:51:30.878144125 +0200
--- src/ex_docmd.c 2018-08-29 20:55:57.947479752 +0200
***************
*** 11706,11711 ****
--- 11706,11723 ----
return TRUE;
}
+ static int
+ put_view_curpos(FILE *fd, win_T *wp, char *spaces)
+ {
+ int r;
+
+ if (wp->w_curswant == MAXCOL)
+ r = fprintf(fd, "%snormal! $", spaces);
+ else
+ r = fprintf(fd, "%snormal! 0%d|", spaces, wp->w_virtcol + 1);
+ return r < 0 || put_eol(fd) == FAIL ? FALSE : OK;
+ }
+
/*
* Write commands to "fd" to restore the view of a window.
* Caller must make sure 'scrolloff' is zero.
***************
*** 11897,11913 ****
(long)wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL
|| put_line(fd, "else") == FAIL
! || fprintf(fd, " normal! 0%d|", wp->w_virtcol + 1) < 0
! || put_eol(fd) == FAIL
|| put_line(fd, "endif") == FAIL)
return FAIL;
}
! else
! {
! if (fprintf(fd, "normal! 0%d|", wp->w_virtcol + 1) < 0
! || put_eol(fd) == FAIL)
! return FAIL;
! }
}
}
--- 11909,11920 ----
(long)wp->w_virtcol + 1) < 0
|| put_eol(fd) == FAIL
|| put_line(fd, "else") == FAIL
! || put_view_curpos(fd, wp, " ") == FAIL
|| put_line(fd, "endif") == FAIL)
return FAIL;
}
! else if (put_view_curpos(fd, wp, "") == FAIL)
! return FAIL;
}
}
*** ../vim-8.1.0332/src/testdir/test_mksession.vim 2018-08-28 22:19:27.739993071 +0200
--- src/testdir/test_mksession.vim 2018-08-29 20:54:27.800200938 +0200
***************
*** 22,28 ****
\ 'two tabs in one line',
\ 'one ä multibyteCharacter',
\ 'aä Ä two multiByte characters',
! \ 'Aäöü three mulTibyte characters'
\ ])
let tmpfile = 'Xtemp'
exec 'w! ' . tmpfile
--- 22,29 ----
\ 'two tabs in one line',
\ 'one ä multibyteCharacter',
\ 'aä Ä two multiByte characters',
! \ 'Aäöü three mulTibyte characters',
! \ 'short line',
\ ])
let tmpfile = 'Xtemp'
exec 'w! ' . tmpfile
***************
*** 44,49 ****
--- 45,52 ----
norm! j16|
split
norm! j16|
+ split
+ norm! j$
wincmd l
set nowrap
***************
*** 66,72 ****
split
call wincol()
mksession! Xtest_mks.out
! let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"')
let expected = [
\ 'normal! 016|',
\ 'normal! 016|',
--- 69,75 ----
split
call wincol()
mksession! Xtest_mks.out
! let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! [0$]\\|^ *exe ''normal!\\)"')
let expected = [
\ 'normal! 016|',
\ 'normal! 016|',
***************
*** 76,81 ****
--- 79,85 ----
\ 'normal! 016|',
\ 'normal! 016|',
\ 'normal! 016|',
+ \ 'normal! $',
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
\ " normal! 016|",
\ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
***************
*** 317,323 ****
help :mkview
set number
norm! V}zf
! let pos = getpos('.')
let linefoldclosed1 = foldclosed('.')
mkview! Xview
set nonumber
--- 321,327 ----
help :mkview
set number
norm! V}zf
! let pos = getcurpos()
let linefoldclosed1 = foldclosed('.')
mkview! Xview
set nonumber
***************
*** 329,335 ****
source Xview
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
! call assert_equal(pos, getpos('.'))
call assert_equal(linefoldclosed1, foldclosed('.'))
" Creating a view again with the same file name should fail (file
--- 333,339 ----
source Xview
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
! call assert_equal(pos, getcurpos())
call assert_equal(linefoldclosed1, foldclosed('.'))
" Creating a view again with the same file name should fail (file
***************
*** 352,358 ****
help :mkview
set number
norm! V}zf
! let pos = getpos('.')
let linefoldclosed1 = foldclosed('.')
mkview 1
set nonumber
--- 356,362 ----
help :mkview
set number
norm! V}zf
! let pos = getcurpos()
let linefoldclosed1 = foldclosed('.')
mkview 1
set nonumber
***************
*** 369,375 ****
\ glob('Xviewdir/*'))
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
! call assert_equal(pos, getpos('.'))
call assert_equal(linefoldclosed1, foldclosed('.'))
call delete('Xviewdir', 'rf')
--- 373,379 ----
\ glob('Xviewdir/*'))
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
! call assert_equal(pos, getcurpos())
call assert_equal(linefoldclosed1, foldclosed('.'))
call delete('Xviewdir', 'rf')
*** ../vim-8.1.0332/src/version.c 2018-08-28 23:09:03.893824422 +0200
--- src/version.c 2018-08-29 20:57:17.814830811 +0200
***************
*** 796,797 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 333,
/**/
--
Q: What's a light-year?
A: One-third less calories than a regular year.
/// 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 ///
|