diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-16 13:50:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-16 13:50:25 +0100 |
commit | f4a1d1c0542df151bc59ac3b798ed198b5c71ccc (patch) | |
tree | 9f6051c5c5e75c7f113a923f7888f0f272ddee9e /src/fileio.c | |
parent | ab85ca4e6a40b2998db7b00896505486f5c16b41 (diff) | |
download | vim-git-f4a1d1c0542df151bc59ac3b798ed198b5c71ccc.tar.gz |
patch 8.1.2302: :lockmarks does not work for '[ and ']v8.1.2302
Problem: :lockmarks does not work for '[ and '].
Solution: save and restore '[ and '] marks. (James McCoy, closes #5222)
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/fileio.c b/src/fileio.c index 0c2238be6..85c5e6827 100644 --- a/src/fileio.c +++ b/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 /* |