diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-21 09:59:14 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-21 12:50:30 -0400 |
commit | bf61885cb45fcced4f5886f336460be4af8a8ba8 (patch) | |
tree | 2852806953323960e6bc74ce50203af6b9a8dff0 /src/nvim/search.c | |
parent | 7ae7da8fb9ab2e23ffc19000798ae27a2dee4e87 (diff) | |
download | rneovim-bf61885cb45fcced4f5886f336460be4af8a8ba8.tar.gz rneovim-bf61885cb45fcced4f5886f336460be4af8a8ba8.tar.bz2 rneovim-bf61885cb45fcced4f5886f336460be4af8a8ba8.zip |
vim-patch:8.0.0621: :stag does not respect 'switchbuf'
Problem: The ":stag" command does not respect 'switchbuf'.
Solution: Check 'switchbuf' for tag commands that may open a new window.
(Ingo Karkat, closes vim/vim#1681) Define macros for the return values
of getfile().
https://github.com/vim/vim/commit/8ad80dea089ffeb1a845199c013e9bb4be1cd22e
Diffstat (limited to 'src/nvim/search.c')
-rw-r--r-- | src/nvim/search.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 6c974850ac..27f4389683 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1288,9 +1288,9 @@ end_do_search: * search_for_exact_line(buf, pos, dir, pat) * * Search for a line starting with the given pattern (ignoring leading - * white-space), starting from pos and going in direction dir. pos will + * white-space), starting from pos and going in direction "dir". "pos" will * contain the position of the match found. Blank lines match only if - * ADDING is set. if p_ic is set then the pattern must be in lowercase. + * ADDING is set. If p_ic is set then the pattern must be in lowercase. * Return OK for success, or FAIL if no line found. */ int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat) @@ -4595,20 +4595,23 @@ search_line: RESET_BINDING(curwin); } if (depth == -1) { - /* match in current file */ + // match in current file if (l_g_do_tagpreview != 0) { - if (getfile(0, curwin_save->w_buffer->b_fname, - NULL, TRUE, lnum, FALSE) > 0) - break; /* failed to jump to file */ - } else + if (!GETFILE_SUCCESS(getfile(0, curwin_save->w_buffer->b_fname, + NULL, true, lnum, false))) { + break; // failed to jump to file + } + } else { setpcmark(); + } curwin->w_cursor.lnum = lnum; } else { - if (getfile(0, files[depth].name, NULL, TRUE, - files[depth].lnum, FALSE) > 0) - break; /* failed to jump to file */ - /* autocommands may have changed the lnum, we don't - * want that here */ + if (!GETFILE_SUCCESS(getfile(0, files[depth].name, NULL, true, + files[depth].lnum, false))) { + break; // failed to jump to file + } + // autocommands may have changed the lnum, we don't + // want that here curwin->w_cursor.lnum = files[depth].lnum; } } |