diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 80e0a3626..ff4687f7e 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -1020,10 +1020,13 @@ class RedCloth3 < String end def flush_left( text ) - indt = 0 - if text =~ /^ / + if /(?![\r\n\t ])[[:cntrl:]]/.match?(text) + text.gsub!(/(?![\r\n\t ])[[:cntrl:]]/, '') + end + if /^ /.match?(text) && text.length > 1 + indt = 0 unless text.empty? - indt += 1 while text !~ /^ {#{indt}}[^ ]/ + indt += 1 while text !~ /^ {#{indt}}\S/ end if indt.nonzero? text.gsub!( /^ {#{indt}}/, '' )