Alt+Backspace and Ctrl+Backspace shouldn't insert characters anymore when they aren't assigned as shortcuts

This commit is contained in:
Marcel Schramm 2020-11-18 19:55:38 +01:00
parent e839f4bc23
commit d45ceb32ab
No known key found for this signature in database
GPG Key ID: 05971054C70EEDC7
1 changed files with 6 additions and 1 deletions

View File

@ -467,7 +467,12 @@ func NewEditor() *Editor {
} else if shortcuts.InputNewLine.Equals(event) {
editor.InsertCharacter('\n')
} else if event.Rune() != 0 {
editor.InsertCharacter(event.Rune())
//Workaround, since Alt+Backspace and Ctrl+Backspace will insert
//invalid characters if they aren't used as shortcuts anywhere.
if event.Key() == tcell.KeyRune ||
(event.Key() != tcell.KeyBackspace2 && event.Key() != tcell.KeyBackspace) {
editor.InsertCharacter(event.Rune())
}
}
editor.TriggerHeightRequestIfNecessary()