aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorAufar Gilbran <aufargilbran@gmail.com>2020-08-19 00:49:38 +0800
committerAufar Gilbran <aufargilbran@gmail.com>2020-09-11 10:33:20 +0800
commitab7e101540435b7de221ded309b34f2f000105f4 (patch)
tree8c35f91b9aef70f6fde39711bc341bd1a23f662f /src/nvim/ex_getln.c
parentc0102c140cb6d0e2be37c583d34f8ecdf7228f3a (diff)
downloadrneovim-ab7e101540435b7de221ded309b34f2f000105f4.tar.gz
rneovim-ab7e101540435b7de221ded309b34f2f000105f4.tar.bz2
rneovim-ab7e101540435b7de221ded309b34f2f000105f4.zip
vim-patch:8.1.0291: 'incsearch' highlighting not used for :sort
Problem: 'incsearch' highlighting not used for :sort. Solution: Handle pattern in :sort command. https://github.com/vim/vim/commit/81f56536b1bc324eb173924a8cf4d7dbbf4f3fdb
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 37816e9ff3..95348de320 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -314,6 +314,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
&& (STRNCMP(cmd, "substitute", p - cmd) == 0
|| STRNCMP(cmd, "smagic", p - cmd) == 0
|| STRNCMP(cmd, "snomagic", MAX(p - cmd, 3)) == 0
+ || STRNCMP(cmd, "sort", p - cmd) == 0
|| STRNCMP(cmd, "global", p - cmd) == 0
|| STRNCMP(cmd, "vglobal", p - cmd) == 0)) {
if (*cmd == 's' && cmd[1] == 'm') {
@@ -330,6 +331,17 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
return false;
}
}
+
+ // For ":sort" skip over flags.
+ if (cmd[0] == 's' && cmd[1] == 'o') {
+ while (ASCII_ISALPHA(*(p = skipwhite(p)))) {
+ ++p;
+ }
+ if (*p == NUL) {
+ return false;
+ }
+ }
+
p = skipwhite(p);
delim = *p++;
end = skip_regexp(p, delim, p_magic, NULL);
@@ -352,7 +364,7 @@ static bool do_incsearch_highlighting(int firstc, incsearch_state_T *s,
search_first_line = ea.line1;
search_last_line = ea.line2;
}
- } else if (*cmd == 's') {
+ } else if (cmd[0] == 's' && cmd[1] != 'o') {
// :s defaults to the current line
search_first_line = curwin->w_cursor.lnum;
search_last_line = curwin->w_cursor.lnum;