comparison src/misc1.c @ 11065:f5bd684e47a1 v8.0.0421

patch 8.0.0421: diff mode wrong when adding line at end of buffer commit https://github.com/vim/vim/commit/f58a8475e17bd566760fc7e2a17d35ddf4edacf2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 5 18:03:04 2017 +0100 patch 8.0.0421: diff mode wrong when adding line at end of buffer Problem: Diff mode is displayed wrong when adding a line at the end of a buffer. Solution: Adjust marks in diff mode. (James McCoy, closes #1329)
author Christian Brabandt <cb@256bit.org>
date Sun, 05 Mar 2017 18:15:04 +0100
parents 835604f3c37a
children 814126a34c9d
comparison
equal deleted inserted replaced
11064:1901db360ca6 11065:f5bd684e47a1
1425 == FAIL) 1425 == FAIL)
1426 goto theend; 1426 goto theend;
1427 /* Postpone calling changed_lines(), because it would mess up folding 1427 /* Postpone calling changed_lines(), because it would mess up folding
1428 * with markers. 1428 * with markers.
1429 * Skip mark_adjust when adding a line after the last one, there can't 1429 * Skip mark_adjust when adding a line after the last one, there can't
1430 * be marks there. */ 1430 * be marks there. But still needed in diff mode. */
1431 if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count) 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 )
1432 mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); 1436 mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
1433 did_append = TRUE; 1437 did_append = TRUE;
1434 } 1438 }
1435 #ifdef FEAT_VREPLACE 1439 #ifdef FEAT_VREPLACE
1436 else 1440 else
2861 */ 2865 */
2862 void 2866 void
2863 appended_lines_mark(linenr_T lnum, long count) 2867 appended_lines_mark(linenr_T lnum, long count)
2864 { 2868 {
2865 /* Skip mark_adjust when adding a line after the last one, there can't 2869 /* Skip mark_adjust when adding a line after the last one, there can't
2866 * be marks there. */ 2870 * be marks there. But it's still needed in diff mode. */
2867 if (lnum + count < curbuf->b_ml.ml_line_count) 2871 if (lnum + count < curbuf->b_ml.ml_line_count
2872 #ifdef FEAT_DIFF
2873 || curwin->w_p_diff
2874 #endif
2875 )
2868 mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); 2876 mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L);
2869 changed_lines(lnum + 1, 0, lnum + 1, count); 2877 changed_lines(lnum + 1, 0, lnum + 1, count);
2870 } 2878 }
2871 2879
2872 /* 2880 /*