comparison src/ops.c @ 3252:80c529a5650f v7.3.395

updated for version 7.3.395 Problem: "dv?bar" in the last line deletes too much and breaks undo. Solution: Only adjust the cursor position when it's after the last line of the buffer. Add a test. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Tue, 10 Jan 2012 13:44:27 +0100
parents d68f20a86a3e
children 2f075595590f
comparison
equal deleted inserted replaced
3251:310d4e1c7026 3252:80c529a5650f
1959 && n > (int)STRLEN(ml_get(oap->end.lnum))) 1959 && n > (int)STRLEN(ml_get(oap->end.lnum)))
1960 { 1960 {
1961 /* Special case: gH<Del> deletes the last line. */ 1961 /* Special case: gH<Del> deletes the last line. */
1962 del_lines(1L, FALSE); 1962 del_lines(1L, FALSE);
1963 curwin->w_cursor = curpos; /* restore curwin->w_cursor */ 1963 curwin->w_cursor = curpos; /* restore curwin->w_cursor */
1964 if (curwin->w_cursor.lnum > 1) 1964 if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
1965 --curwin->w_cursor.lnum; 1965 curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
1966 } 1966 }
1967 else 1967 else
1968 { 1968 {
1969 /* delete from start of line until op_end */ 1969 /* delete from start of line until op_end */
1970 curwin->w_cursor.col = 0; 1970 curwin->w_cursor.col = 0;
4432 return (idx2 == leader2_len && idx1 == leader1_len); 4432 return (idx2 == leader2_len && idx1 == leader1_len);
4433 } 4433 }
4434 #endif 4434 #endif
4435 4435
4436 /* 4436 /*
4437 * implementation of the format operator 'gq' 4437 * Implementation of the format operator 'gq'.
4438 */ 4438 */
4439 void 4439 void
4440 op_format(oap, keep_cursor) 4440 op_format(oap, keep_cursor)
4441 oparg_T *oap; 4441 oparg_T *oap;
4442 int keep_cursor; /* keep cursor on same text char */ 4442 int keep_cursor; /* keep cursor on same text char */