From 0cfd34f30d155b573beeae5eabbc73815ccca282 Mon Sep 17 00:00:00 2001 From: gotroyb127 <62418822+gotroyb127@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:57:23 +0300 Subject: [PATCH] add 'waitmsg' option to configure the message after shell-wait commands (#604) --- complete.go | 1 + doc.go | 5 +++++ docstring.go | 5 +++++ eval.go | 2 ++ lf.1 | 7 +++++++ opts.go | 2 ++ ui.go | 3 ++- 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/complete.go b/complete.go index 8d7f13e6..58fd6b62 100644 --- a/complete.go +++ b/complete.go @@ -118,6 +118,7 @@ var ( "smartdia", "nosmartdia", "smartdia!", + "waitmsg", "wrapscan", "nowrapscan", "wrapscan!", diff --git a/doc.go b/doc.go index 2a4501b8..809fb509 100644 --- a/doc.go +++ b/doc.go @@ -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. diff --git a/docstring.go b/docstring.go index d90109de..0983142e 100644 --- a/docstring.go +++ b/docstring.go @@ -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. diff --git a/eval.go b/eval.go index f7cc7197..989a8340 100644 --- a/eval.go +++ b/eval.go @@ -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": diff --git a/lf.1 b/lf.1 index 8ad1926c..b9f83b44 100644 --- a/lf.1 +++ b/lf.1 @@ -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 diff --git a/opts.go b/opts.go index 95b61c10..62edda00 100644 --- a/opts.go +++ b/opts.go @@ -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 diff --git a/ui.go b/ui.go index e94ffdb4..62014448 100644 --- a/ui.go +++ b/ui.go @@ -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) }