Skip to content

Commit

Permalink
Add workaround for !121
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lyude committed Sep 13, 2024
1 parent b226dee commit 11300c0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ pub fn im_input(nvim: &NvimSession, input: &str) {
.chars()
.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");
nvim.block_timeout(nvim.input(&input)).ok_and_report();
}

pub fn gtk_key_press(
Expand All @@ -95,9 +93,7 @@ pub fn gtk_key_press(
) -> glib::Propagation {
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");
nvim.block_timeout(nvim.input(&input)).ok_and_report();
glib::Propagation::Stop
} else {
glib::Propagation::Proceed
Expand Down

0 comments on commit 11300c0

Please sign in to comment.