patch 8.2.0648: semicolon search does not work in first line
Problem: Semicolon search does not work in first line.
Solution: Allow the cursor to be in line zero. (Christian Brabandt,
closes #5996)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 43cd013..ca69c29 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3069,8 +3069,10 @@
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 != ',')