diff options
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | test/functional/eval/timer_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/terminal/window_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 33 |
4 files changed, 43 insertions, 9 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index abdf411fc3..b3ac456979 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4135,7 +4135,7 @@ skip: buf_T *preview_buf = NULL; size_t subsize = preview_lines.subresults.size; if (preview && !aborting()) { - if (got_quit) { // Substitution is too slow, disable 'inccommand'. + if (got_quit || profile_passed_limit(timeout)) { // Too slow, disable. set_string_option_direct((char_u *)"icm", -1, (char_u *)"", OPT_FREE, SID_NONE); } else if (*p_icm != NUL && pat != NULL) { diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua index ce0e24d8d7..14f3c29fb7 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/eval/timer_spec.lua @@ -145,8 +145,9 @@ describe('timers', function() local count2 = eval("g:val") -- when count is eval:ed after timer_stop this should be non-racy eq(count, count2) - assert(3 <= count and count <= 7, - 'expected (3 <= count <= 7), got: '..tostring(count)) + assert((3 <= count and count <= load_adjust(7)), + string.format('expected (3 <= count <= %s), got: %s', + load_adjust(7), tostring(count))) end) it('can be stopped from the handler', function() diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index c220b0c5a4..4f62c75433 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -1,5 +1,6 @@ local helpers = require('test.functional.helpers')(after_each) local thelpers = require('test.functional.terminal.helpers') +local feed_data = thelpers.feed_data local feed, clear = helpers.feed, helpers.clear local wait = helpers.wait local iswin = helpers.iswin @@ -19,11 +20,10 @@ describe(':terminal window', function() it('sets topline correctly #8556', function() -- Test has hardcoded assumptions of dimensions. eq(7, eval('&lines')) - command('set shell=sh') - command('terminal') - retry(nil, nil, function() assert(nil ~= eval('b:terminal_job_pid')) end) + feed_data('\n\n\n') -- Add blank lines. -- Terminal/shell contents must exceed the height of this window. command('topleft 1split') + eq('terminal', eval('&buftype')) feed([[i<cr>]]) -- Check topline _while_ in terminal-mode. retry(nil, nil, function() eq(6, eval('winsaveview()["topline"]')) end) @@ -42,7 +42,7 @@ describe(':terminal window', function() {7:6 } | {3:-- TERMINAL --} | ]]) - thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) + feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ {7:1 }tty ready | {7:2 }rows: 6, cols: 48 | @@ -69,7 +69,7 @@ describe(':terminal window', function() {7: 6 } | {3:-- TERMINAL --} | ]]) - thelpers.feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) + feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ {7: 1 }tty ready | {7: 2 }rows: 6, cols: 48 | @@ -113,7 +113,7 @@ describe(':terminal window', function() describe('with fold set', function() before_each(function() feed([[<C-\><C-N>:set foldenable foldmethod=manual<CR>i]]) - thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''}) + feed_data({'line1', 'line2', 'line3', 'line4', ''}) screen:expect([[ tty ready | line1 | diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 3228d6b7fc..536264019c 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -1151,6 +1151,39 @@ describe(":substitute, inccommand=split", function() eq("split", eval("&inccommand")) end) + it("deactivates if 'foldexpr' is slow #9557", function() + insert([[ + a + a + a + a + a + a + a + a + ]]) + source([[ + function! Slowfold(lnum) + sleep 5m + return a:lnum % 3 + endfun + ]]) + command('set redrawtime=1 inccommand=split') + command('set foldmethod=expr foldexpr=Slowfold(v:lnum)') + feed(':%s/a/bcdef') + + -- Assert that 'inccommand' is DISABLED in cmdline mode. + retry(nil, nil, function() + eq('', eval('&inccommand')) + end) + + -- Assert that 'inccommand' is again ENABLED after leaving cmdline mode. + feed([[<C-\><C-N>]]) + retry(nil, nil, function() + eq('split', eval('&inccommand')) + end) + end) + it("clears preview if non-previewable command is edited #5585", function() -- Put a non-previewable command in history. feed_command("echo 'foo'") |