Permalink
Browse files

I think I fixed a bug with determining the size of a Cell when you us…

…e the | (pipe) character. Please check carefully!
  • Loading branch information...
1 parent 8f67731 commit a0421408ba592fb62c861cf5b6daa784ae1d3dac Tom van Leeuwen committed Oct 24, 2012
Showing with 4 additions and 1 deletion.
  1. +3 −0 examples/examples.rb
  2. +1 −1 lib/terminal-table/cell.rb
View
@@ -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}
@@ -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

0 comments on commit a042140

Please sign in to comment.