forked from aniani/vim
patch 8.1.2302: :lockmarks does not work for '[ and ']
Problem: :lockmarks does not work for '[ and ']. Solution: save and restore '[ and '] marks. (James McCoy, closes #5222)
This commit is contained in:
24
src/fileio.c
24
src/fileio.c
@@ -188,6 +188,7 @@ readfile(
|
||||
wasn't possible */
|
||||
char_u conv_rest[CONV_RESTLEN];
|
||||
int conv_restlen = 0; /* nr of bytes in conv_rest[] */
|
||||
pos_T orig_start;
|
||||
buf_T *old_curbuf;
|
||||
char_u *old_b_ffname;
|
||||
char_u *old_b_fname;
|
||||
@@ -250,9 +251,7 @@ readfile(
|
||||
*/
|
||||
if (!filtering && !read_stdin && !read_buffer)
|
||||
{
|
||||
pos_T pos;
|
||||
|
||||
pos = curbuf->b_op_start;
|
||||
orig_start = curbuf->b_op_start;
|
||||
|
||||
/* Set '[ mark to the line above where the lines go (line 1 if zero). */
|
||||
curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
|
||||
@@ -276,7 +275,7 @@ readfile(
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
curbuf->b_op_start = pos;
|
||||
curbuf->b_op_start = orig_start;
|
||||
}
|
||||
|
||||
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
|
||||
@@ -617,6 +616,7 @@ readfile(
|
||||
/*
|
||||
* Set '[ mark to the line above where the lines go (line 1 if zero).
|
||||
*/
|
||||
orig_start = curbuf->b_op_start;
|
||||
curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
|
||||
curbuf->b_op_start.col = 0;
|
||||
|
||||
@@ -658,6 +658,7 @@ readfile(
|
||||
try_mac = (vim_strchr(p_ffs, 'm') != NULL);
|
||||
try_dos = (vim_strchr(p_ffs, 'd') != NULL);
|
||||
try_unix = (vim_strchr(p_ffs, 'x') != NULL);
|
||||
curbuf->b_op_start = orig_start;
|
||||
|
||||
if (msg_scrolled == n)
|
||||
msg_scroll = m;
|
||||
@@ -2471,13 +2472,14 @@ failed:
|
||||
check_cursor_lnum();
|
||||
beginline(BL_WHITE | BL_FIX); /* on first non-blank */
|
||||
|
||||
/*
|
||||
* Set '[ and '] marks to the newly read lines.
|
||||
*/
|
||||
curbuf->b_op_start.lnum = from + 1;
|
||||
curbuf->b_op_start.col = 0;
|
||||
curbuf->b_op_end.lnum = from + linecnt;
|
||||
curbuf->b_op_end.col = 0;
|
||||
if (!cmdmod.lockmarks)
|
||||
{
|
||||
// Set '[ and '] marks to the newly read lines.
|
||||
curbuf->b_op_start.lnum = from + 1;
|
||||
curbuf->b_op_start.col = 0;
|
||||
curbuf->b_op_end.lnum = from + linecnt;
|
||||
curbuf->b_op_end.col = 0;
|
||||
}
|
||||
|
||||
#ifdef MSWIN
|
||||
/*
|
||||
|
Reference in New Issue
Block a user