Skip to content

Commit

Permalink
use_editable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Aug 9, 2023
1 parent ea1bf4a commit 6a9a512
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions hooks/src/text_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,17 @@ pub trait TextEditor: Sized + Clone + Display {
event = TextEvent::TextChanged
}
_ => {
// Adds a new character
let char_idx = self.line_to_char(self.cursor_row()) + self.cursor_col();
self.insert(character, char_idx);
self.cursor_right();

event = TextEvent::TextChanged
if let Ok(ch) = character.parse::<char>() {
if ch.is_ascii_alphanumeric() {
// Adds a new character
let char_idx =
self.line_to_char(self.cursor_row()) + self.cursor_col();
self.insert(character, char_idx);
self.cursor_right();

event = TextEvent::TextChanged
}
}
}
}
}
Expand Down

0 comments on commit 6a9a512

Please sign in to comment.