зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-08 08:25:51 +03:00
handle Key::Char('\n' | '\r') as Key::Enter
Этот коммит содержится в:
@@ -174,6 +174,22 @@ impl<'a> TextArea<'a> {
|
|||||||
pub fn input(&mut self, input: impl Into<Input>) -> bool {
|
pub fn input(&mut self, input: impl Into<Input>) -> bool {
|
||||||
let input = input.into();
|
let input = input.into();
|
||||||
let modified = match input {
|
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 {
|
Input {
|
||||||
key: Key::Char(c),
|
key: Key::Char(c),
|
||||||
ctrl: false,
|
ctrl: false,
|
||||||
@@ -207,17 +223,6 @@ impl<'a> TextArea<'a> {
|
|||||||
ctrl: false,
|
ctrl: false,
|
||||||
alt: false,
|
alt: false,
|
||||||
} => self.delete_next_char(),
|
} => self.delete_next_char(),
|
||||||
Input {
|
|
||||||
key: Key::Char('m'),
|
|
||||||
ctrl: true,
|
|
||||||
alt: false,
|
|
||||||
}
|
|
||||||
| Input {
|
|
||||||
key: Key::Enter, ..
|
|
||||||
} => {
|
|
||||||
self.insert_newline();
|
|
||||||
true
|
|
||||||
}
|
|
||||||
Input {
|
Input {
|
||||||
key: Key::Char('k'),
|
key: Key::Char('k'),
|
||||||
ctrl: true,
|
ctrl: true,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user