From 23c1c1b4786a0e830bc0318872f6851637bc91ef Mon Sep 17 00:00:00 2001 From: Lyude Paul Date: Fri, 13 Sep 2024 12:52:48 -0400 Subject: [PATCH] Add workaround for !121 Unfortunately, it's not entirely clear what's happening to me here quite yet. Basically - it seems that occasionally since neovim 0.10, we will randomly get a string as a return value from `nvim_input` rather than a i64 like we expect. I may have to dig into nvim's source code and figure out the problem here, but as a result this leads to random crashes as we do an assertion on `nvim_input` always succeeding. Just remove those assertions for the time being as a workaround until we figure out a better solution. --- src/input.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/input.rs b/src/input.rs index f6c69b28..20deb34d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -84,8 +84,7 @@ pub fn im_input(nvim: &NvimSession, input: &str) { .map(|ch| keyval_to_input_string(&ch.to_string(), gdk::ModifierType::empty())) .collect(); nvim.block_timeout(nvim.input(&input)) - .ok_and_report() - .expect("Failed to send input command to nvim"); + .ok_and_report(); } pub fn gtk_key_press( @@ -96,8 +95,7 @@ pub fn gtk_key_press( if let Some(input) = convert_key(keyval, modifiers) { debug!("nvim_input -> {}", input); nvim.block_timeout(nvim.input(&input)) - .ok_and_report() - .expect("Failed to send input command to nvim"); + .ok_and_report(); glib::Propagation::Stop } else { glib::Propagation::Proceed