From d9761d2dc8ada30a3204de44150d22e771115f54 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Wed, 16 May 2018 00:16:49 +0300 Subject: [PATCH] rename 'hist' to 'history' --- app.go | 16 ++++++++-------- doc.go | 4 ++-- docstring.go | 4 ++-- eval.go | 24 ++++++++++++------------ opts.go | 8 ++++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app.go b/app.go index 37cff0b..161d2d3 100644 --- a/app.go +++ b/app.go @@ -17,14 +17,14 @@ type cmdItem struct { } type app struct { - ui *ui - nav *nav - quitChan chan bool - cmd *exec.Cmd - cmdIn io.WriteCloser - cmdOutBuf []byte - cmdHist []cmdItem - cmdHistInd int + ui *ui + nav *nav + quitChan chan bool + cmd *exec.Cmd + cmdIn io.WriteCloser + cmdOutBuf []byte + cmdHistory []cmdItem + cmdHistoryInd int } func newApp() *app { diff --git a/doc.go b/doc.go index 831d802..bb6ddeb 100644 --- a/doc.go +++ b/doc.go @@ -57,8 +57,8 @@ keybindings: cmd-escape (default '') cmd-complete (default '') cmd-enter (default '' and '') - cmd-hist-next (default '') - cmd-hist-prev (default '') + cmd-history-next (default '') + cmd-history-prev (default '') cmd-delete (default '' and '') cmd-delete-back (default '' and '') cmd-left (default '' and '') diff --git a/docstring.go b/docstring.go index e0c8add..41a1ab5 100644 --- a/docstring.go +++ b/docstring.go @@ -61,8 +61,8 @@ keybindings: cmd-escape (default '') cmd-complete (default '') cmd-enter (default '' and '') - cmd-hist-next (default '') - cmd-hist-prev (default '') + cmd-history-next (default '') + cmd-history-prev (default '') cmd-delete (default '' and '') cmd-delete-back (default '' and '') cmd-left (default '' and '') diff --git a/eval.go b/eval.go index d4f14c1..f7c096f 100644 --- a/eval.go +++ b/eval.go @@ -492,7 +492,7 @@ func (e *callExpr) eval(app *app, args []string) { case "%": log.Printf("shell-pipe: %s", s) app.runShell(s, nil, app.ui.cmdPrefix) - app.cmdHist = append(app.cmdHist, cmdItem{"%", s}) + app.cmdHistory = append(app.cmdHistory, cmdItem{"%", s}) return case ">": io.WriteString(app.cmdIn, s+"\n") @@ -525,36 +525,36 @@ func (e *callExpr) eval(app *app, args []string) { default: log.Printf("entering unknown execution prefix: %q", app.ui.cmdPrefix) } - app.cmdHist = append(app.cmdHist, cmdItem{app.ui.cmdPrefix, s}) + app.cmdHistory = append(app.cmdHistory, cmdItem{app.ui.cmdPrefix, s}) app.ui.cmdPrefix = "" - case "cmd-hist-next": + case "cmd-history-next": if app.ui.cmdPrefix == "" { return } - if app.cmdHistInd > 0 { - app.cmdHistInd-- + if app.cmdHistoryInd > 0 { + app.cmdHistoryInd-- } - if app.cmdHistInd == 0 { + if app.cmdHistoryInd == 0 { app.ui.menuBuf = nil app.ui.cmdAccLeft = nil app.ui.cmdAccRight = nil app.ui.cmdPrefix = "" return } - cmd := app.cmdHist[len(app.cmdHist)-app.cmdHistInd] + cmd := app.cmdHistory[len(app.cmdHistory)-app.cmdHistoryInd] app.ui.cmdPrefix = cmd.prefix app.ui.cmdAccLeft = []rune(cmd.value) app.ui.cmdAccRight = nil app.ui.menuBuf = nil - case "cmd-hist-prev": + case "cmd-history-prev": if app.ui.cmdPrefix == "" { - app.cmdHistInd = 0 + app.cmdHistoryInd = 0 } - if app.cmdHistInd == len(app.cmdHist) { + if app.cmdHistoryInd == len(app.cmdHistory) { return } - app.cmdHistInd++ - cmd := app.cmdHist[len(app.cmdHist)-app.cmdHistInd] + app.cmdHistoryInd++ + cmd := app.cmdHistory[len(app.cmdHistory)-app.cmdHistoryInd] app.ui.cmdPrefix = cmd.prefix app.ui.cmdAccLeft = []rune(cmd.value) app.ui.cmdAccRight = nil diff --git a/opts.go b/opts.go index bfbda4a..a5b317e 100644 --- a/opts.go +++ b/opts.go @@ -101,8 +101,8 @@ func init() { gOpts.keys["?"] = &callExpr{"search-back", nil, 1} gOpts.keys["n"] = &callExpr{"search-next", nil, 1} gOpts.keys["N"] = &callExpr{"search-prev", nil, 1} - gOpts.keys[""] = &callExpr{"cmd-hist-next", nil, 1} - gOpts.keys[""] = &callExpr{"cmd-hist-prev", nil, 1} + gOpts.keys[""] = &callExpr{"cmd-history-next", nil, 1} + gOpts.keys[""] = &callExpr{"cmd-history-prev", nil, 1} gOpts.keys["zh"] = &setExpr{"hidden!", ""} gOpts.keys["zr"] = &setExpr{"reverse!", ""} @@ -122,8 +122,8 @@ func init() { gOpts.cmdkeys[""] = &callExpr{"cmd-complete", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-enter", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-enter", nil, 1} - gOpts.cmdkeys[""] = &callExpr{"cmd-hist-next", nil, 1} - gOpts.cmdkeys[""] = &callExpr{"cmd-hist-prev", nil, 1} + gOpts.cmdkeys[""] = &callExpr{"cmd-history-next", nil, 1} + gOpts.cmdkeys[""] = &callExpr{"cmd-history-prev", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-delete", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-delete", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-delete-back", nil, 1}