Skip to content

Commit

Permalink
use native terminal-drawing character
Browse files Browse the repository at this point in the history
  • Loading branch information
lamchau committed Mar 4, 2016
1 parent 542a63a commit 4e5800f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion diff-so-fancy
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ strip_first_column () {
}

print_horizontal_rule () {
printf "%$(tput cols)s\n"| $SED 's/ /─/g'
let width="$(tput cols)"

# echo -n '─' | hexdump -C
local -r dash=$( printf "%b" "\xe2\x94\x80" )
printf "%*s\n" "$width" | $SED "s/ /${dash}/g"
}

print_header_clean () {
Expand Down
8 changes: 8 additions & 0 deletions test/diff-so-fancy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ if begin"
output=$( load_fixture "noprefix" | $diff_so_fancy )
refute_output --partial "diff --git setup-a-new-machine.sh"
}

@test "header format uses a native line-drawing character" {
header=$( printf "%s" "$output" | head -n3 )
run printf "%s" "$header"
assert_line --index 0 --partial "─────"
assert_line --index 1 --partial "modified: fish/functions/ls.fish"
assert_line --index 2 --partial "─────"
}

0 comments on commit 4e5800f

Please sign in to comment.