1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-03 14:26:17 +03:00

handle Key::Char('\n' | '\r') as Key::Enter

Этот коммит содержится в:
rhysd
2022-06-17 12:52:13 +09:00
родитель f166eb794f
Коммит 30bd068b34

Просмотреть файл

@@ -174,6 +174,22 @@ impl<'a> TextArea<'a> {
pub fn input(&mut self, input: impl Into<Input>) -> bool {
let input = input.into();
let modified = match input {
Input {
key: Key::Char('m'),
ctrl: true,
alt: false,
}
| Input {
key: Key::Char('\n' | '\r'),
ctrl: false,
alt: false,
}
| Input {
key: Key::Enter, ..
} => {
self.insert_newline();
true
}
Input {
key: Key::Char(c),
ctrl: false,
@@ -207,17 +223,6 @@ impl<'a> TextArea<'a> {
ctrl: false,
alt: false,
} => self.delete_next_char(),
Input {
key: Key::Char('m'),
ctrl: true,
alt: false,
}
| Input {
key: Key::Enter, ..
} => {
self.insert_newline();
true
}
Input {
key: Key::Char('k'),
ctrl: true,