aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers
diff options
context:
space:
mode:
authorLyle Mullican <ldmullican@gmail.com>2018-11-19 17:16:34 -0500
committerLyle Mullican <ldmullican@gmail.com>2018-11-19 17:16:34 -0500
commit4fdc6269b669a8bab7ef4af53868356f6c47f9f5 (patch)
tree9dc476157badb90fc7bf3a7582064531a61bfd37 /actionview/lib/action_view/helpers
parentc4720a25ed8738095bd8e441c1406a7a7471d904 (diff)
downloadrails-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/action_view/helpers')
-rw-r--r--actionview/lib/action_view/helpers/text_helper.rb2
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