bind redraw to control-l

Mentioned in #92.
This commit is contained in:
Gokcehan 2018-01-29 18:12:59 +03:00
parent f6cce2d40c
commit 288561a9ba
5 changed files with 8 additions and 7 deletions

View File

@ -32,6 +32,7 @@ var (
"delete", "delete",
"put", "put",
"clear", "clear",
"redraw",
"reload", "reload",
"read", "read",
"read-shell", "read-shell",
@ -43,7 +44,6 @@ var (
"search-prev", "search-prev",
"sync", "sync",
"echo", "echo",
"redraw",
"cd", "cd",
"push", "push",
} }

2
doc.go
View File

@ -30,6 +30,7 @@ The following commands are provided by lf with default keybindings:
delete (default 'd') delete (default 'd')
put (default 'p') put (default 'p')
clear (default 'c') clear (default 'c')
redraw (default '<c-l>')
reload (default '<c-r>') reload (default '<c-r>')
read (default ':') read (default ':')
read-shell (default '$') read-shell (default '$')
@ -44,7 +45,6 @@ The following commands are provided by lf without default keybindings:
sync synchronizes yanked/deleted files with server sync synchronizes yanked/deleted files with server
echo prints its arguments to the message line echo prints its arguments to the message line
redraw renew ui elements and redraw the screen
cd changes working directory to its argument cd changes working directory to its argument
push simulate key pushes given in its argument push simulate key pushes given in its argument

View File

@ -34,6 +34,7 @@ The following commands are provided by lf with default keybindings:
delete (default 'd') delete (default 'd')
put (default 'p') put (default 'p')
clear (default 'c') clear (default 'c')
redraw (default '<c-l>')
reload (default '<c-r>') reload (default '<c-r>')
read (default ':') read (default ':')
read-shell (default '$') read-shell (default '$')
@ -48,7 +49,6 @@ The following commands are provided by lf without default keybindings:
sync synchronizes yanked/deleted files with server sync synchronizes yanked/deleted files with server
echo prints its arguments to the message line echo prints its arguments to the message line
redraw renew ui elements and redraw the screen
cd changes working directory to its argument cd changes working directory to its argument
push simulate key pushes given in its argument push simulate key pushes given in its argument

View File

@ -332,6 +332,10 @@ func (e *callExpr) eval(app *app, args []string) {
if err := sendRemote("send sync"); err != nil { if err := sendRemote("send sync"); err != nil {
app.ui.printf("clear: %s", err) app.ui.printf("clear: %s", err)
} }
case "redraw":
app.ui.sync()
app.ui.renew()
app.ui.loadFile(app.nav)
case "reload": case "reload":
app.ui.sync() app.ui.sync()
app.ui.renew() app.ui.renew()
@ -368,10 +372,6 @@ func (e *callExpr) eval(app *app, args []string) {
} }
case "echo": case "echo":
app.ui.msg = strings.Join(e.args, " ") app.ui.msg = strings.Join(e.args, " ")
case "redraw":
app.ui.sync()
app.ui.renew()
app.ui.loadFile(app.nav)
case "cd": case "cd":
path := "~" path := "~"
if len(e.args) > 0 { if len(e.args) > 0 {

View File

@ -70,6 +70,7 @@ func init() {
gOpts.keys["d"] = &callExpr{"delete", nil} gOpts.keys["d"] = &callExpr{"delete", nil}
gOpts.keys["c"] = &callExpr{"clear", nil} gOpts.keys["c"] = &callExpr{"clear", nil}
gOpts.keys["p"] = &callExpr{"put", nil} gOpts.keys["p"] = &callExpr{"put", nil}
gOpts.keys["<c-l>"] = &callExpr{"redraw", nil}
gOpts.keys["<c-r>"] = &callExpr{"reload", nil} gOpts.keys["<c-r>"] = &callExpr{"reload", nil}
gOpts.keys[":"] = &callExpr{"read", nil} gOpts.keys[":"] = &callExpr{"read", nil}
gOpts.keys["$"] = &callExpr{"read-shell", nil} gOpts.keys["$"] = &callExpr{"read-shell", nil}