ruby / irb

interactive Ruby
BSD 2-Clause "Simplified" License
393 stars 119 forks source link

Fix % escape in prompt format #927

Closed tompng closed 7 months ago

tompng commented 7 months ago

Escaping % in prompt fromatting was not correctly implemented.

# Wrong formatting
IRB::Irb.new.send(:format_prompt, '%% %02i', nil, 1, 1)
=> "%% 01" # should be "% 01"

# Reference
format '%% %02d', 1
=> "% 01"

This pull request fixes it.