From: luukvbaal <31730729+luukvbaal@users.noreply.github.com>
Date: Fri, 30 Apr 2021 13:29:11 +0000 (+0200)
Subject: preview-tui: update prompts (#980)
X-Git-Tag: v4.1~121
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5ed2998023ec933b9a936171063b7a181cd78238;p=nnn.git

preview-tui: update prompts (#980)
---

diff --git a/plugins/preview-tui b/plugins/preview-tui
index 31328a93..be92ac01 100755
--- a/plugins/preview-tui
+++ b/plugins/preview-tui
@@ -53,10 +53,10 @@
 #   'h'orizontal split or a 'v'ertical split (as in, the line that splits the
 #   windows will be horizontal or vertical).
 #
-#   Kitty users need `allow_remote_control` set to `yes`. To customize the
-#   window split, `enabled_layouts` has to be set to `all` or `splits` (the
-#   former is the default value). This terminal is also able to show images
-#   without extra dependencies.
+#   Kitty users need `allow_remote_control` set to `yes`, and `listen_on` set
+#   to e.g. "$TMPDIR/kitty". To customize the window split, `enabled_layouts`
+#   has to be set to `all` or `splits` (the former is the default value).
+#   This terminal is also able to show images without extra dependencies.
 #
 # Shell: POSIX compliant
 # Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal
@@ -299,14 +299,12 @@ if [ "$PREVIEW_MODE" ]; then
 else
     if [ ! -r "$NNN_FIFO" ]; then
         clear
-        printf "No FIFO available! (\$NNN_FIFO='%s')\nPlease read the documentation" "$NNN_FIFO"
-        read -r _
+        printf "No FIFO available! (\$NNN_FIFO='%s')\nPlease read Usage in preview-tui." "$NNN_FIFO"
+        cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
     elif [ "$KITTY_WINDOW_ID" ] && [ -z "$KITTY_LISTEN_ON" ]; then
-        # The escape codes used to control kitty splits cause problems when run from a background process.
-        # Use --listen-on flag or listen_on config variable to avoid(https://sw.kovidgoyal.net/kitty/conf.html)
         clear
-        printf "\$KITTY_LISTEN_ON not set!\nPlease add listen_on to your kitty.conf or start with the --listen-on flag."
-        read -r _
+        printf "\$KITTY_LISTEN_ON not set!\nPlease read Usage in preview-tui."
+        cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
     else
         togglepreview "$1" &
     fi
diff --git a/plugins/preview-tui-ext b/plugins/preview-tui-ext
index ecaee020..1e5ed57f 100755
--- a/plugins/preview-tui-ext
+++ b/plugins/preview-tui-ext
@@ -64,10 +64,10 @@
 #   'h'orizontal split or a 'v'ertical split (as in, the line that splits the
 #   windows will be horizontal or vertical).
 #
-#   Kitty users need `allow_remote_control` set to `yes`. To customize the
-#   window split, `enabled_layouts` has to be set to `all` or `splits` (the
-#   former is the default value). This terminal is also able to show images
-#   without extra dependencies.
+#   Kitty users need `allow_remote_control` set to `yes`, and `listen_on` set
+#   to e.g. "$TMPDIR/kitty". To customize the window split, `enabled_layouts`
+#   has to be set to `all` or `splits` (the former is the default value).
+#   This terminal is also able to show images without extra dependencies.
 #
 # Shell: POSIX compliant
 # Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal
@@ -406,14 +406,12 @@ if [ "$PREVIEW_MODE" ]; then
 else
     if [ ! -r "$NNN_FIFO" ]; then
         clear
-        printf "No FIFO available! (\$NNN_FIFO='%s')\nPlease read the documentation" "$NNN_FIFO"
-        read -r _
+        printf "No FIFO available! (\$NNN_FIFO='%s')\nPlease read Usage in preview-tui-ext." "$NNN_FIFO"
+        cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
     elif [ "$KITTY_WINDOW_ID" ] && [ -z "$KITTY_LISTEN_ON" ]; then
-        # The escape codes used to control kitty splits cause problems when run from a background process.
-        # Use --listen-on flag or listen_on config variable to avoid(https://sw.kovidgoyal.net/kitty/conf.html)
         clear
-        printf "\$KITTY_LISTEN_ON not set!\nPlease add listen_on to your kitty.conf or start with the --listen-on flag."
-        read -r _
+        printf "\$KITTY_LISTEN_ON not set!\nPlease read Usage in preview-tui-ext."
+        cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
     else
         togglepreview "$1" &
     fi