forked from aniani/vim
updated for version 7.2-226
This commit is contained in:
@@ -4013,6 +4013,9 @@ ex_change(eap)
|
|||||||
break;
|
break;
|
||||||
ml_delete(eap->line1, FALSE);
|
ml_delete(eap->line1, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make sure the cursor is not beyond the end of the file now */
|
||||||
|
check_cursor_lnum();
|
||||||
deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum));
|
deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum));
|
||||||
|
|
||||||
/* ":append" on the line above the deleted lines. */
|
/* ":append" on the line above the deleted lines. */
|
||||||
|
@@ -7845,10 +7845,10 @@ ex_read(eap)
|
|||||||
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
|
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
|
||||||
{
|
{
|
||||||
ml_delete(lnum, FALSE);
|
ml_delete(lnum, FALSE);
|
||||||
deleted_lines_mark(lnum, 1L);
|
|
||||||
if (curwin->w_cursor.lnum > 1
|
if (curwin->w_cursor.lnum > 1
|
||||||
&& curwin->w_cursor.lnum >= lnum)
|
&& curwin->w_cursor.lnum >= lnum)
|
||||||
--curwin->w_cursor.lnum;
|
--curwin->w_cursor.lnum;
|
||||||
|
deleted_lines_mark(lnum, 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redraw_curbuf_later(VALID);
|
redraw_curbuf_later(VALID);
|
||||||
|
@@ -2169,9 +2169,9 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv)
|
|||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
raise_vim_exn(_("cannot delete line"));
|
raise_vim_exn(_("cannot delete line"));
|
||||||
}
|
}
|
||||||
deleted_lines_mark((linenr_T)n, 1L);
|
|
||||||
if (buf->buf == curwin->w_buffer)
|
if (buf->buf == curwin->w_buffer)
|
||||||
mz_fix_cursor(n, n + 1, -1);
|
mz_fix_cursor(n, n + 1, -1);
|
||||||
|
deleted_lines_mark((linenr_T)n, 1L);
|
||||||
|
|
||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
|
|
||||||
@@ -2299,9 +2299,9 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
|
|||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
raise_vim_exn(_("cannot delete line"));
|
raise_vim_exn(_("cannot delete line"));
|
||||||
}
|
}
|
||||||
deleted_lines_mark((linenr_T)lo, (long)old_len);
|
|
||||||
if (buf->buf == curwin->w_buffer)
|
if (buf->buf == curwin->w_buffer)
|
||||||
mz_fix_cursor(lo, hi, -old_len);
|
mz_fix_cursor(lo, hi, -old_len);
|
||||||
|
deleted_lines_mark((linenr_T)lo, (long)old_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
|
@@ -1233,9 +1233,8 @@ Delete(vimbuf, ...)
|
|||||||
if (u_savedel(lnum, 1) == OK)
|
if (u_savedel(lnum, 1) == OK)
|
||||||
{
|
{
|
||||||
ml_delete(lnum, 0);
|
ml_delete(lnum, 0);
|
||||||
deleted_lines_mark(lnum, 1L);
|
|
||||||
if (aco.save_curbuf == curbuf)
|
|
||||||
check_cursor();
|
check_cursor();
|
||||||
|
deleted_lines_mark(lnum, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore curwin/curbuf and a few other things */
|
/* restore curwin/curbuf and a few other things */
|
||||||
|
@@ -2497,9 +2497,9 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
|
|||||||
PyErr_SetVim(_("cannot delete line"));
|
PyErr_SetVim(_("cannot delete line"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deleted_lines_mark((linenr_T)n, 1L);
|
|
||||||
if (buf == curwin->w_buffer)
|
if (buf == curwin->w_buffer)
|
||||||
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
||||||
|
deleted_lines_mark((linenr_T)n, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
@@ -2596,10 +2596,9 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deleted_lines_mark((linenr_T)lo, (long)i);
|
|
||||||
|
|
||||||
if (buf == curwin->w_buffer)
|
if (buf == curwin->w_buffer)
|
||||||
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
||||||
|
deleted_lines_mark((linenr_T)lo, (long)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
curbuf = savebuf;
|
curbuf = savebuf;
|
||||||
|
16
src/misc1.c
16
src/misc1.c
@@ -2345,12 +2345,13 @@ del_lines(nlines, undo)
|
|||||||
int undo; /* if TRUE, prepare for undo */
|
int undo; /* if TRUE, prepare for undo */
|
||||||
{
|
{
|
||||||
long n;
|
long n;
|
||||||
|
linenr_T first = curwin->w_cursor.lnum;
|
||||||
|
|
||||||
if (nlines <= 0)
|
if (nlines <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* save the deleted lines for undo */
|
/* save the deleted lines for undo */
|
||||||
if (undo && u_savedel(curwin->w_cursor.lnum, nlines) == FAIL)
|
if (undo && u_savedel(first, nlines) == FAIL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (n = 0; n < nlines; )
|
for (n = 0; n < nlines; )
|
||||||
@@ -2358,18 +2359,21 @@ del_lines(nlines, undo)
|
|||||||
if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */
|
if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ml_delete(curwin->w_cursor.lnum, TRUE);
|
ml_delete(first, TRUE);
|
||||||
++n;
|
++n;
|
||||||
|
|
||||||
/* If we delete the last line in the file, stop */
|
/* If we delete the last line in the file, stop */
|
||||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
|
if (first > curbuf->b_ml.ml_line_count)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* adjust marks, mark the buffer as changed and prepare for displaying */
|
|
||||||
deleted_lines_mark(curwin->w_cursor.lnum, n);
|
|
||||||
|
|
||||||
|
/* Correct the cursor position before calling deleted_lines_mark(), it may
|
||||||
|
* trigger a callback to display the cursor. */
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
check_cursor_lnum();
|
check_cursor_lnum();
|
||||||
|
|
||||||
|
/* adjust marks, mark the buffer as changed and prepare for displaying */
|
||||||
|
deleted_lines_mark(first, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -2621,6 +2625,8 @@ deleted_lines(lnum, count)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Like deleted_lines(), but adjust marks first.
|
* Like deleted_lines(), but adjust marks first.
|
||||||
|
* Make sure the cursor is on a valid line before calling, a GUI callback may
|
||||||
|
* be triggered to display the cursor.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
deleted_lines_mark(lnum, count)
|
deleted_lines_mark(lnum, count)
|
||||||
|
@@ -676,6 +676,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
226,
|
||||||
/**/
|
/**/
|
||||||
225,
|
225,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user