Skip to content

Commit

Permalink
I think I fixed a bug with determining the size of a Cell when you us…
Browse files Browse the repository at this point in the history
…e the | (pipe) character. Please check carefully!
  • Loading branch information
Tom van Leeuwen committed Oct 24, 2012
1 parent 8f67731 commit a042140
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/examples.rb
Expand Up @@ -4,6 +4,9 @@
puts
puts table(['a', 'b'], [1, 2], [3, 4])

puts
puts table(['name', 'content'], ['ftp.example.com', '1.1.1.1'], ['www.example.com', '|lalalala|lalala|'])

puts
t = table ['a', 'b']
t.style = {:padding_left => 2, :width => 80}
Expand Down
2 changes: 1 addition & 1 deletion lib/terminal-table/cell.rb
Expand Up @@ -87,7 +87,7 @@ def width
def escape(line)
line.to_s.gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '').
gsub(/\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]/, '').
gsub(/[\x03|\x1a]/, '')
gsub(/(\x03|\x1a)/, '')
end
end
end
Expand Down

0 comments on commit a042140

Please sign in to comment.