Fix minor incsearch weirdness (#944)

This fixes an issue where if you stared a search then deleted the search
text (with e.g. backspace) it would perform a search for the empty
string and move the selection to the next file.
This commit is contained in:
Paul Ouellette 2022-10-01 09:33:22 -04:00 committed by GitHub
parent 75869f0ac3
commit 165fecbea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -511,6 +511,9 @@ func update(app *app) {
switch {
case gOpts.incsearch && app.ui.cmdPrefix == "/":
app.nav.search = string(app.ui.cmdAccLeft) + string(app.ui.cmdAccRight)
if app.nav.search == "" {
return
}
dir := app.nav.currDir()
old := dir.ind
@ -525,6 +528,9 @@ func update(app *app) {
}
case gOpts.incsearch && app.ui.cmdPrefix == "?":
app.nav.search = string(app.ui.cmdAccLeft) + string(app.ui.cmdAccRight)
if app.nav.search == "" {
return
}
dir := app.nav.currDir()
old := dir.ind