diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-11-19 18:07:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 18:07:34 -0500 |
commit | 0bbe3409b52d6f7c29a29fbcb9e1acf9d3822406 (patch) | |
tree | 4513b9167599f87408ebf3ed5924f468c4a2fc4c /actionview/lib/action_view/helpers | |
parent | 53478c388837085a8de990f04012e99a94501632 (diff) | |
parent | 4fdc6269b669a8bab7ef4af53868356f6c47f9f5 (diff) | |
download | rails-0bbe3409b52d6f7c29a29fbcb9e1acf9d3822406.tar.gz rails-0bbe3409b52d6f7c29a29fbcb9e1acf9d3822406.tar.bz2 rails-0bbe3409b52d6f7c29a29fbcb9e1acf9d3822406.zip |
Merge pull request #34488 from mullican/word_wrap_preserve_left_side_whitespace
Prevent TextHelper#word_wrap from stripping white space on the left side of long lines; Fixes #34487
Diffstat (limited to 'actionview/lib/action_view/helpers')
-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 |