diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-12-22 18:45:17 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-12-22 19:43:18 -0500 |
commit | 80ebfc304e295cdb1bed3d0f2781d7884933719a (patch) | |
tree | 32158dcff76a1b976223c9cb387b52fc68599ba6 | |
parent | bc8da6cdbe4e300344e45dbc2eb5b22a7afc9e89 (diff) | |
download | rneovim-80ebfc304e295cdb1bed3d0f2781d7884933719a.tar.gz rneovim-80ebfc304e295cdb1bed3d0f2781d7884933719a.tar.bz2 rneovim-80ebfc304e295cdb1bed3d0f2781d7884933719a.zip |
vim-patch:8.2.0030: "gF" does not work on output of "verbose command"
Problem: "gF" does not work on output of "verbose command".
Solution: Recognize " line " and translations. (closes vim/vim#5391)
https://github.com/vim/vim/commit/64e74c9cc7d5aab215cf72d9bdd3aac32e128191
-rw-r--r-- | src/nvim/eval.c | 2 | ||||
-rw-r--r-- | src/nvim/eval/typval.c | 11 | ||||
-rw-r--r-- | src/nvim/globals.h | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_gf.vim | 8 | ||||
-rw-r--r-- | src/nvim/window.c | 12 |
5 files changed, 23 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 04899f2c99..70fea1c4a9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -24076,7 +24076,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/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/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/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 |