Skip to content

Commit

Permalink
🐞 fix: Do not mangle output if contains tabs
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
LukeSavefrogs committed Dec 2, 2023
1 parent 57e92ac commit bc31e6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/column_ansi.pl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sub trim_ansi {

# Default values for INPUT_SEPARATOR and OUTPUT_SEPARATOR
if ($INPUT_SEPARATOR eq ""){
$INPUT_SEPARATOR = " "
$INPUT_SEPARATOR = qr/[\s\t]+/;
}
if ($OUTPUT_SEPARATOR eq ""){
$OUTPUT_SEPARATOR = " "
Expand Down
20 changes: 20 additions & 0 deletions tests/functional/spaces.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#shellcheck shell=sh

%const LIBRARY_PATH: src/column_ansi.sh
Include "${LIBRARY_PATH}"

input_data () {
printf "this \twill \t be\taligned"
}

# @see https://github.com/LukeSavefrogs/column_ansi/issues/19
Describe "Mixed tabs and spaces:"
Example "should work when words have mixed whitespace"
Set 'errexit:on'

Data input_data
When call column_ansi -t -o "|"
The status should be success
The output should eq "this|will|be|aligned"
End
End

0 comments on commit bc31e6b

Please sign in to comment.