all repos — shlide @ 0cc2b403aca14370130a86cc9787cb0e57bfda03

slide deck presentation tool written in pure bash

Merge branch 'master' of https://github.com/icyphox/shlide
Akshay nerdypepper@tuta.io
Mon, 03 Feb 2020 00:05:39 +0530
commit

0cc2b403aca14370130a86cc9787cb0e57bfda03

parent

bd9835c3ee3fd4abdbf3e82d08fd8410c96404ad

1 files changed, 16 insertions(+), 7 deletions(-)

jump to
M shlideshlide

@@ -31,15 +31,17 @@ printf '%s\n' "$max"

} colorify() { + # 'eval' hack to achieve substitution for colors. eval "declare dummy=\"$1\"" printf '%b' "$dummy" } +# Filter out color sequences. shopt -s extglob ansi_filter() { - local IFS= - echo "${1//$'\e'[\[(]*([0-9;])[@-n]/}" - #/" a little fix to keep my vim syntax hl sane + local IFS= + echo "${1//$'\e'[\[(]*([0-9;])[@-n]/}" + #" A little fix to prevent vim syntax highlighting from breaking. }

@@ -91,6 +93,11 @@ done <<< "$slide_contents"

} +die() { + printf '\e[?25h' + exit 0 +} + display_end() { read -r LINES COLUMNS < <(stty -F /dev/tty size) ((l=$LINES/2))

@@ -108,6 +115,10 @@ i=0

while true; do # Clear the screen. printf '\e[2J' + + # Capture Ctrl+C. + trap 'die' INT + # Display END reached prompt, and then exit [[ "$i" -eq "${#slides[@]}" ]] && { display_end

@@ -115,8 +126,7 @@ read -rsn1 input

case "$input" in "j"|"n"|"q") printf '\e[2J' - printf '\e[?25h' - exit + die ;; *) ((--i))

@@ -139,8 +149,7 @@ ((--i))

;; "q") # Return the cursor on exit. - printf '\e[?25h' - exit + die ;; esac done