Skip to content

Commit e67d546

Browse files
committed
patch 7.4.2275
Problem: ":diffoff!" does not remove filler lines. Solution: Force a redraw and invalidate the cursor. (closes #1014)
1 parent 818078d commit e67d546

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/diff.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,10 +1236,14 @@ ex_diffoff(exarg_T *eap)
12361236
: wp->w_p_fen_save;
12371237

12381238
foldUpdateAll(wp);
1239-
/* make sure topline is not halfway a fold */
1240-
changed_window_setting_win(wp);
12411239
#endif
12421240
}
1241+
/* remove filler lines */
1242+
wp->w_topfill = 0;
1243+
1244+
/* make sure topline is not halfway a fold and cursor is
1245+
* invalidated */
1246+
changed_window_setting_win(wp);
12431247

12441248
/* Note: 'sbo' is not restored, it's a global option. */
12451249
diff_buf_adjust(wp);

src/testdir/test_diffmode.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,19 @@ func Test_diffget_diffput()
202202
bwipe!
203203
enew!
204204
endfunc
205+
206+
func Test_diffoff()
207+
enew!
208+
call setline(1, ['Two', 'Three'])
209+
let normattr = screenattr(1, 1)
210+
diffthis
211+
botright vert new
212+
call setline(1, ['One', '', 'Two', 'Three'])
213+
diffthis
214+
redraw
215+
diffoff!
216+
redraw
217+
call assert_equal(normattr, screenattr(1, 1))
218+
bwipe!
219+
bwipe!
220+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2275,
766768
/**/
767769
2274,
768770
/**/

0 commit comments

Comments
 (0)