Skip to content

Commit 7ac60c0

Browse files
committed
adapt for beasties
1 parent 99681a4 commit 7ac60c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-branch-status

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,18 @@ function AppendHeadDate # (commit_ref)
285285

286286
function CurrentTtyW
287287
{
288-
stty -F /dev/tty size | cut -d ' ' -f 2
288+
local tty_dims=$(stty -F /dev/tty size 2> /dev/null || stty -f /dev/tty size 2> /dev/null)
289+
local tty_w=$(echo $tty_dims | cut -d ' ' -f 2)
290+
291+
(( $tty_w )) && echo "$tty_w" || echo "$MIN_TTY_W"
289292
}
290293

291294
function PrintHRule # (rule_width)
292295
{
293296
local rule_w=$1
297+
local h_rule="$(dd if=/dev/zero bs=$rule_w count=1 2> /dev/null | tr '\0' $HRULE_CHAR)"
294298

295-
printf "$MARGIN_PAD$(head -c $rule_w < /dev/zero | tr '\0' $HRULE_CHAR)\n"
299+
echo "$MARGIN_PAD$h_rule"
296300
}
297301

298302
function EXIT # (exit_msg exit_status)

0 commit comments

Comments
 (0)