mirror of https://github.com/Hilbis/Hilbish
feat: control k to delete the rest of the line (#128)
Co-authored-by: Renzix <DanielDeBruno@renzix.com>pull/131/head
parent
0aba60b5de
commit
61c9e12a4a
|
@ -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]
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue