To: vim_dev@googlegroups.com Subject: Patch 7.4.1896 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1896 Problem: Invoking mark_adjust() when adding a new line below the last line is pointless. Solution: Skip calling mark_adjust() when appending below the last line. Files: src/misc1.c, src/ops.c *** ../vim-7.4.1895/src/misc1.c 2016-04-23 14:33:11.337175069 +0200 --- src/misc1.c 2016-06-04 19:49:13.258020548 +0200 *************** *** 1425,1432 **** == FAIL) goto theend; /* Postpone calling changed_lines(), because it would mess up folding ! * with markers. */ ! mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); did_append = TRUE; } #ifdef FEAT_VREPLACE --- 1425,1435 ---- == FAIL) goto theend; /* Postpone calling changed_lines(), because it would mess up folding ! * with markers. ! * Skip mark_adjust when adding a line after the last one, there can't ! * be marks there. */ ! if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count) ! mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L); did_append = TRUE; } #ifdef FEAT_VREPLACE *************** *** 2861,2867 **** void appended_lines_mark(linenr_T lnum, long count) { ! mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); changed_lines(lnum + 1, 0, lnum + 1, count); } --- 2864,2873 ---- void appended_lines_mark(linenr_T lnum, long count) { ! /* Skip mark_adjust when adding a line after the last one, there can't ! * be marks there. */ ! if (lnum + count < curbuf->b_ml.ml_line_count) ! mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L); changed_lines(lnum + 1, 0, lnum + 1, count); } *** ../vim-7.4.1895/src/ops.c 2016-04-23 14:33:11.341175028 +0200 --- src/ops.c 2016-06-04 19:58:56.226012529 +0200 *************** *** 3885,3891 **** if (dir == FORWARD) curbuf->b_op_start.lnum++; } ! mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR), (linenr_T)MAXLNUM, nr_lines, 0L); /* note changed text for displaying and folding */ --- 3885,3895 ---- if (dir == FORWARD) curbuf->b_op_start.lnum++; } ! /* Skip mark_adjust when adding lines after the last one, there ! * can't be marks there. */ ! if (curbuf->b_op_start.lnum + (y_type == MCHAR) - 1 + nr_lines ! < curbuf->b_ml.ml_line_count) ! mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR), (linenr_T)MAXLNUM, nr_lines, 0L); /* note changed text for displaying and folding */ *** ../vim-7.4.1895/src/version.c 2016-06-04 18:49:15.386070039 +0200 --- src/version.c 2016-06-04 20:04:54.974007594 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1896, /**/ -- hundred-and-one symptoms of being an internet addict: 44. Your friends no longer send you e-mail...they just log on to your IRC channel. /// 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 ///