diff options
author | Lyle Mullican <ldmullican@gmail.com> | 2018-11-19 17:16:34 -0500 |
---|---|---|
committer | Lyle Mullican <ldmullican@gmail.com> | 2018-11-19 17:16:34 -0500 |
commit | 4fdc6269b669a8bab7ef4af53868356f6c47f9f5 (patch) | |
tree | 9dc476157badb90fc7bf3a7582064531a61bfd37 /actionview/lib | |
parent | c4720a25ed8738095bd8e441c1406a7a7471d904 (diff) | |
download | rails-4fdc6269b669a8bab7ef4af53868356f6c47f9f5.tar.gz rails-4fdc6269b669a8bab7ef4af53868356f6c47f9f5.tar.bz2 rails-4fdc6269b669a8bab7ef4af53868356f6c47f9f5.zip |
Prevent TextHelper#word_wrap from stripping white space on the left
side of long lines; Fixes #34487
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/text_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb index a338d076e4..3d378dcb2f 100644 --- a/actionview/lib/action_view/helpers/text_helper.rb +++ b/actionview/lib/action_view/helpers/text_helper.rb @@ -259,7 +259,7 @@ module ActionView # # => Once\r\nupon\r\na\r\ntime def word_wrap(text, line_width: 80, break_sequence: "\n") text.split("\n").collect! do |line| - line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1#{break_sequence}").strip : line + line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1#{break_sequence}").rstrip : line end * break_sequence end |