Fix pasting multi-line strings
This commit is contained in:
parent
fe381e1146
commit
ade06efa01
2 changed files with 8 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ Procedure when bumping the version number:
|
|||
### Fixed
|
||||
- Crash when connecting to nonexistent rooms
|
||||
- Crash when connecting to rooms that require authentication
|
||||
- Pasting multi-line strings into the editor
|
||||
|
||||
## v0.2.1 - 2022-08-11
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,13 @@ pub fn handle_editor_event(
|
|||
|
||||
// Editing
|
||||
key!(Char ch) if char_filter(*ch) => editor.insert_char(terminal.frame(), *ch),
|
||||
key!(Paste str) if str.chars().all(char_filter) => editor.insert_str(terminal.frame(), str),
|
||||
key!(Paste str) if str.chars().all(char_filter) => {
|
||||
// It seems that when pasting, '\n' are converted into '\r' for some
|
||||
// reason. I don't really know why, or at what point this happens.
|
||||
// Vim converts any '\r' pasted via the terminal into '\n', so I
|
||||
// decided to mirror that behaviour.
|
||||
editor.insert_str(terminal.frame(), &str.replace('\r', "\n"))
|
||||
}
|
||||
key!(Ctrl + 'h') | key!(Backspace) => editor.backspace(terminal.frame()),
|
||||
key!(Ctrl + 'd') | key!(Delete) => editor.delete(),
|
||||
key!(Ctrl + 'l') => editor.clear(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue