Skip to content

Commit

Permalink
consider cursor when backspace press
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmtmmnk committed Dec 25, 2020
1 parent 0d9e17e commit 2ceffe3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fuzzyfinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ func (f *finder) readKey() error {
if f.state.x == 0 {
return nil
}
// Remove the latest input rune.
f.state.cursorX -= runewidth.RuneWidth(f.state.input[len(f.state.input)-1])
x := f.state.x
f.state.cursorX -= runewidth.RuneWidth(f.state.input[x-1])
f.state.x--
f.state.input = f.state.input[0 : len(f.state.input)-1]
f.state.input = append(f.state.input[:x-1], f.state.input[x:]...)
case tcell.KeyDelete:
if f.state.x == len(f.state.input) {
return nil
Expand Down

0 comments on commit 2ceffe3

Please sign in to comment.