aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-01-11 14:53:09 -0500
committerJames McCoy <jamessan@jamessan.com>2017-01-11 21:05:02 -0500
commitf2dff864934eeb4eaefee577fbdcc5e4969c3864 (patch)
tree9e8890cb34ea5178900a37df8a61fbc2711c0f73 /src
parentdcd77c64ef7865f47b9a6e86da033da8aaa3100c (diff)
downloadrneovim-f2dff864934eeb4eaefee577fbdcc5e4969c3864.tar.gz
rneovim-f2dff864934eeb4eaefee577fbdcc5e4969c3864.tar.bz2
rneovim-f2dff864934eeb4eaefee577fbdcc5e4969c3864.zip
inccommand: Preview :sub commands only after the delimiter is present
Closes #5888
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index eccece7ac7..19691ccc3a 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -9674,9 +9674,20 @@ bool cmd_can_preview(char_u *cmd)
if (*ea.cmd == '*') {
ea.cmd = skipwhite(ea.cmd + 1);
}
- find_command(&ea, NULL);
+ char_u *end = find_command(&ea, NULL);
- return ea.cmdidx == CMD_substitute
- || ea.cmdidx == CMD_smagic
- || ea.cmdidx == CMD_snomagic;
+ switch (ea.cmdidx) {
+ case CMD_substitute:
+ case CMD_smagic:
+ case CMD_snomagic:
+ // Only preview once the pattern delimiter has been typed
+ if (*end && !ASCII_ISALNUM(*end)) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return false;
}