From e2e5a1e9e6838af48ab4be87c7f0efd4eb30553a Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 3 Jul 2020 16:24:36 +0800 Subject: Modify the width of index from 4 to 5 --- gist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gist b/gist index 7a3ea7d..233b50d 100755 --- a/gist +++ b/gist @@ -290,7 +290,7 @@ _index_pattern() { if [[ -z "$INPUT" ]]; then echo .+ else - echo "($(sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))" + echo "($(sed -Ee '/^ {5,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))" fi } @@ -331,7 +331,7 @@ _print_records() { local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code") [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" - raw_output="$(printf "%-3s" "$index") $message $extra ${status:+${status} }$(_color_pattern '^(\[.+\])' <<<"$description")" + raw_output="$(printf "%-4s" "$index") $message $extra ${status:+${status} }$(_color_pattern '^(\[.+\])' <<<"$description")" decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) done \ @@ -366,7 +366,7 @@ _grep_content() { grep --color=always -EHi -m1 "$1" * 2>/dev/null | head -1 }) - [[ -n $result ]] && hint=false mark="$index " _print_records && sed -e 's/^/ /' <<<"$result" + [[ -n $result ]] && hint=false mark="$index " _print_records && sed -e 's/^/ /' <<<"$result" fi done } -- cgit v1.2.3-70-g09d2