commit 2c4c3f99689483a55cf1ddea58d42030e5d10ee5 parent f5a28afd0307b80e8013824130ff8a703f3ff1e0 Author: Vincent Forest <vincent.forest@meso-star.com> Date: Tue, 13 Jun 2023 17:09:04 +0200 Fix some issues In gnome-terminal the escape character must be \e and not \x1b or any other alternatives. Furthermore, in POSIX shell the read command must have a variable as input argument, whereas this was not the case in the example provided Diffstat:
| M | diaposishell | | | 14 | +++++++------- |
| M | example/02-script.sh | | | 10 | +++++----- |
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/diaposishell b/diaposishell @@ -23,21 +23,21 @@ nslides=0 # Number of slides to display ################################################################################ clear_screen() { - printf "\x1b[2J" # Clear the screen - printf "\x1b[0;0H" # Move cursor to the origin + printf "\e[2J" # Clear the screen + printf "\e[0;0H" # Move cursor to the origin } init() { - printf "\x1b[?1049h" # Switch to alternate buffer - printf "\x1b[?25l" # Hide cursor - printf "\x1b[0;0H" # Move cursor to the origin + printf "\e[?1049h" # Switch to alternate buffer + printf "\e[?25l" # Hide cursor + printf "\e[0;0H" # Move cursor to the origin } cleanup() { - printf "\x1b[?1049l" # Disable TUI mode - printf "\x1b[?25h" # show cursor + printf "\e[?1049l" # Disable TUI mode + printf "\e[?25h" # show cursor } cleanup_die() diff --git a/example/02-script.sh b/example/02-script.sh @@ -1,9 +1,9 @@ #!/bin/sh -e -printf "\x1b[?1049h" # Switch to alternate buffer -printf "\x1b[2J" # Clear the screen -printf "\x1b[0;0H" # Move cursor to the origin +printf "\e[?1049h" # Switch to alternate buffer +printf "\e[2J" # Clear the screen +printf "\e[0;0H" # Move cursor to the origin printf "Use scripts to invoke third-party programs and do fancy things.\n" -read -r +read -r c man ./diaposishell.1 -printf "\x1b[?1049l" # Restore main buffer +printf "\e[?1049l" # Restore main buffer