-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui_attach: ill-formed redraw event with Neovide and noice.nvim #22344
Comments
:messages
if vim.ui_attach enables ext_tabline and ext_messages in different namespaces
#21265
It might be also weird that Neovide receives that “msg_show” although Neovide does not subscribe “ext_messages”. |
I did some research on this and found that in Bad args vs good args:
Here's a diff I used: diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 45959b7b6..77501ad46 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -656,10 +656,39 @@ void ui_grid_resize(handle_T grid_handle, int width, int height, Error *err)
}
}
+static void dump_array(Array args, int depth) {
+ char buf[128] = {};
+ for (int i = 0; i < depth; i++) {
+ strcat(buf, " ");
+ }
+ if (args.size == 0) {
+ printf("%s empty array\n", buf);
+ return;
+ }
+ for(size_t i = 0; i < args.size; i++) {
+ printf("%s arr[%d]: %d\n", buf, i, args.items[i].type);
+ if (args.items[i].type == kObjectTypeString) {
+ printf("%s str: %s\n", buf, args.items[i].data.string);
+ }
+ if (args.items[i].type == kObjectTypeArray) {
+ dump_array(args.items[i].data.array, depth + 1);
+ }
+ }
+}
+
void ui_call_event(char *name, Array args)
{
UIEventCallback *event_cb;
bool handled = false;
+
+ printf("ui_call_event start: %s\n", name);
+
+ if (strcmp("msg_show", name) == 0) {
+ dump_array(args, 0);
+ }
+
+ Array orig_args = copy_array(args, NULL);
+
map_foreach_value(&ui_event_cbs, event_cb, {
Error err = ERROR_INIT;
Object res = nlua_call_ref(event_cb->cb, name, args, false, &err);
@@ -672,8 +701,14 @@ void ui_call_event(char *name, Array args)
api_clear_error(&err);
})
+ printf("ui_call_event end: %s\n", name);
+
+ if (strcmp("msg_show", name) == 0) {
+ dump_array(args, 0);
+ dump_array(orig_args, 0);
+ }
if (!handled) {
- UI_CALL(true, event, ui, name, args);
+ UI_CALL(true, event, ui, name, orig_args);
}
ui_log(name); |
It seems like what happens is: 1. |
I made a dirty hack which works around the problem for me. Not sure if it would make sense to make a PR, but if anyone is looking for a solution here, it may (or may not) work. |
This is the culprit. we need to make this strictly verboten and fix the use cases that use that some other way. |
It seems that from the I'm further doing some tests, but it seems I can make it work so Neovide no longer crahses, even with |
@folke on the latest noice version, with
did i mess smth up or is that expected with |
Describe the bug
Related to folke/noice.nvim#17, neovide/neovide#1751, and maybe #21265
Neovide version (patched for debugging): ryo33/neovide@db6ba6d
Noice.nvim version: folke/noice.nvim@d8a1f30
nvim-notify version: rcarriga/nvim-notify@bdd647f
nui.nvim version: MunifTanjim/nui.nvim@d147222
Abstract
Using Neovide GUI with noice.nvim suddenly crashes occasionally. I've found that, in most cases, it's caused by Neovim emitting an Ill-formed redraw event and subsequent rpc messages are broken (see Appendix 2.) Some people report the sudden crash in the same case, and one reported the almost same backtrace as mine.
The event from
neovide_backtrace.log
with printing in ron format at:(File: src/bridge/handler.rs; Line: 77, Column: 25)
The situation
ui_attach
withext_linegrid
andrgb
.ui_attach
withext_messages
,ext_cmdline
, andext_popupmenu
.Appendix 1.
Starting Neovim with
nvim -u NONE
and running the following lua code without--
in front ofprint("hello")
crashes neovim silently. This might be related to this issue. If someone tells me that this is an unexpected behavior, I'll open another issue.Edited: I noticed there is #21265
Appendix 2.
To ensure that the MessagePack and RPC implementation Neovide uses isn't doing wrong, I write the following Python script:
It prints:
Click me
Steps to reproduce
neovide -- -u NONE
:packadd nvim-notify
:packadd nui.nvim
:packadd noice.nvim
:lua require("noice").setup {}
" 1. input several lines
" 2. type 'd2k' in normal mode
" repeat 1 and 2 a few times
Expected behavior
Neovim emits a well-formed redraw event.
Neovim version (nvim -v)
NVIM v0.9.0-dev-1004+gbfe6b4944-dirty
Vim (not Nvim) behaves the same?
no
Operating system/version
Ubuntu 22.04.1 LTS
Terminal name/version
GNOME Terminal Version 3.44.0 for GNOME 42
$TERM environment variable
xterm-256color
Installation
homebrew (linuxbrew)
The text was updated successfully, but these errors were encountered: