diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-12-23 07:16:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-23 07:16:21 +0100 |
commit | 2ef72437fc2e20ed7eee2520d818d3039b8e52bb (patch) | |
tree | 74ce9d579586d56f8a4fe538cae4f235595c840d /src | |
parent | 2e280dac7df504b0681043647c8cc02abcbcc686 (diff) | |
parent | a16de288c3d3e033ab0cd60fec2a2d2042774685 (diff) | |
download | rneovim-2ef72437fc2e20ed7eee2520d818d3039b8e52bb.tar.gz rneovim-2ef72437fc2e20ed7eee2520d818d3039b8e52bb.tar.bz2 rneovim-2ef72437fc2e20ed7eee2520d818d3039b8e52bb.zip |
Merge #11594 from janlazo/vim-8.0.1767
vim-patch:8.0.1767,8.2.0030
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/charset.c | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 19 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 11 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 8 | ||||
-rw-r--r-- | src/nvim/getchar.c | 2 | ||||
-rw-r--r-- | src/nvim/globals.h | 2 | ||||
-rw-r--r-- | src/nvim/spellfile.c | 12 | ||||
-rw-r--r-- | src/nvim/tag.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_gf.vim | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 31 | ||||
-rw-r--r-- | src/nvim/window.c | 12 |
11 files changed, 71 insertions, 38 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 78e7861d9d..e9140f8ec5 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1087,8 +1087,6 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he } if (col == 0 || (col + size + sbrlen > (colnr_T)wp->w_width_inner)) { - added = 0; - if (*p_sbr != NUL) { if (size + sbrlen + numberwidth > (colnr_T)wp->w_width_inner) { // Calculate effective window width. diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 04899f2c99..8749c7d8f0 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6626,8 +6626,6 @@ call_func( error = ERROR_NONE; executor_call_lua((const char *)funcname, len, argvars, argcount, rettv); - } else { - error = ERROR_UNKNOWN; } } else if (!builtin_function((const char *)rfname, -1)) { // User defined function. @@ -11797,7 +11795,6 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr) break; case kCdScopeGlobal: // The global scope never has a local directory - rettv->vval.v_number = 0; break; case kCdScopeInvalid: // We should never get here @@ -11909,16 +11906,12 @@ static void f_histget(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_histnr(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - int i; - const char *const history = tv_get_string_chk(&argvars[0]); - - i = history == NULL ? HIST_CMD - 1 : get_histtype(history, strlen(history), - false); + HistoryType i = history == NULL + ? HIST_INVALID + : get_histtype(history, strlen(history), false); if (i != HIST_INVALID) { i = get_history_idx(i); - } else { - i = -1; } rettv->vval.v_number = i; } @@ -17736,9 +17729,7 @@ static void f_strridx(typval_T *argvars, typval_T *rettv, FunPtr fptr) } } - if (lastmatch == NULL) { - rettv->vval.v_number = -1; - } else { + if (lastmatch != NULL) { rettv->vval.v_number = (varnumber_T)(lastmatch - haystack); } } @@ -24076,7 +24067,7 @@ void option_last_set_msg(LastSet last_set) MSG_PUTS(_("\n\tLast set from ")); MSG_PUTS(p); if (last_set.script_ctx.sc_lnum > 0) { - MSG_PUTS(_(" line ")); + MSG_PUTS(_(line_msg)); msg_outnum((long)last_set.script_ctx.sc_lnum); } if (should_free) { diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 72ee45a03a..728e3a7fa3 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2732,16 +2732,7 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error) return n; } case VAR_SPECIAL: { - switch (tv->vval.v_special) { - case kSpecialVarTrue: { - return 1; - } - case kSpecialVarFalse: - case kSpecialVarNull: { - return 0; - } - } - break; + return tv->vval.v_special == kSpecialVarTrue ? 1 : 0; } case VAR_UNKNOWN: { emsgf(_(e_intern2), "tv_get_number(UNKNOWN)"); diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 8065d764b9..35159060b8 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -161,6 +161,8 @@ typedef struct command_line_state { int init_topfill; linenr_T old_botline; linenr_T init_botline; + int old_empty_rows; + int init_empty_rows; pos_T match_start; pos_T match_end; int did_incsearch; @@ -253,6 +255,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) s->init_topline = curwin->w_topline; s->init_topfill = curwin->w_topfill; s->init_botline = curwin->w_botline; + s->init_empty_rows = curwin->w_empty_rows; if (s->firstc == -1) { s->firstc = NUL; @@ -275,6 +278,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) s->old_topline = curwin->w_topline; s->old_topfill = curwin->w_topfill; s->old_botline = curwin->w_botline; + s->old_empty_rows = curwin->w_empty_rows; assert(indent >= 0); @@ -449,6 +453,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent) curwin->w_topline = s->old_topline; curwin->w_topfill = s->old_topfill; curwin->w_botline = s->old_botline; + curwin->w_empty_rows = s->old_empty_rows; highlight_match = false; validate_cursor(); // needed for TAB redraw_all_later(SOME_VALID); @@ -1118,6 +1123,7 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match) s->old_topline = curwin->w_topline; s->old_topfill = curwin->w_topfill; s->old_botline = curwin->w_botline; + s->old_empty_rows = curwin->w_empty_rows; update_screen(NOT_VALID); redrawcmdline(); } else { @@ -1243,6 +1249,7 @@ static int command_line_handle_key(CommandLineState *s) s->old_topline = s->init_topline; s->old_topfill = s->init_topfill; s->old_botline = s->init_botline; + s->old_empty_rows = s->init_empty_rows; } redrawcmd(); } else if (ccline.cmdlen == 0 && s->c != Ctrl_W @@ -1876,6 +1883,7 @@ static int command_line_changed(CommandLineState *s) curwin->w_topline = s->old_topline; curwin->w_topfill = s->old_topfill; curwin->w_botline = s->old_botline; + curwin->w_empty_rows = s->old_empty_rows; changed_cline_bef_curs(); update_topline(); diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index c038977127..f582670141 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3106,7 +3106,7 @@ int do_map(int maptype, char_u *arg, int mode, bool is_abbrev) case 0: break; case 1: - result = 1; // invalid arguments + // invalid arguments goto free_and_return; default: assert(false && "Unknown return code from str_to_mapargs!"); diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 0a7a2d551e..c6ab574a0f 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -1059,6 +1059,8 @@ EXTERN char_u e_floatexchange[] INIT(=N_( EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM")); EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP")); +EXTERN char line_msg[] INIT(= N_(" line ")); + // For undo we need to know the lowest time possible. EXTERN time_t starttime; diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 4fac001bc5..8e4f405d99 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1238,17 +1238,14 @@ static int read_sal_section(FILE *fd, slang_T *slang) p = xmalloc(1); p[0] = NUL; smp->sm_lead = p; + smp->sm_lead_w = mb_str2wide(smp->sm_lead); smp->sm_leadlen = 0; smp->sm_oneof = NULL; + smp->sm_oneof_w = NULL; smp->sm_rules = p; smp->sm_to = NULL; - if (has_mbyte) { - smp->sm_lead_w = mb_str2wide(smp->sm_lead); - smp->sm_leadlen = 0; - smp->sm_oneof_w = NULL; - smp->sm_to_w = NULL; - } - ++gap->ga_len; + smp->sm_to_w = NULL; + gap->ga_len++; } // Fill the first-index table. @@ -1713,7 +1710,6 @@ read_tree_node ( if (c == BY_NOFLAGS && !prefixtree) { // No flags, all regions. idxs[idx] = 0; - c = 0; } else if (c != BY_INDEX) { if (prefixtree) { // Read the optional pflags byte, the prefix ID and the diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 3629b37c32..a412ed0276 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2537,8 +2537,6 @@ parse_match( tagp->command_end = p; if (p > tagp->command && p[-1] == '|') { tagp->command_end = p - 1; // drop trailing bar - } else { - tagp->command_end = p; } p += 2; // skip ";\"" if (*p++ == TAB) { diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index d301874891..4a4ffcefa1 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -58,6 +58,14 @@ func Test_gF() call assert_equal('Xfile', bufname('%')) call assert_equal(3, getcurpos()[1]) + enew! + call setline(1, ['one', 'the Xfile line 2, and more', 'three']) + w! Xfile2 + normal 2GfX + normal gF + call assert_equal('Xfile', bufname('%')) + call assert_equal(2, getcurpos()[1]) + set isfname& call delete('Xfile') call delete('Xfile2') diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 68eb311e3c..5d99027ca5 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -1,6 +1,7 @@ " Test for the search command source shared.vim +source screendump.vim func Test_search_cmdline() " See test/functional/legacy/search_spec.lua @@ -549,6 +550,36 @@ func Test_incsearch_with_change() call delete('Xis_change_script') endfunc +func Test_incsearch_scrolling() + if !CanRunVimInTerminal() + return + endif + call assert_equal(0, &scrolloff) + call writefile([ + \ 'let dots = repeat(".", 120)', + \ 'set incsearch cmdheight=2 scrolloff=0', + \ 'call setline(1, [dots, dots, dots, "", "target", dots, dots])', + \ 'normal gg', + \ 'redraw', + \ ], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 9, 'cols': 70}) + " Need to send one key at a time to force a redraw + call term_sendkeys(buf, '/') + sleep 100m + call term_sendkeys(buf, 't') + sleep 100m + call term_sendkeys(buf, 'a') + sleep 100m + call term_sendkeys(buf, 'r') + sleep 100m + call term_sendkeys(buf, 'g') + call VerifyScreenDump(buf, 'Test_incsearch_scrolling_01', {}) + + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('Xscript') +endfunc + func Test_search_undefined_behaviour() if !has("terminal") return diff --git a/src/nvim/window.c b/src/nvim/window.c index 76fc36607c..af78c89618 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6020,10 +6020,20 @@ file_name_in_line ( if (file_lnum != NULL) { char_u *p; + const char *line_english = " line "; + const char *line_transl = _(line_msg); // Get the number after the file name and a separator character. + // Also accept " line 999" with and without the same translation as + // used in last_set_msg(). p = ptr + len; - p = skipwhite(p); + if (STRNCMP(p, line_english, STRLEN(line_english)) == 0) { + p += STRLEN(line_english); + } else if (STRNCMP(p, line_transl, STRLEN(line_transl)) == 0) { + p += STRLEN(line_transl); + } else { + p = skipwhite(p); + } if (*p != NUL) { if (!isdigit(*p)) { p++; // skip the separator |