From 972d79a5c1860d7b7d78f2fc7bdcb4ba476c7c00 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 26 Feb 2021 20:51:25 -0600 Subject: Change BOLLUX_PRE_DISPLAY to T_PRE_DISPLAY; document It's really a typesetting option, so I changed the namespace. --- bollux | 18 +++++++++--------- bollux.1 | 3 +++ bollux.conf.5 | 11 +++++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bollux b/bollux index df27c92..ac17842 100755 --- a/bollux +++ b/bollux @@ -136,7 +136,6 @@ bollux_config() { : "${BOLLUX_PROTO:=gemini}" # default protocol : "${BOLLUX_URL:=}" # start url : "${BOLLUX_BYEMSG:=See You Space Cowboy ...}" # bye message - : "${BOLLUX_PRE_DISPLAY:=pre,alt,both}" # how to view PRE blocks ## files : "${BOLLUX_DATADIR:=${XDG_DATA_DIR:-$HOME/.local/share}/bollux}" : "${BOLLUX_DOWNDIR:=.}" # where to save downloads @@ -144,8 +143,9 @@ bollux_config() { : "${BOLLUX_PAGESRC:=$BOLLUX_DATADIR/pagesrc}" # where to save source BOLLUX_HISTFILE="$BOLLUX_DATADIR/history" # where to save history ## typesetting - : "${T_MARGIN:=4}" # left and right margin - : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width + : "${T_MARGIN:=4}" # left and right margin + : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width + : "${T_PRE_DISPLAY:=pre,alt,both}" # how to view PRE blocks # colors -- these will be wrapped in \e[ __ m C_RESET='\e[0m' # reset : "${C_SIGIL:=35}" # sigil (=>, #, ##, ###, *, ```) @@ -743,7 +743,7 @@ mklesskey() { # mklesskey FILENAME ] quit 3 # 51 forward r quit 4 # 52 re-request / download G quit 5 # 53 goto a url (pre-filled) - ` quit 6 # 54 cycle BOLLUX_PRE_DISPLAY and refresh + ` quit 6 # 54 cycle T_PRE_DISPLAY and refresh # other keybinds \40 forw-screen-force h left-scroll @@ -783,7 +783,7 @@ typeset_gemini() { log d "T_WIDTH=$T_WIDTH" log d "WIDTH=$WIDTH" - log d "$BOLLUX_PRE_DISPLAY" + log d "$T_PRE_DISPLAY" while IFS= read -r; do case "$REPLY" in @@ -794,7 +794,7 @@ typeset_gemini() { else pre=true fi - case "${BOLLUX_PRE_DISPLAY%%,*}" in + case "${T_PRE_DISPLAY%%,*}" in pre) : ;; @@ -908,9 +908,9 @@ gemini_text() { } gemini_pre() { - # Print preformatted text, dependent on $BOLLUX_PRE_DISPLAY and + # Print preformatted text, dependent on $T_PRE_DISPLAY and # $PRE_LINE_FORCE - if [[ alt != "${BOLLUX_PRE_DISPLAY%%,*}" ]] || $PRE_LINE_FORCE; then + if [[ alt != "${T_PRE_DISPLAY%%,*}" ]] || $PRE_LINE_FORCE; then printf "\e[${C_SIGIL}m%${S_MARGIN}s " '```' printf "\e[${C_PRE}m%s${C_RESET}\n" "$1" fi @@ -1008,7 +1008,7 @@ handle_keypress() { # handle_keypress CODE run blastoff -u "$REPLY" ;; 54) # ` - change alt-text visibility and refresh - run cycle_list BOLLUX_PRE_DISPLAY , + run cycle_list T_PRE_DISPLAY , run blastoff "$BOLLUX_URL" ;; 55) # 55-57 -- still available for binding diff --git a/bollux.1 b/bollux.1 index ce32e8d..db965c5 100644 --- a/bollux.1 +++ b/bollux.1 @@ -56,6 +56,9 @@ goto a new URL - with current URL pre-filled .B r refresh the current page .TP +.B ` +cycle preformatted text visibility and refresh the current page +.TP .B [ goto the previous page in history .TP diff --git a/bollux.conf.5 b/bollux.conf.5 index e4b2c54..b590397 100644 --- a/bollux.conf.5 +++ b/bollux.conf.5 @@ -92,6 +92,17 @@ The total width of the window, including .BR T_MARGIN . If set to 0, attempts to use the width of the terminal, falling back to 80. +.TP +.BR T_PRE_DISPLAY +comma-separated list of items; default is pre,alt,both. +.br +How to display preformatted text blocks. +.I pre +shows only the preformatted lines, ignoring the delimiting fences. +.I alt +shows only the first fence line, along with whatever alt text might be there. +.I both +shows both. .SS Colors The different line-types in text/gemini documents are rendered with .I m-class -- cgit 1.4.1-21-gabe81