You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sounds a lot like #5, but the error is different. When I frame a box with a static width and pass a string containing two pastel strings as the content, an IndexError is raised.
Steps to reproduce the problem
require "pastel"
require "tty-box"
pastel = Pastel.new
box = TTY::Box
print box.frame(
"#{pastel.italic("TEXT TEXT TEXT TEXT")}; #{pastel.italic("TEXT TEXT TEXT TEXT")}",
width: 40,
)
Actual behaviour
Error raised
/Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:158:in `insert': index 20 out of string (IndexError)
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:158:in `block in insert_ansi'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:142:in `reverse_each'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:142:in `insert_ansi'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:111:in `format_line'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:30:in `block in wrap'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:29:in `map'
from /Users/adam/.gem/ruby/3.0.3/gems/strings-0.2.1/lib/strings/wrap.rb:29:in `wrap'
from /Users/adam/.gem/ruby/3.0.3/gems/tty-box-0.7.0/lib/tty/box.rb:337:in `block in format'
from /Users/adam/.gem/ruby/3.0.3/gems/tty-box-0.7.0/lib/tty/box.rb:336:in `each'
from /Users/adam/.gem/ruby/3.0.3/gems/tty-box-0.7.0/lib/tty/box.rb:336:in `each_with_object'
from /Users/adam/.gem/ruby/3.0.3/gems/tty-box-0.7.0/lib/tty/box.rb:336:in `format'
from /Users/adam/.gem/ruby/3.0.3/gems/tty-box-0.7.0/lib/tty/box.rb:219:in `frame'
from test.rb:7:in `<main>'
Expected behaviour
The too-long string is wrapped inside the box, like an unstyled string
Describe your environment
OS version: macOS 13.3.1 (a)
Ruby version: 3.0.3p157
TTY::Box version: 0.7.0
The text was updated successfully, but these errors were encountered:
Describe the problem
This sounds a lot like #5, but the error is different. When I frame a box with a static width and pass a string containing two pastel strings as the content, an
IndexError
is raised.Steps to reproduce the problem
Actual behaviour
Error raised
Expected behaviour
The too-long string is wrapped inside the box, like an unstyled string
Describe your environment
The text was updated successfully, but these errors were encountered: