From 22d08b5e59821ba0dd474fdca3da501ac665ce3b Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 19 May 2020 21:45:42 +0800 Subject: Use variable to get terminal width --- gist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gist b/gist index ce633a4..224d271 100755 --- a/gist +++ b/gist @@ -324,7 +324,7 @@ _print_records() { raw_output="$(_color_pattern "$pattern" <<<"$raw_output")" fi decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) - echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) + echo -e "$raw_output" | cut -c -$(( $COLUMNS +decorator )) done [[ -z $INPUT ]] && _show_hint || true -- cgit v1.2.3-70-g09d2