|
Karsten Hopp |
81c285 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
81c285 |
Subject: Patch 7.2.226
|
|
Karsten Hopp |
81c285 |
Fcc: outbox
|
|
Karsten Hopp |
81c285 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
81c285 |
Mime-Version: 1.0
|
|
Karsten Hopp |
81c285 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
81c285 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
81c285 |
------------
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
Patch 7.2.226
|
|
Karsten Hopp |
81c285 |
Problem: ml_get error after deleting the last line. (Xavier de Gaye)
|
|
Karsten Hopp |
81c285 |
Solution: When adjusting marks a callback may be invoked. Adjust the cursor
|
|
Karsten Hopp |
81c285 |
position before invoking deleted_lines_mark().
|
|
Karsten Hopp |
81c285 |
Files: src/ex_cmds.c, src/ex_docmd.c, src/if_mzsch.c, src/if_python.c,
|
|
Karsten Hopp |
81c285 |
src/if_perl.xs, src/misc1.c
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/ex_cmds.c 2009-05-17 13:30:58.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/ex_cmds.c 2009-07-09 12:56:51.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 4013,4018 ****
|
|
Karsten Hopp |
81c285 |
--- 4013,4021 ----
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
ml_delete(eap->line1, FALSE);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
+
|
|
Karsten Hopp |
81c285 |
+ /* make sure the cursor is not beyond the end of the file now */
|
|
Karsten Hopp |
81c285 |
+ check_cursor_lnum();
|
|
Karsten Hopp |
81c285 |
deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum));
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* ":append" on the line above the deleted lines. */
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/ex_docmd.c 2009-07-09 15:55:34.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/ex_docmd.c 2009-07-09 15:24:03.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 7845,7854 ****
|
|
Karsten Hopp |
81c285 |
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
ml_delete(lnum, FALSE);
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark(lnum, 1L);
|
|
Karsten Hopp |
81c285 |
if (curwin->w_cursor.lnum > 1
|
|
Karsten Hopp |
81c285 |
&& curwin->w_cursor.lnum >= lnum)
|
|
Karsten Hopp |
81c285 |
--curwin->w_cursor.lnum;
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
redraw_curbuf_later(VALID);
|
|
Karsten Hopp |
81c285 |
--- 7845,7854 ----
|
|
Karsten Hopp |
81c285 |
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
ml_delete(lnum, FALSE);
|
|
Karsten Hopp |
81c285 |
if (curwin->w_cursor.lnum > 1
|
|
Karsten Hopp |
81c285 |
&& curwin->w_cursor.lnum >= lnum)
|
|
Karsten Hopp |
81c285 |
--curwin->w_cursor.lnum;
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark(lnum, 1L);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
redraw_curbuf_later(VALID);
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/if_mzsch.c 2009-06-24 17:51:01.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/if_mzsch.c 2009-07-09 12:59:17.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2169,2177 ****
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
raise_vim_exn(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
81c285 |
if (buf->buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
mz_fix_cursor(n, n + 1, -1);
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
--- 2169,2177 ----
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
raise_vim_exn(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
if (buf->buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
mz_fix_cursor(n, n + 1, -1);
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2299,2307 ****
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
raise_vim_exn(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark((linenr_T)lo, (long)old_len);
|
|
Karsten Hopp |
81c285 |
if (buf->buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
mz_fix_cursor(lo, hi, -old_len);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
--- 2299,2307 ----
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
raise_vim_exn(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
if (buf->buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
mz_fix_cursor(lo, hi, -old_len);
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark((linenr_T)lo, (long)old_len);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/if_python.c 2009-05-21 23:25:38.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/if_python.c 2009-07-09 12:59:45.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2497,2505 ****
|
|
Karsten Hopp |
81c285 |
PyErr_SetVim(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
else
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
81c285 |
if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
--- 2497,2505 ----
|
|
Karsten Hopp |
81c285 |
PyErr_SetVim(_("cannot delete line"));
|
|
Karsten Hopp |
81c285 |
else
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2596,2605 ****
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark((linenr_T)lo, (long)i);
|
|
Karsten Hopp |
81c285 |
-
|
|
Karsten Hopp |
81c285 |
if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
--- 2596,2604 ----
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
81c285 |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark((linenr_T)lo, (long)i);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curbuf = savebuf;
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/if_perl.xs 2009-06-16 16:01:34.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/if_perl.xs 2009-07-09 13:02:16.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 1233,1241 ****
|
|
Karsten Hopp |
81c285 |
if (u_savedel(lnum, 1) == OK)
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
ml_delete(lnum, 0);
|
|
Karsten Hopp |
81c285 |
deleted_lines_mark(lnum, 1L);
|
|
Karsten Hopp |
81c285 |
- if (aco.save_curbuf == curbuf)
|
|
Karsten Hopp |
81c285 |
- check_cursor();
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* restore curwin/curbuf and a few other things */
|
|
Karsten Hopp |
81c285 |
--- 1235,1242 ----
|
|
Karsten Hopp |
81c285 |
if (u_savedel(lnum, 1) == OK)
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
ml_delete(lnum, 0);
|
|
Karsten Hopp |
81c285 |
+ check_cursor();
|
|
Karsten Hopp |
81c285 |
deleted_lines_mark(lnum, 1L);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* restore curwin/curbuf and a few other things */
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/misc1.c 2009-06-24 16:25:23.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/misc1.c 2009-07-09 13:00:59.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2345,2356 ****
|
|
Karsten Hopp |
81c285 |
int undo; /* if TRUE, prepare for undo */
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
long n;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
if (nlines <= 0)
|
|
Karsten Hopp |
81c285 |
return;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* save the deleted lines for undo */
|
|
Karsten Hopp |
81c285 |
! if (undo && u_savedel(curwin->w_cursor.lnum, nlines) == FAIL)
|
|
Karsten Hopp |
81c285 |
return;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
for (n = 0; n < nlines; )
|
|
Karsten Hopp |
81c285 |
--- 2345,2357 ----
|
|
Karsten Hopp |
81c285 |
int undo; /* if TRUE, prepare for undo */
|
|
Karsten Hopp |
81c285 |
{
|
|
Karsten Hopp |
81c285 |
long n;
|
|
Karsten Hopp |
81c285 |
+ linenr_T first = curwin->w_cursor.lnum;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
if (nlines <= 0)
|
|
Karsten Hopp |
81c285 |
return;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* save the deleted lines for undo */
|
|
Karsten Hopp |
81c285 |
! if (undo && u_savedel(first, nlines) == FAIL)
|
|
Karsten Hopp |
81c285 |
return;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
for (n = 0; n < nlines; )
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2358,2375 ****
|
|
Karsten Hopp |
81c285 |
if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
! ml_delete(curwin->w_cursor.lnum, TRUE);
|
|
Karsten Hopp |
81c285 |
++n;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* If we delete the last line in the file, stop */
|
|
Karsten Hopp |
81c285 |
! if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
- /* adjust marks, mark the buffer as changed and prepare for displaying */
|
|
Karsten Hopp |
81c285 |
- deleted_lines_mark(curwin->w_cursor.lnum, n);
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
curwin->w_cursor.col = 0;
|
|
Karsten Hopp |
81c285 |
check_cursor_lnum();
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
int
|
|
Karsten Hopp |
81c285 |
--- 2359,2379 ----
|
|
Karsten Hopp |
81c285 |
if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
! ml_delete(first, TRUE);
|
|
Karsten Hopp |
81c285 |
++n;
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/* If we delete the last line in the file, stop */
|
|
Karsten Hopp |
81c285 |
! if (first > curbuf->b_ml.ml_line_count)
|
|
Karsten Hopp |
81c285 |
break;
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
+ /* Correct the cursor position before calling deleted_lines_mark(), it may
|
|
Karsten Hopp |
81c285 |
+ * trigger a callback to display the cursor. */
|
|
Karsten Hopp |
81c285 |
curwin->w_cursor.col = 0;
|
|
Karsten Hopp |
81c285 |
check_cursor_lnum();
|
|
Karsten Hopp |
81c285 |
+
|
|
Karsten Hopp |
81c285 |
+ /* adjust marks, mark the buffer as changed and prepare for displaying */
|
|
Karsten Hopp |
81c285 |
+ deleted_lines_mark(first, n);
|
|
Karsten Hopp |
81c285 |
}
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
int
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 2621,2626 ****
|
|
Karsten Hopp |
81c285 |
--- 2625,2632 ----
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/*
|
|
Karsten Hopp |
81c285 |
* Like deleted_lines(), but adjust marks first.
|
|
Karsten Hopp |
81c285 |
+ * Make sure the cursor is on a valid line before calling, a GUI callback may
|
|
Karsten Hopp |
81c285 |
+ * be triggered to display the cursor.
|
|
Karsten Hopp |
81c285 |
*/
|
|
Karsten Hopp |
81c285 |
void
|
|
Karsten Hopp |
81c285 |
deleted_lines_mark(lnum, count)
|
|
Karsten Hopp |
81c285 |
*** ../vim-7.2.225/src/version.c 2009-07-09 18:24:24.000000000 +0200
|
|
Karsten Hopp |
81c285 |
--- src/version.c 2009-07-09 20:01:16.000000000 +0200
|
|
Karsten Hopp |
81c285 |
***************
|
|
Karsten Hopp |
81c285 |
*** 678,679 ****
|
|
Karsten Hopp |
81c285 |
--- 678,681 ----
|
|
Karsten Hopp |
81c285 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
81c285 |
+ /**/
|
|
Karsten Hopp |
81c285 |
+ 226,
|
|
Karsten Hopp |
81c285 |
/**/
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
--
|
|
Karsten Hopp |
81c285 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
81c285 |
80. At parties, you introduce your spouse as your "service provider."
|
|
Karsten Hopp |
81c285 |
|
|
Karsten Hopp |
81c285 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
81c285 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
81c285 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
81c285 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|