mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Fix doDeleteForwardWord
This commit is contained in:
parent
f2c65aa650
commit
3f38934228
13
action.go
13
action.go
|
|
@ -400,17 +400,20 @@ func doDeleteForwardWord(i *Input, _ termbox.Event) {
|
|||
return
|
||||
}
|
||||
|
||||
for pos := i.CaretPos().Int(); pos < i.QueryLen(); pos++ {
|
||||
start := i.CaretPos().Int()
|
||||
for pos := start; pos < i.QueryLen(); pos++ {
|
||||
if pos == i.QueryLen()-1 {
|
||||
i.SetQuery(i.Query()[:i.CaretPos()])
|
||||
i.SetQuery(i.Query()[:start])
|
||||
i.SetCaretPos(start)
|
||||
break
|
||||
}
|
||||
|
||||
if unicode.IsSpace(i.Query()[pos]) {
|
||||
buf := make([]rune, i.QueryLen()-(pos-i.CaretPos().Int()))
|
||||
copy(buf, i.Query()[:i.CaretPos()])
|
||||
copy(buf[i.CaretPos():], i.Query()[pos:])
|
||||
buf := make([]rune, i.QueryLen()-(pos-start))
|
||||
copy(buf, i.Query()[:start])
|
||||
copy(buf[start:], i.Query()[pos:])
|
||||
i.SetQuery(buf)
|
||||
i.SetCaretPos(start)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue