From c79bf4ec99951e42736522bd9362dfe347522c8e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 25 Aug 2016 10:34:47 -0400 Subject: ops.c: Rename start_global_changes(). --- src/nvim/ex_docmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_docmd.c') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 1e54f03ba0..ced5a3e931 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9513,7 +9513,7 @@ static void ex_folddo(exarg_T *eap) { linenr_T lnum; - start_global_changes(); + start_batch_changes(); /* First set the marks for all lines closed/open. */ for (lnum = eap->line1; lnum <= eap->line2; ++lnum) @@ -9524,7 +9524,7 @@ static void ex_folddo(exarg_T *eap) global_exe(eap->arg); ml_clearmarked(); /* clear rest of the marks */ - end_global_changes(); + end_batch_changes(); } static void ex_terminal(exarg_T *eap) -- cgit From c826ebd3de7f73d360a8032127ed9d9db0543d8a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 25 Aug 2016 10:43:00 -0400 Subject: 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 --- src/nvim/ex_docmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/nvim/ex_docmd.c') 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) -- cgit From 7a589e4a9e4a8dffc173bcb3a53286961032b2de Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 25 Aug 2016 20:36:59 -0400 Subject: lint --- src/nvim/ex_docmd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/nvim/ex_docmd.c') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 8e9829db73..2960a0569a 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -345,7 +345,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, msg_list = saved_msg_list; return FAIL; } - ++call_depth; + call_depth++; start_batch_changes(); cstack.cs_idx = -1; @@ -953,7 +953,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, did_endif = FALSE; /* in case do_cmdline used recursively */ - --call_depth; + call_depth--; end_batch_changes(); return retval; } @@ -9513,16 +9513,15 @@ static void ex_foldopen(exarg_T *eap) static void ex_folddo(exarg_T *eap) { - linenr_T lnum; - - /* 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)) + // First set the marks for all lines closed/open. + for (linenr_T lnum = eap->line1; lnum <= eap->line2; ++lnum) { + if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed)) { ml_setmarked(lnum); + } + } - /* Execute the command on the marked lines. */ - global_exe(eap->arg); - ml_clearmarked(); /* clear rest of the marks */ + global_exe(eap->arg); // Execute the command on the marked lines. + ml_clearmarked(); // clear rest of the marks } static void ex_terminal(exarg_T *eap) -- cgit