aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-17 10:40:48 +0200
committerGitHub <noreply@github.com>2018-09-17 10:40:48 +0200
commit398b9fde8548a2a754883691f7026c5104cdae1d (patch)
tree1769754d36530429841f6d1010a1617b8977794e /src/nvim/ex_docmd.c
parent9f1401e25cfcd3db1ccb4471599e13c5e5c3e5d8 (diff)
parenta0ada7dac496de46aff416505d536c78fea80524 (diff)
downloadrneovim-398b9fde8548a2a754883691f7026c5104cdae1d.tar.gz
rneovim-398b9fde8548a2a754883691f7026c5104cdae1d.tar.bz2
rneovim-398b9fde8548a2a754883691f7026c5104cdae1d.zip
Merge #9008 from janlazo/vim-8.0.1416
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ac5de0733b..e4ab690bb9 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3664,17 +3664,18 @@ static linenr_T get_address(exarg_T *eap,
*/
if (lnum != MAXLNUM)
curwin->w_cursor.lnum = lnum;
- /*
- * Start a forward search at the end of the line.
- * Start a backward search at the start of the line.
- * This makes sure we never match in the current
- * line, and can match anywhere in the
- * next/previous line.
- */
- if (c == '/')
+
+ // Start a forward search at the end of the line (unless
+ // before the first line).
+ // Start a backward search at the start of the line.
+ // This makes sure we never match in the current
+ // line, and can match anywhere in the
+ // next/previous line.
+ if (c == '/' && curwin->w_cursor.lnum > 0) {
curwin->w_cursor.col = MAXCOL;
- else
+ } else {
curwin->w_cursor.col = 0;
+ }
searchcmdlen = 0;
if (!do_search(NULL, c, cmd, 1L,
SEARCH_HIS | SEARCH_MSG, NULL)) {