From 63ab994fba2f2e0878be734d20bf8d106ddab67c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 1 Nov 2019 22:26:06 -0400 Subject: vim-patch:8.1.2235: "C" with 'virtualedit' set does not include multi-byte char Problem: "C" with 'virtualedit' set does not include multi-byte char. Solution: Include the whole multi-byte char. (Nobuhiro Takasaki, closes vim/vim#5152) https://github.com/vim/vim/commit/77ccc00340ed2598f7aa09716217e878665964fa --- src/nvim/ops.c | 1 + src/nvim/testdir/test_virtualedit.vim | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 030782cbcc..fbbdfdcd82 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -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 */ diff --git a/src/nvim/testdir/test_virtualedit.vim b/src/nvim/testdir/test_virtualedit.vim index 67adede8d7..1e6b26a057 100644 --- a/src/nvim/testdir/test_virtualedit.vim +++ b/src/nvim/testdir/test_virtualedit.vim @@ -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 -- cgit From 4a5adae95084e2dbaea59f0cffb9087ec4a6415e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 2 Nov 2019 11:32:39 -0400 Subject: vim-patch:8.1.2236: ml_get error if pattern matches beyond last line Problem: Ml_get error if pattern matches beyond last line. Solution: Adjust position if needed. (Christian Brabandt, closes ) https://github.com/vim/vim/commit/bb26596242fa7db477e2cd706dd99f9a426b5f71 --- src/nvim/ex_cmds.c | 5 +++++ src/nvim/testdir/test_substitute.vim | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2e8bd79c81..04aa8f7ef6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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)); } diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index b29b678129..e209310a05 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -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 -- cgit From 6c5772f7daf0017b0a3cc9e67055b084f2779ad7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 2 Nov 2019 14:26:31 -0400 Subject: quickfix: fix pvs/v547 error --- src/nvim/quickfix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 4ca9ca2a3e..a9e0c22a76 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -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; } -- cgit From 1c43fb1d51cd76ccca142e73d72af56f6fb0461d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 2 Nov 2019 14:36:00 -0400 Subject: syntax: zero-init local structs Fix https://neovim.io/doc/reports/clang/report-ee5dbd.html#EndPath --- src/nvim/syntax.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index ac8ace9fff..bdbc09a87a 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -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); -- cgit