aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-01-06 13:35:01 +0100
committerGitHub <noreply@github.com>2023-01-06 13:35:01 +0100
commit0996430392eed424666c03b22b002542322d5d08 (patch)
treeead365cdef304a4a19c6f3518bf84894935c6e89
parent08ebf8d3a80c65b01d493ca84ad2ab7304a669f9 (diff)
parentb303ab9a7d5f695e53c3f261b000e0e748ed8654 (diff)
downloadrneovim-0996430392eed424666c03b22b002542322d5d08.tar.gz
rneovim-0996430392eed424666c03b22b002542322d5d08.tar.bz2
rneovim-0996430392eed424666c03b22b002542322d5d08.zip
Merge pull request #21666 from bfredl/padbell
fix(tui): do not invoke loop recursively for pad()
-rw-r--r--src/nvim/tui/tui.c2
-rw-r--r--test/functional/terminal/tui_spec.lua27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 162f54b6c1..44f6718039 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1626,7 +1626,7 @@ static void pad(void *ctx, size_t delay, int scale FUNC_ATTR_UNUSED, int force)
}
flush_buf(tui);
- loop_uv_run(tui->loop, (int64_t)(delay / 10), false);
+ uv_sleep((unsigned int)(delay/10));
}
static void unibi_set_if_empty(unibi_term *ut, enum unibi_string str, const char *val)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index e31f76a444..d071c2f091 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -1469,6 +1469,33 @@ describe('TUI', function()
|
{3:-- TERMINAL --} |]]))
end)
+
+ it('visual bell (padding) does not crash #21610', function()
+ feed_data ':set visualbell\n'
+ screen:expect{grid=[[
+ {1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] }|
+ :set visualbell |
+ {3:-- TERMINAL --} |
+ ]]}
+
+ -- move left is enough to invoke the bell
+ feed_data 'h'
+ -- visual change to show we process events after this
+ feed_data 'i'
+ screen:expect{grid=[[
+ {1: } |
+ {4:~ }|
+ {4:~ }|
+ {4:~ }|
+ {5:[No Name] }|
+ {3:-- INSERT --} |
+ {3:-- TERMINAL --} |
+ ]]}
+ end)
end)
describe('TUI', function()