Do not pass newline to Action::Insert

This commit is contained in:
Jeremy Soller 2023-10-20 13:12:26 -06:00
parent 62df7291ad
commit b59710ddc4
No known key found for this signature in database
GPG key ID: DCFCA852D3906975

View file

@ -243,7 +243,7 @@ where
let image_w = (view_w as f64 * scale_factor) as i32; let image_w = (view_w as f64 * scale_factor) as i32;
let image_h = (view_h as f64 * scale_factor) as i32; let image_h = (view_h as f64 * scale_factor) as i32;
if image_w <= 0 || image_h <= 0 { if image_w <= 0 || image_h <= 0 {
// Zero sized image // Zero sized image
return; return;
@ -383,7 +383,12 @@ where
_ => (), _ => (),
}, },
Event::Keyboard(KeyEvent::CharacterReceived(character)) => { Event::Keyboard(KeyEvent::CharacterReceived(character)) => {
editor.action(Action::Insert(character)); match character {
'\n' | '\r' => {}
_ => {
editor.action(Action::Insert(character));
}
}
status = Status::Captured; status = Status::Captured;
} }
Event::Mouse(MouseEvent::ButtonPressed(Button::Left)) => { Event::Mouse(MouseEvent::ButtonPressed(Button::Left)) => {