2
2
miroir de https://github.com/Hilbis/Hilbish synchronisé 2025-07-15 15:22:03 +00:00

feat: control k to delete the rest of the line (#128)

Co-authored-by: Renzix <DanielDeBruno@renzix.com>
Cette révision appartient à :
Renzix 2022-03-26 23:43:30 -04:00 révisé par GitHub
Parent 0aba60b5de
révision 61c9e12a4a
Signature inconnue de Gitea
ID de la clé GPG: 4AEE18F83AFDEB23
2 fichiers modifiés avec 16 ajouts et 0 suppressions

Voir le fichier

@ -176,3 +176,9 @@ func (rl *Instance) deleteToBeginning() {
rl.line = rl.line[rl.pos:] rl.line = rl.line[rl.pos:]
rl.pos = 0 rl.pos = 0
} }
func (rl *Instance) deleteToEnd() {
rl.resetVirtualComp(false)
// Keep everything before the cursor
rl.line = rl.line[:rl.pos]
}

Voir le fichier

@ -189,6 +189,16 @@ func (rl *Instance) Readline() (string, error) {
rl.resetHelpers() rl.resetHelpers()
rl.updateHelpers() rl.updateHelpers()
case charCtrlK:
if rl.modeTabCompletion {
rl.resetVirtualComp(true)
}
// Delete everything after the cursor position
rl.saveBufToRegister(rl.line[rl.pos:])
rl.deleteToEnd()
rl.resetHelpers()
rl.updateHelpers()
case charBackspace, charBackspace2: case charBackspace, charBackspace2:
// When currently in history completion, we refresh and automatically // When currently in history completion, we refresh and automatically
// insert the first (filtered) candidate, virtually // insert the first (filtered) candidate, virtually