Skip to content

Commit

Permalink
dont change findlen to force find with cmd-enter
Browse files Browse the repository at this point in the history
cc #605
  • Loading branch information
gokcehan committed Apr 13, 2021
1 parent 0dcfb3d commit fec767d
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,8 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.menuBuf = nil
app.ui.menuSelected = -2

app.ui.cmdAccLeft = nil
app.ui.cmdAccRight = nil
app.ui.cmdTmp = nil

switch app.ui.cmdPrefix {
Expand Down Expand Up @@ -1303,6 +1305,22 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.loadFile(app.nav, true)
app.ui.loadFileInfo(app.nav)
}
case "find: ":
app.ui.cmdPrefix = ""
if moved, found := app.nav.findNext(); !found {
app.ui.echoerrf("find: pattern not found: %s", app.nav.find)
} else if moved {
app.ui.loadFile(app.nav, true)
app.ui.loadFileInfo(app.nav)
}
case "find-back: ":
app.ui.cmdPrefix = ""
if moved, found := app.nav.findPrev(); !found {
app.ui.echoerrf("find-back: pattern not found: %s", app.nav.find)
} else if moved {
app.ui.loadFile(app.nav, true)
app.ui.loadFileInfo(app.nav)
}
case "rename: ":
app.ui.cmdPrefix = ""
if curr, err := app.nav.currFile(); err != nil {
Expand Down Expand Up @@ -1358,16 +1376,9 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.loadFile(app.nav, true)
app.ui.loadFileInfo(app.nav)
}
case "find: ", "find-back: ":
oldlen := gOpts.findlen
gOpts.findlen = len(s)
insert(app, "")
gOpts.findlen = oldlen
default:
log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix)
}
app.ui.cmdAccLeft = nil
app.ui.cmdAccRight = nil
case "cmd-history-next":
if app.ui.cmdPrefix == "" || app.ui.cmdPrefix == ">" {
return
Expand Down

0 comments on commit fec767d

Please sign in to comment.