more escaping for escaping
This commit is contained in:
+16
-16
@@ -40,22 +40,22 @@ fi
|
||||
|
||||
# styling used in the TUI
|
||||
ESC=$'\x1b' # use the ANSI literal syntax to support in read prompts as well
|
||||
ERESET="$ESC[0m" # reset the styling
|
||||
ERRCOLOR="$ESC[31;1m" # red bold
|
||||
LINKCOLOR="$ESC[36;1m" # cyan bold
|
||||
FOCUSATTR="$ESC[7;2m" # swap foreground and background and brightness level
|
||||
CLS="$ESC[2J" # clear the entire screen
|
||||
CURRESET="$ESC[0;0H" # reset the visual cursor
|
||||
CURSTART="$ESC[1G" # move cursor to the start of the line
|
||||
LINECLR="$ESC[2K" # clear current line
|
||||
BELOWCLR="$ESC[0J" # clear everything below
|
||||
ALTBUFON="$ESC[?47h" # use the alternative screen buffer
|
||||
ALTBUFOFF="$ESC[?47l" # return to the default screen buffer
|
||||
ERESET="${ESC}[0m" # reset the styling
|
||||
ERRCOLOR="${ESC}[31;1m" # red bold
|
||||
LINKCOLOR="${ESC}[36;1m" # cyan bold
|
||||
FOCUSATTR="${ESC}[7;2m" # swap foreground and background and brightness level
|
||||
CLS="${ESC}[2J" # clear the entire screen
|
||||
CURRESET="${ESC}[0;0H" # reset the visual cursor
|
||||
CURSTART="${ESC}[1G" # move cursor to the start of the line
|
||||
LINECLR="${ESC}[2K" # clear current line
|
||||
BELOWCLR="${ESC}[0J" # clear everything below
|
||||
ALTBUFON="${ESC}[?47h" # use the alternative screen buffer
|
||||
ALTBUFOFF="${ESC}[?47l" # return to the default screen buffer
|
||||
|
||||
# mouse event support switches
|
||||
MOUSEON="$ESC[?1000;1006h" # term command to start sending mouse input events as control sequences (semi-long format, no drag)
|
||||
MOUSEOFF="$ESC[?1000;1006l" # term command to stop sending mouse input events as control sequences (semi-long format, no drag)
|
||||
# in the semi-long format without drag, every mouse control sequence starts with "$ESC[<" and then has three fields:
|
||||
MOUSEON="${ESC}[?1000;1006h" # term command to start sending mouse input events as control sequences (semi-long format, no drag)
|
||||
MOUSEOFF="${ESC}[?1000;1006l" # term command to stop sending mouse input events as control sequences (semi-long format, no drag)
|
||||
# in the semi-long format without drag, every mouse control sequence starts with "${ESC}[<" and then has three fields:
|
||||
# button_attr;xcoord;ycoord[Mm]
|
||||
|
||||
clear_term() { # clear the terminal on Ctrl+C interrupt
|
||||
@@ -186,7 +186,7 @@ amrender() {
|
||||
# - clear everything that remains and reset the cursor to the last line
|
||||
# - output current resource to the status line
|
||||
# - reset the cursor once again
|
||||
output="${output}$BELOWCLR$ESC[$TERMROWS;0H$FOCUSATTR$(amtogopher "$CURRENTAM")$ERESET$ESC[$TERMROWS;0H"
|
||||
output="${output}$BELOWCLR${ESC}[$TERMROWS;0H$FOCUSATTR$(amtogopher "$CURRENTAM")$ERESET${ESC}[$TERMROWS;0H"
|
||||
printf '%b' "$output" # finally, print the entire output with a single call
|
||||
}
|
||||
trap 'amrender' WINCH # rerender on terminal size change
|
||||
@@ -258,7 +258,7 @@ goback() { # remove the last AM line from history and go there
|
||||
stashlink() { # stash the link to the currently viewed resource
|
||||
local gopherlink="$(amtogopher "$CURRENTAM")"
|
||||
printf '[%s] %s\n' "$(date -u '+%F %T')" "$gopherlink" >> $BOPHER_LINKSTASH
|
||||
printf 'Stashed %s%b' "$gopherlink" "$ERESET$ESC[$TERMROWS;0H" # just reset the cursor to the last line
|
||||
printf 'Stashed %s%b' "$gopherlink" "$ERESET${ESC}[$TERMROWS;0H" # just reset the cursor to the last line
|
||||
}
|
||||
|
||||
# Focus and click a link on a Gophermap
|
||||
|
||||
Reference in New Issue
Block a user