aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/eval/typval.c11
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/testdir/test_gf.vim8
-rw-r--r--src/nvim/window.c12
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