File tree Expand file tree Collapse file tree 4 files changed +41
-7
lines changed
Expand file tree Collapse file tree 4 files changed +41
-7
lines changed Original file line number Diff line number Diff line change @@ -1427,8 +1427,12 @@ open_line(
14271427 /* Postpone calling changed_lines(), because it would mess up folding
14281428 * with markers.
14291429 * Skip mark_adjust when adding a line after the last one, there can't
1430- * be marks there. */
1431- if (curwin -> w_cursor .lnum + 1 < curbuf -> b_ml .ml_line_count )
1430+ * be marks there. But still needed in diff mode. */
1431+ if (curwin -> w_cursor .lnum + 1 < curbuf -> b_ml .ml_line_count
1432+ #ifdef FEAT_DIFF
1433+ || curwin -> w_p_diff
1434+ #endif
1435+ )
14321436 mark_adjust (curwin -> w_cursor .lnum + 1 , (linenr_T )MAXLNUM , 1L , 0L );
14331437 did_append = TRUE;
14341438 }
@@ -2863,8 +2867,12 @@ appended_lines(linenr_T lnum, long count)
28632867appended_lines_mark (linenr_T lnum , long count )
28642868{
28652869 /* Skip mark_adjust when adding a line after the last one, there can't
2866- * be marks there. */
2867- if (lnum + count < curbuf -> b_ml .ml_line_count )
2870+ * be marks there. But it's still needed in diff mode. */
2871+ if (lnum + count < curbuf -> b_ml .ml_line_count
2872+ #ifdef FEAT_DIFF
2873+ || curwin -> w_p_diff
2874+ #endif
2875+ )
28682876 mark_adjust (lnum + 1 , (linenr_T )MAXLNUM , count , 0L );
28692877 changed_lines (lnum + 1 , 0 , lnum + 1 , count );
28702878}
Original file line number Diff line number Diff line change @@ -3927,9 +3927,13 @@ do_put(
39273927 curbuf -> b_op_start .lnum ++ ;
39283928 }
39293929 /* Skip mark_adjust when adding lines after the last one, there
3930- * can't be marks there. */
3930+ * can't be marks there. But still needed in diff mode. */
39313931 if (curbuf -> b_op_start .lnum + (y_type == MCHAR ) - 1 + nr_lines
3932- < curbuf -> b_ml .ml_line_count )
3932+ < curbuf -> b_ml .ml_line_count
3933+ #ifdef FEAT_DIFF
3934+ || curwin -> w_p_diff
3935+ #endif
3936+ )
39333937 mark_adjust (curbuf -> b_op_start .lnum + (y_type == MCHAR ),
39343938 (linenr_T )MAXLNUM , nr_lines , 0L );
39353939
@@ -6311,7 +6315,7 @@ write_viminfo_registers(FILE *fp)
63116315
63126316/*
63136317 * Routine to export any final X selection we had to the environment
6314- * so that the text is still available after vim has exited. X selections
6318+ * so that the text is still available after Vim has exited. X selections
63156319 * only exist while the owning application exists, so we write to the
63166320 * permanent (while X runs) store CUT_BUFFER0.
63176321 * Dump the CLIPBOARD selection if we own it (it's logically the more
Original file line number Diff line number Diff line change @@ -347,3 +347,23 @@ func Test_diff_nomodifiable()
347347 call assert_fails (' norm do' , ' E21:' )
348348 % bwipe!
349349endfunc
350+
351+ func Test_diff_lastline ()
352+ enew !
353+ only !
354+ call setline (1 , [' This is a ' , ' line with five ' , ' rows' ])
355+ diffthis
356+ botright vert new
357+ call setline (1 , [' This is' , ' a line with ' , ' four rows' ])
358+ diffthis
359+ 1
360+ call feedkeys (" Je a\<CR> " , ' tx' )
361+ call feedkeys (" Je a\<CR> " , ' tx' )
362+ let w1lines = winline ()
363+ wincmd w
364+ $
365+ let w2lines = winline ()
366+ call assert_equal (w2lines, w1lines)
367+ bwipe!
368+ bwipe!
369+ endfunc
Original file line number Diff line number Diff line change @@ -764,6 +764,8 @@ static char *(features[]) =
764764
765765static int included_patches [] =
766766{ /* Add new patch number below this line */
767+ /**/
768+ 421 ,
767769/**/
768770 420 ,
769771/**/
You can’t perform that action at this time.
0 commit comments