patch 8.1.0278: 'incsearch' highlighting does not accept reverse range
Problem: 'incsearch' highlighting does not accept reverse range.
Solution: Swap the range when needed. (issue #3321)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index a1cea9b..22f35e1 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -320,8 +320,17 @@
parse_cmd_address(&ea, &dummy);
if (ea.addr_count > 0)
{
- search_first_line = ea.line1;
- search_last_line = ea.line2;
+ // Allow for reverse match.
+ if (ea.line2 < ea.line1)
+ {
+ search_first_line = ea.line2;
+ search_last_line = ea.line1;
+ }
+ else
+ {
+ search_first_line = ea.line1;
+ search_last_line = ea.line2;
+ }
}
else if (*cmd == 's')
{