about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-02-26 17:41:22 -0600
committerCase Duckworth2021-02-26 17:41:22 -0600
commitb68064c3262d86abdbe9ed2b29c062f5af357967 (patch)
tree0f8109e2b69ae6ac275e208cd99207f5be4fffea
parentDisable shellcheck in usplit (diff)
downloadbollux-b68064c3262d86abdbe9ed2b29c062f5af357967.tar.gz
bollux-b68064c3262d86abdbe9ed2b29c062f5af357967.zip
Shorten lines
Wanted to make sure all lines are less than 80 characters.
-rwxr-xr-xbollux38
1 files changed, 27 insertions, 11 deletions
diff --git a/bollux b/bollux index d58aac3..5ccd2ba 100755 --- a/bollux +++ b/bollux
@@ -126,8 +126,8 @@ bollux_config() {
126 : "${BOLLUX_DATADIR:=${XDG_DATA_DIR:-$HOME/.local/share}/bollux}" 126 : "${BOLLUX_DATADIR:=${XDG_DATA_DIR:-$HOME/.local/share}/bollux}"
127 : "${BOLLUX_DOWNDIR:=.}" # where to save downloads 127 : "${BOLLUX_DOWNDIR:=.}" # where to save downloads
128 : "${BOLLUX_LESSKEY:=$BOLLUX_DATADIR/lesskey}" # where to store binds 128 : "${BOLLUX_LESSKEY:=$BOLLUX_DATADIR/lesskey}" # where to store binds
129 : "${BOLLUX_PAGESRC:=$BOLLUX_DATADIR/pagesrc}" # where to save the source 129 : "${BOLLUX_PAGESRC:=$BOLLUX_DATADIR/pagesrc}" # where to save source
130 BOLLUX_HISTFILE="$BOLLUX_DATADIR/history" # where to save the history 130 BOLLUX_HISTFILE="$BOLLUX_DATADIR/history" # where to save history
131 ## typesetting 131 ## typesetting
132 : "${T_MARGIN:=4}" # left and right margin 132 : "${T_MARGIN:=4}" # left and right margin
133 : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width 133 : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width
@@ -199,7 +199,9 @@ blastoff() { # blastoff [-u] URL
199 if declare -Fp "${url[1]}_response" >/dev/null 2>&1; then 199 if declare -Fp "${url[1]}_response" >/dev/null 2>&1; then
200 run "${url[1]}_response" "$url" 200 run "${url[1]}_response" "$url"
201 else 201 else
202 log d "No response handler for '${url[1]}', passing thru" 202 log d \
203 "No response handler for '${url[1]}';" \
204 " passing thru"
203 passthru 205 passthru
204 fi 206 fi
205 } 207 }
@@ -674,10 +676,14 @@ display() { # display METADATA [TITLE]
674 mklesskey "$BOLLUX_LESSKEY" && less_cmd+=(-k "$BOLLUX_LESSKEY") 676 mklesskey "$BOLLUX_LESSKEY" && less_cmd+=(-k "$BOLLUX_LESSKEY")
675 local helpline="o:open, g/G:goto, [:back, ]:forward, r:refresh" 677 local helpline="o:open, g/G:goto, [:back, ]:forward, r:refresh"
676 less_cmd+=( 678 less_cmd+=(
677 -Pm"$(less_prompt_escape "$BOLLUX_URL") - bollux$" # 'status'line 679 # 'status'line
678 -P="$(less_prompt_escape "$helpline")$" # helpline 680 -Pm"$(less_prompt_escape "$BOLLUX_URL") - bollux$"
679 -m # start with statusline 681 # helpline
680 +k # float content to the top 682 -P="$(less_prompt_escape "$helpline")$"
683 # start with statusline
684 -m
685 # float content to the top
686 +k
681 ) 687 )
682 688
683 local typeset 689 local typeset
@@ -806,8 +812,10 @@ gemini_link() {
806 fold_line -n -B "\e[${C_LINK_TITLE}m" -A "${C_RESET}" \ 812 fold_line -n -B "\e[${C_LINK_TITLE}m" -A "${C_RESET}" \
807 -l "$((${#ln} + 3))" -m "${T_MARGIN}" \ 813 -l "$((${#ln} + 3))" -m "${T_MARGIN}" \
808 "$WIDTH" "$(trim_string "$t")" 814 "$WIDTH" "$(trim_string "$t")"
809 fold_line -B " \e[${C_LINK_URL}m" -A "${C_RESET}" \ 815 fold_line -B " \e[${C_LINK_URL}m" \
810 -l "$((${#ln} + 3 + ${#t}))" -m "$((T_MARGIN + ${#ln} + 2))" \ 816 -A "${C_RESET}" \
817 -l "$((${#ln} + 3 + ${#t}))" \
818 -m "$((T_MARGIN + ${#ln} + 2))" \
811 "$WIDTH" "$a" 819 "$WIDTH" "$a"
812 else 820 else
813 gemini_pre "$1" 821 gemini_pre "$1"
@@ -879,7 +887,13 @@ gemini_pre() {
879 887
880# wrap lines on words to WIDTH 888# wrap lines on words to WIDTH
881fold_line() { 889fold_line() {
882 # fold_line [-n] [-m MARGIN] [-f MARGIN] [-l LENGTH] [-B BEFORE] [-A AFTER] WIDTH TEXT 890 # fold_line [-n]
891 # [-m MARGIN]
892 # [-f MARGIN]
893 # [-l LENGTH]
894 # [-B BEFORE]
895 # [-A AFTER]
896 # WIDTH TEXT
883 local newline=true 897 local newline=true
884 local -i margin_all=0 margin_first=0 width ll=0 wl=0 wn=0 898 local -i margin_all=0 margin_first=0 width ll=0 wl=0 wn=0
885 local before="" after="" 899 local before="" after=""
@@ -995,8 +1009,10 @@ select_url() { # select_url FILE
995# extract the links from a text/gemini file 1009# extract the links from a text/gemini file
996extract_links() { 1010extract_links() {
997 local url alt 1011 local url alt
1012 local re="^=>[[:space:]]*([^[:space:]]+)([[:space:]]+(.*))?$"
998 while read -r; do 1013 while read -r; do
999 if [[ "$REPLY" =~ ^=\>[[:space:]]*([^[:space:]]+)([[:space:]]+(.*))?$ ]]; then 1014 log d $re
1015 if [[ $REPLY =~ $re ]]; then
1000 url="${BASH_REMATCH[1]}" 1016 url="${BASH_REMATCH[1]}"
1001 alt="${BASH_REMATCH[3]}" 1017 alt="${BASH_REMATCH[3]}"
1002 1018