Fix incorrect width being passed to 'bat' in batgrep with pager

This commit is contained in:
Ethan P 2020-01-17 20:52:58 -08:00
parent 72b09b4416
commit ab38bb254c
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA

View File

@ -117,7 +117,8 @@ if [[ -z "$PATTERN" ]]; then
fi fi
# Generate separator. # Generate separator.
SEP="$(printc "%{DIM}%$(tput cols)s%{CLEAR}" | sed "s/ /─/g")" COLS="$(tput cols)"
SEP="$(printc "%{DIM}%${COLS}s%{CLEAR}" | sed "s/ /─/g")"
# Append ripgrep and bat arguments. # Append ripgrep and bat arguments.
if [[ -n "$OPT_CASE_SENSITIVITY" ]]; then if [[ -n "$OPT_CASE_SENSITIVITY" ]]; then
@ -189,6 +190,7 @@ main() {
"${LAST_LH[@]}" \ "${LAST_LH[@]}" \
--style="${BAT_STYLE}${OPT_SNIP}" \ --style="${BAT_STYLE}${OPT_SNIP}" \
--paging=never \ --paging=never \
--terminal-width="$COLS" \
"$LAST_FILE" "$LAST_FILE"
# Print the separator. # Print the separator.