add 'waitmsg' option to configure the message after shell-wait commands (#604)

This commit is contained in:
gotroyb127 authored and GitHub committed 2021-04-06 18:57:23 +03:00
1 parent 229b7b1ade
commit 0cfd34f30d
7 files changed
+24 -1

No files matched your search

+1
View File
@@ -118,6 +118,7 @@ var (
"smartdia", "smartdia",
"nosmartdia", "nosmartdia",
"smartdia!", "smartdia!",
"waitmsg",
"wrapscan", "wrapscan",
"nowrapscan", "nowrapscan",
"wrapscan!", "wrapscan!",
+5
View File
@@ -134,6 +134,7 @@ The following options can be used to customize the behavior of lf:
tabstop int (default 8) tabstop int (default 8)
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
@@ -679,6 +680,10 @@ Format string of the file modification time shown in the bottom line.
Truncate character shown at the end when the file name does not fit to the pane. Truncate character shown at the end when the file name does not fit to the pane.
waitmsg string (default 'Press any key to continue')
String shown after commands of shell-wait type.
wrapscan bool (default on) wrapscan bool (default on)
Searching can wrap around the file list. Searching can wrap around the file list.
+5
View File
@@ -137,6 +137,7 @@ The following options can be used to customize the behavior of lf:
tabstop int (default 8) tabstop int (default 8)
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
@@ -725,6 +726,10 @@ Format string of the file modification time shown in the bottom line.
Truncate character shown at the end when the file name does not fit to the Truncate character shown at the end when the file name does not fit to the
pane. pane.
waitmsg string (default 'Press any key to continue')
String shown after commands of shell-wait type.
wrapscan bool (default on) wrapscan bool (default on)
Searching can wrap around the file list. Searching can wrap around the file list.
+2
View File
@@ -178,6 +178,8 @@ func (e *setExpr) eval(app *app, args []string) {
gOpts.smartdia = false gOpts.smartdia = false
case "smartdia!": case "smartdia!":
gOpts.smartdia = !gOpts.smartdia gOpts.smartdia = !gOpts.smartdia
case "waitmsg":
gOpts.waitmsg = e.val
case "wrapscan": case "wrapscan":
gOpts.wrapscan = true gOpts.wrapscan = true
case "nowrapscan": case "nowrapscan":
+7
View File
@@ -149,6 +149,7 @@ The following options can be used to customize the behavior of lf:
tabstop int (default 8) tabstop int (default 8)
timefmt string (default 'Mon Jan _2 15:04:05 2006') timefmt string (default 'Mon Jan _2 15:04:05 2006')
truncatechar string (default '~') truncatechar string (default '~')
waitmsg string (default 'Press any key to continue')
wrapscan bool (default on) wrapscan bool (default on)
wrapscroll bool (default off) wrapscroll bool (default off)
.EE .EE
@@ -815,6 +816,12 @@ Format string of the file modification time shown in the bottom line.
.PP .PP
Truncate character shown at the end when the file name does not fit to the pane. Truncate character shown at the end when the file name does not fit to the pane.
.PP .PP
.EX
waitmsg string (default 'Press any key to continue')
.EE
.PP
String shown after commands of shell-wait type.
.PP
.EX .EX
wrapscan bool (default on) wrapscan bool (default on)
.EE .EE
+2
View File
@@ -42,6 +42,7 @@ var gOpts struct {
relativenumber bool relativenumber bool
smartcase bool smartcase bool
smartdia bool smartdia bool
waitmsg string
wrapscan bool wrapscan bool
wrapscroll bool wrapscroll bool
findlen int findlen int
@@ -83,6 +84,7 @@ func init() {
gOpts.relativenumber = false gOpts.relativenumber = false
gOpts.smartcase = true gOpts.smartcase = true
gOpts.smartdia = false gOpts.smartdia = false
gOpts.waitmsg = "Press any key to continue"
gOpts.wrapscan = true gOpts.wrapscan = true
gOpts.wrapscroll = false gOpts.wrapscroll = false
gOpts.findlen = 1 gOpts.findlen = 1
+2 -1
View File
@@ -1153,13 +1153,14 @@ func (ui *ui) resume() error {
} }
func anyKey() { func anyKey() {
fmt.Print(gOpts.waitmsg)
defer fmt.Print("\n")
oldState, err := term.MakeRaw(int(os.Stdin.Fd())) oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
if err != nil { if err != nil {
panic(err) panic(err)
} }
defer term.Restore(int(os.Stdin.Fd()), oldState) defer term.Restore(int(os.Stdin.Fd()), oldState)
fmt.Print("Press any key to continue")
b := make([]byte, 1) b := make([]byte, 1)
os.Stdin.Read(b) os.Stdin.Read(b)
} }