Merge #11324 from janlazo/vim-8.1.2235

vim-patch:8.1.{2235,2236}
This commit is contained in:
Justin M. Keyes
2019-11-03 05:13:52 +09:00
committed by GitHub
6 changed files with 32 additions and 9 deletions

View File

@@ -3524,6 +3524,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
// Note: If not first match on a line, column can't be known here
current_match.start.lnum = sub_firstlnum;
// Match might be after the last line for "\n\zs" matching at
// the end of the last line.
if (lnum > curbuf->b_ml.ml_line_count) {
break;
}
if (sub_firstline == NULL) {
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
}

View File

@@ -1562,6 +1562,7 @@ int op_delete(oparg_T *oap)
oap->end = curwin->w_cursor;
curwin->w_cursor = oap->start;
}
mb_adjust_opend(oap);
}
if (oap->line_count == 1) { /* delete characters within one line */

View File

@@ -1693,9 +1693,7 @@ static int copy_loclist(const qf_list_T *from_qfl,
}
if (from_qfl->qf_ctx != NULL) {
to_qfl->qf_ctx = xcalloc(1, sizeof(*to_qfl->qf_ctx));
if (to_qfl->qf_ctx != NULL) {
tv_copy(from_qfl->qf_ctx, to_qfl->qf_ctx);
}
tv_copy(from_qfl->qf_ctx, to_qfl->qf_ctx);
} else {
to_qfl->qf_ctx = NULL;
}

View File

@@ -2460,11 +2460,8 @@ update_si_end(
int force /* when TRUE overrule a previous end */
)
{
lpos_T startpos;
lpos_T endpos;
lpos_T hl_endpos;
lpos_T end_endpos;
int end_idx;
/* return quickly for a keyword */
if (sip->si_idx < 0)
@@ -2480,9 +2477,12 @@ update_si_end(
* We need to find the end of the region. It may continue in the next
* line.
*/
end_idx = 0;
startpos.lnum = current_lnum;
startpos.col = startcol;
int end_idx = 0;
lpos_T startpos = {
.lnum = current_lnum,
.col = startcol,
};
lpos_T endpos = { 0 };
find_endpos(sip->si_idx, &startpos, &endpos, &hl_endpos,
&(sip->si_flags), &end_endpos, &end_idx, sip->si_extmatch);

View File

@@ -149,6 +149,7 @@ func Run_SubCmd_Tests(tests)
for t in a:tests
let start = line('.') + 1
let end = start + len(t[2]) - 1
" TODO: why is there a one second delay the first time we get here?
exe "normal o" . t[0]
call cursor(start, 1)
exe t[1]
@@ -717,3 +718,12 @@ one two
close!
endfunc
func Test_sub_beyond_end()
new
call setline(1, '#')
let @/ = '^#\n\zs'
s///e
call assert_equal('#', getline(1))
bwipe!
endfunc

View File

@@ -73,3 +73,12 @@ func Test_edit_CTRL_G()
bwipe!
set virtualedit=
endfunc
func Test_edit_change()
new
set virtualedit=all
call setline(1, "\t⒌")
normal Cx
call assert_equal('x', getline(1))
bwipe!
endfunc