feat: added alt backspace keybinding (#132)

Co-authored-by: Renzix <DanielDeBruno@renzix.com>
pull/133/head
Renzix 2022-03-29 22:15:23 -04:00 committed by GitHub
parent 52caedc1f1
commit 0ebd8d9035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 13 deletions

View File

@ -39,19 +39,20 @@ const (
// Escape sequences
var (
seqUp = string([]byte{27, 91, 65})
seqDown = string([]byte{27, 91, 66})
seqForwards = string([]byte{27, 91, 67})
seqBackwards = string([]byte{27, 91, 68})
seqHome = string([]byte{27, 91, 72})
seqHomeSc = string([]byte{27, 91, 49, 126})
seqEnd = string([]byte{27, 91, 70})
seqEndSc = string([]byte{27, 91, 52, 126})
seqDelete = string([]byte{27, 91, 51, 126})
seqDelete2 = string([]byte{27, 91, 80})
seqShiftTab = string([]byte{27, 91, 90})
seqAltQuote = string([]byte{27, 34}) // Added for showing registers ^["
seqAltR = string([]byte{27, 114}) // Used for alternative history
seqUp = string([]byte{27, 91, 65})
seqDown = string([]byte{27, 91, 66})
seqForwards = string([]byte{27, 91, 67})
seqBackwards = string([]byte{27, 91, 68})
seqHome = string([]byte{27, 91, 72})
seqHomeSc = string([]byte{27, 91, 49, 126})
seqEnd = string([]byte{27, 91, 70})
seqEndSc = string([]byte{27, 91, 52, 126})
seqDelete = string([]byte{27, 91, 51, 126})
seqDelete2 = string([]byte{27, 91, 80})
seqShiftTab = string([]byte{27, 91, 90})
seqAltQuote = string([]byte{27, 34}) // Added for showing registers ^["
seqAltR = string([]byte{27, 114}) // Used for alternative history
seqAltBackspace = string([]byte{27, 127})
)
const (

View File

@ -755,6 +755,19 @@ func (rl *Instance) escapeSeq(r []rune) {
rl.updateTabFind([]rune{})
rl.viUndoSkipAppend = true
case seqAltBackspace:
if rl.modeTabCompletion {
rl.resetVirtualComp(false)
}
// This is only available in Insert mode
if rl.modeViMode != VimInsert {
return
}
rl.saveToRegister(rl.viJumpB(tokeniseLine))
rl.viDeleteByAdjust(rl.viJumpB(tokeniseLine))
rl.updateHelpers()
default:
if rl.modeTabFind {
return