aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-04-05 21:23:27 +0200
committerGitHub <noreply@github.com>2022-04-05 21:23:27 +0200
commitf86f74c12ff53155818c25a50f6a2f27b8dfae49 (patch)
treeee7bf41f97e2b871c591b9be532eda760531f35f
parent402a71ff87baf6f68d9dae6f5faa2b49f2d9045f (diff)
parent54cec455ccdae2a63144809f947dad5cf510b7c7 (diff)
downloadrneovim-f86f74c12ff53155818c25a50f6a2f27b8dfae49.tar.gz
rneovim-f86f74c12ff53155818c25a50f6a2f27b8dfae49.tar.bz2
rneovim-f86f74c12ff53155818c25a50f6a2f27b8dfae49.zip
Merge pull request #18003 from bfredl/incperf2
fix(ui): inccomand performance degradation
-rw-r--r--src/nvim/ex_cmds.c24
-rw-r--r--test/functional/ui/cmdline_spec.lua3
2 files changed, 16 insertions, 11 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 65cb544efd..5d5b342c35 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4313,18 +4313,22 @@ skip:
#define PUSH_PREVIEW_LINES() \
do { \
- linenr_T match_lines = current_match.end.lnum \
- - current_match.start.lnum +1; \
- if (preview_lines.subresults.size > 0) { \
- linenr_T last = kv_last(preview_lines.subresults).end.lnum; \
- if (last == current_match.start.lnum) { \
- preview_lines.lines_needed += match_lines - 1; \
+ if (preview) { \
+ linenr_T match_lines = current_match.end.lnum \
+ - current_match.start.lnum +1; \
+ if (preview_lines.subresults.size > 0) { \
+ linenr_T last = kv_last(preview_lines.subresults).end.lnum; \
+ if (last == current_match.start.lnum) { \
+ preview_lines.lines_needed += match_lines - 1; \
+ } else { \
+ preview_lines.lines_needed += match_lines; \
+ } \
+ } else { \
+ preview_lines.lines_needed += match_lines; \
} \
- } else { \
- preview_lines.lines_needed += match_lines; \
+ kv_push(preview_lines.subresults, current_match); \
} \
- kv_push(preview_lines.subresults, current_match); \
- } while (0)
+ } while (0)
// Push the match to preview_lines.
PUSH_PREVIEW_LINES();
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index ad23402ff9..3b273fd229 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -4,6 +4,7 @@ local clear, feed = helpers.clear, helpers.feed
local source = helpers.source
local command = helpers.command
local assert_alive = helpers.assert_alive
+local uname = helpers.uname
local function new_screen(opt)
local screen = Screen.new(25, 5)
@@ -824,7 +825,7 @@ describe('cmdline redraw', function()
end)
it('with <Cmd>', function()
- if 'openbsd' == helpers.uname() then
+ if string.find(uname(), 'bsd') then
pending('FIXME #10804')
end
command('cmap a <Cmd>call sin(0)<CR>') -- no-op