]> Sergey Matveev's repositories - nnn.git/commitdiff
fixed shellcheck errors for plugins/preview-tui
authorLucas Summers <summerslucas64@gmail.com>
Tue, 9 Feb 2021 18:32:32 +0000 (10:32 -0800)
committerLucas Summers <summerslucas64@gmail.com>
Tue, 9 Feb 2021 18:32:32 +0000 (10:32 -0800)
plugins/preview-tui

index 0010340e540afd9aac05267105e58dc71b265d43..b260986bfb296aab2694e2f30d371ac96cd23812 100755 (executable)
@@ -172,7 +172,7 @@ preview_file () {
             elif exists viu; then
                 viu -t "$1"
             elif exists ueberzug; then
-                preview_ueberzug "$1"
+                preview_ueberzug "$cols" "$lines" "$1"
             else
                 fifo_pager print_bin_info "$1"
             fi
@@ -196,12 +196,10 @@ preview_file () {
 }
 
 preview_ueberzug() {
-    height=$(tput lines)
-    width=$(tput cols)
-    ueberzug layer --parser json 0< <(
-        printf '{"action": "add", "identifier": "nnn_ueberzug", "x": 0, "y": 0, "max_width": "%s", "max_height": "%s", "path": "%s"}\n' "$width" "$height" "$1"
-        read
-    )
+    {
+        printf '{"action": "add", "identifier": "nnn_ueberzug", "x": 0, "y": 0, "width": "%s", "height": "%s", "path": "%s"}\n' "$1" "$2" "$3"
+        read -r
+    } | ueberzug layer --parser json
 }
 
 if [ "$PREVIEW_MODE" ] ; then