diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ops.c | 3 | ||||
-rw-r--r-- | src/nvim/os/shell.c | 8 | ||||
-rw-r--r-- | src/nvim/search.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 12 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
6 files changed, 26 insertions, 7 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index c5660f68fd..f9153a94a7 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1408,6 +1408,9 @@ int op_delete(oparg_T *oap) } if (oap->regname == 0) { + if (reg == NULL) { + abort(); + } set_clipboard(0, reg); do_autocmd_textyankpost(oap, reg); } diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 8767287cf3..9d80a43718 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -496,8 +496,12 @@ static void out_data_cb(Stream *stream, RBuffer *buf, size_t count, void *data, size_t cnt; char *ptr = rbuffer_read_ptr(buf, &cnt); - if (ptr != NULL && cnt > 0 - && out_data_decide_throttle(cnt)) { // Skip output above a threshold. + if (ptr == NULL || cnt == 0) { + // Nothing to read; + return; + } + + if (out_data_decide_throttle(cnt)) { // Skip output above a threshold. // Save the skipped output. If it is the final chunk, we display it later. out_data_ring(ptr, cnt); } else { diff --git a/src/nvim/search.c b/src/nvim/search.c index 61ef2e9ba3..1bf2317d2a 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1005,14 +1005,13 @@ int do_search( dircp = NULL; /* use previous pattern */ if (pat == NULL || *pat == NUL || *pat == dirc) { - if (spats[RE_SEARCH].pat == NULL) { /* no previous pattern */ - pat = spats[RE_SUBST].pat; - if (pat == NULL) { + if (spats[RE_SEARCH].pat == NULL) { // no previous pattern + searchstr = spats[RE_SUBST].pat; + if (searchstr == NULL) { EMSG(_(e_noprevre)); retval = 0; goto end_do_search; } - searchstr = pat; } else { /* make search_regcomp() use spats[RE_SEARCH].pat */ searchstr = (char_u *)""; diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 3482001f63..7e55fffa06 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -58,6 +58,7 @@ NEW_TESTS ?= \ test_nested_function.res \ test_normal.res \ test_quickfix.res \ + test_search.res \ test_signs.res \ test_smartindent.res \ test_stat.res \ diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim new file mode 100644 index 0000000000..e85525e663 --- /dev/null +++ b/src/nvim/testdir/test_search.vim @@ -0,0 +1,12 @@ +" Test for the search command + +func Test_use_sub_pat() + split + let @/ = '' + func X() + s/^/a/ + / + endfunc + call X() + bwipe! +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index c8300e786e..a28dbcf061 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -88,7 +88,7 @@ static const int included_patches[] = { 2359, // 2358 NA 2357, - // 2356, + 2356, 2355, // 2354, 2353, |