aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-08-25 10:43:00 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-08-25 11:16:22 -0400
commitc826ebd3de7f73d360a8032127ed9d9db0543d8a (patch)
tree17e09b72d75127897be5eabeac5b69a18fb0298e /src/nvim/ex_docmd.c
parentc79bf4ec99951e42736522bd9362dfe347522c8e (diff)
downloadrneovim-c826ebd3de7f73d360a8032127ed9d9db0543d8a.tar.gz
rneovim-c826ebd3de7f73d360a8032127ed9d9db0543d8a.tar.bz2
rneovim-c826ebd3de7f73d360a8032127ed9d9db0543d8a.zip
perf: Disable clipboard in do_cmdline().
For any script--not just `:global` commands--there is no reason to update the system clipboard until the script is finished, so disable it during do_cmdline(). Before this change, 'clipboard=unnamedplus' causes scripted editing to be extremely slow (e.g. `:normal` in a while-loop). Closes #3534
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ced5a3e931..8e9829db73 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -346,6 +346,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
return FAIL;
}
++call_depth;
+ start_batch_changes();
cstack.cs_idx = -1;
cstack.cs_looplevel = 0;
@@ -953,6 +954,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
did_endif = FALSE; /* in case do_cmdline used recursively */
--call_depth;
+ end_batch_changes();
return retval;
}
@@ -9513,8 +9515,6 @@ static void ex_folddo(exarg_T *eap)
{
linenr_T lnum;
- start_batch_changes();
-
/* First set the marks for all lines closed/open. */
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed))
@@ -9523,8 +9523,6 @@ static void ex_folddo(exarg_T *eap)
/* Execute the command on the marked lines. */
global_exe(eap->arg);
ml_clearmarked(); /* clear rest of the marks */
-
- end_batch_changes();
}
static void ex_terminal(exarg_T *eap)