rename 'hist' to 'history'

This commit is contained in:
Gokcehan 2018-05-16 00:16:49 +03:00
parent 04f1d68d1e
commit d9761d2dc8
5 changed files with 28 additions and 28 deletions

16
app.go
View File

@ -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 {

4
doc.go
View File

@ -57,8 +57,8 @@ keybindings:
cmd-escape (default '<esc>')
cmd-complete (default '<tab>')
cmd-enter (default '<c-j>' and '<enter>')
cmd-hist-next (default '<c-n>')
cmd-hist-prev (default '<c-p>')
cmd-history-next (default '<c-n>')
cmd-history-prev (default '<c-p>')
cmd-delete (default '<c-d>' and '<delete>')
cmd-delete-back (default '<bs>' and '<bs2>')
cmd-left (default '<c-b>' and '<left>')

View File

@ -61,8 +61,8 @@ keybindings:
cmd-escape (default '<esc>')
cmd-complete (default '<tab>')
cmd-enter (default '<c-j>' and '<enter>')
cmd-hist-next (default '<c-n>')
cmd-hist-prev (default '<c-p>')
cmd-history-next (default '<c-n>')
cmd-history-prev (default '<c-p>')
cmd-delete (default '<c-d>' and '<delete>')
cmd-delete-back (default '<bs>' and '<bs2>')
cmd-left (default '<c-b>' and '<left>')

24
eval.go
View File

@ -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

View File

@ -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["<c-n>"] = &callExpr{"cmd-hist-next", nil, 1}
gOpts.keys["<c-p>"] = &callExpr{"cmd-hist-prev", nil, 1}
gOpts.keys["<c-n>"] = &callExpr{"cmd-history-next", nil, 1}
gOpts.keys["<c-p>"] = &callExpr{"cmd-history-prev", nil, 1}
gOpts.keys["zh"] = &setExpr{"hidden!", ""}
gOpts.keys["zr"] = &setExpr{"reverse!", ""}
@ -122,8 +122,8 @@ func init() {
gOpts.cmdkeys["<tab>"] = &callExpr{"cmd-complete", nil, 1}
gOpts.cmdkeys["<enter>"] = &callExpr{"cmd-enter", nil, 1}
gOpts.cmdkeys["<c-j>"] = &callExpr{"cmd-enter", nil, 1}
gOpts.cmdkeys["<c-n>"] = &callExpr{"cmd-hist-next", nil, 1}
gOpts.cmdkeys["<c-p>"] = &callExpr{"cmd-hist-prev", nil, 1}
gOpts.cmdkeys["<c-n>"] = &callExpr{"cmd-history-next", nil, 1}
gOpts.cmdkeys["<c-p>"] = &callExpr{"cmd-history-prev", nil, 1}
gOpts.cmdkeys["<delete>"] = &callExpr{"cmd-delete", nil, 1}
gOpts.cmdkeys["<c-d>"] = &callExpr{"cmd-delete", nil, 1}
gOpts.cmdkeys["<bs>"] = &callExpr{"cmd-delete-back", nil, 1}