Mercurial > vim
comparison src/testdir/test_filechanged.vim @ 27635:6ca2d8f4cd32 v8.2.4343
patch 8.2.4343: when reloading not all properties are detected
Commit: https://github.com/vim/vim/commit/8196e94a8b72ed8618605cb66615571313097d78
Author: Rob Pilling <robpilling@gmail.com>
Date: Fri Feb 11 15:12:10 2022 +0000
patch 8.2.4343: when reloading not all properties are detected
Problem: When reloading not all properties are detected.
Solution: Add the "edit" value to v:fcs_choice. (Rob Pilling, closes https://github.com/vim/vim/issues/9579)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Feb 2022 16:15:03 +0100 |
parents | 1725bb56178a |
children | 9bc9970e72eb |
comparison
equal
deleted
inserted
replaced
27634:9fe2fed9bb4b | 27635:6ca2d8f4cd32 |
---|---|
89 bwipe! | 89 bwipe! |
90 call delete(undofile('Xchanged_r')) | 90 call delete(undofile('Xchanged_r')) |
91 call delete('Xchanged_r') | 91 call delete('Xchanged_r') |
92 endfunc | 92 endfunc |
93 | 93 |
94 func Test_FileChangedShell_edit() | |
95 CheckUnix | |
96 | |
97 new Xchanged_r | |
98 call setline(1, 'reload this') | |
99 set fileformat=unix | |
100 write | |
101 | |
102 " File format changed, reload (content only, no 'ff' etc) | |
103 augroup testreload | |
104 au! | |
105 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'reload' | |
106 augroup END | |
107 call assert_equal(&fileformat, 'unix') | |
108 call writefile(["line1\r", "line2\r"], 'Xchanged_r') | |
109 let g:reason = '' | |
110 checktime | |
111 call assert_equal('changed', g:reason) | |
112 call assert_equal(&fileformat, 'unix') | |
113 call assert_equal("line1\r", getline(1)) | |
114 call assert_equal("line2\r", getline(2)) | |
115 %s/\r | |
116 write | |
117 | |
118 " File format changed, reload with 'ff', etc | |
119 augroup testreload | |
120 au! | |
121 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'edit' | |
122 augroup END | |
123 call assert_equal(&fileformat, 'unix') | |
124 call writefile(["line1\r", "line2\r"], 'Xchanged_r') | |
125 let g:reason = '' | |
126 checktime | |
127 call assert_equal('changed', g:reason) | |
128 call assert_equal(&fileformat, 'dos') | |
129 call assert_equal('line1', getline(1)) | |
130 call assert_equal('line2', getline(2)) | |
131 set fileformat=unix | |
132 write | |
133 | |
134 au! testreload | |
135 bwipe! | |
136 call delete(undofile('Xchanged_r')) | |
137 call delete('Xchanged_r') | |
138 endfunc | |
139 | |
140 func Test_FileChangedShell_edit_dialog() | |
141 CheckNotGui | |
142 | |
143 new Xchanged_r | |
144 call setline(1, 'reload this') | |
145 set fileformat=unix | |
146 write | |
147 | |
148 " File format changed, reload (content only) via prompt | |
149 augroup testreload | |
150 au! | |
151 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask' | |
152 augroup END | |
153 call assert_equal(&fileformat, 'unix') | |
154 call writefile(["line1\r", "line2\r"], 'Xchanged_r') | |
155 let g:reason = '' | |
156 call feedkeys('L', 'L') " load file content only | |
157 checktime | |
158 call assert_equal('changed', g:reason) | |
159 call assert_equal(&fileformat, 'unix') | |
160 call assert_equal("line1\r", getline(1)) | |
161 call assert_equal("line2\r", getline(2)) | |
162 %s/\r | |
163 write | |
164 | |
165 " File format changed, reload (file and options) via prompt | |
166 augroup testreload | |
167 au! | |
168 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask' | |
169 augroup END | |
170 call assert_equal(&fileformat, 'unix') | |
171 call writefile(["line1\r", "line2\r"], 'Xchanged_r') | |
172 let g:reason = '' | |
173 call feedkeys('a', 'L') " load file content and options | |
174 checktime | |
175 call assert_equal('changed', g:reason) | |
176 call assert_equal(&fileformat, 'dos') | |
177 call assert_equal("line1", getline(1)) | |
178 call assert_equal("line2", getline(2)) | |
179 set fileformat=unix | |
180 write | |
181 | |
182 au! testreload | |
183 bwipe! | |
184 call delete(undofile('Xchanged_r')) | |
185 call delete('Xchanged_r') | |
186 endfunc | |
187 | |
94 func Test_file_changed_dialog() | 188 func Test_file_changed_dialog() |
95 CheckUnix | 189 CheckUnix |
96 CheckNotGui | 190 CheckNotGui |
97 au! FileChangedShell | 191 au! FileChangedShell |
98 | 192 |