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