aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 3f7d616b8f..5bf6aa73c6 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2476,8 +2476,11 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg)
if (*eap->cmd == ';') {
if (!eap->skip) {
curwin->w_cursor.lnum = eap->line2;
- // don't leave the cursor on an illegal line or column
- check_cursor();
+ // Don't leave the cursor on an illegal line or column, but do
+ // accept zero as address, so 0;/PATTERN/ works correctly.
+ if (eap->line2 > 0) {
+ check_cursor();
+ }
}
} else if (*eap->cmd != ',') {
break;