summaryrefslogtreecommitdiffstats
path: root/lib/redmine/unified_diff.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-07-28 11:00:02 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-07-28 11:00:02 +0000
commit670d2b6e2bebdc84aaa4a525d164bf50f8f2eb4b (patch)
tree10ce59f9fc795f47de0081193df12ec68154788d /lib/redmine/unified_diff.rb
parent0ac3afebc62b37e70b3ab69a4d8d4602671dfb46 (diff)
downloadredmine-670d2b6e2bebdc84aaa4a525d164bf50f8f2eb4b.tar.gz
redmine-670d2b6e2bebdc84aaa4a525d164bf50f8f2eb4b.zip
fix diff of CJK(Chinese/Japanese/Korean) is broken on Ruby 1.8 (#14562)
Contributed by Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12046 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/unified_diff.rb')
-rw-r--r--lib/redmine/unified_diff.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb
index 548003220..170ae1db8 100644
--- a/lib/redmine/unified_diff.rb
+++ b/lib/redmine/unified_diff.rb
@@ -205,12 +205,20 @@ module Redmine
end
end
ending = -1
- while ending >= -(max - starting) && line_left[ending] == line_right[ending]
+ while ending >= -(max - starting) && (line_left[ending] == line_right[ending])
ending -= 1
end
if (! "".respond_to?(:force_encoding)) && ending > (-1 * line_left.size)
- while line_left[ending].ord.between?(128, 191) && ending > -1
- ending -= 1
+ while line_left[ending].ord.between?(128, 255) && ending < -1
+ if line_left[ending].ord.between?(128, 191)
+ if line_left[ending + 1].ord.between?(128, 191)
+ ending += 1
+ else
+ break
+ end
+ else
+ ending += 1
+ end
end
end
unless starting == 0 && ending == -1