Merged r11706 and r11707 from trunk to 2.3-stable (#13644)

fix diff error in case of line_left out of range.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11709 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2013-04-05 09:56:14 +00:00
parent bd5b7428d8
commit 655c50849d
4 changed files with 86 additions and 4 deletions
+8 -4
View File
@@ -199,15 +199,19 @@ module Redmine
while starting < max && line_left[starting] == line_right[starting]
starting += 1
end
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
if (! "".respond_to?(:force_encoding)) && starting < line_left.size
while line_left[starting].ord.between?(128, 191) && starting > 0
starting -= 1
end
end
ending = -1
while ending >= -(max - starting) && line_left[ending] == line_right[ending]
ending -= 1
end
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
if (! "".respond_to?(:force_encoding)) && ending > (-1 * line_left.size)
while line_left[ending].ord.between?(128, 191) && ending > -1
ending -= 1
end
end
unless starting == 0 && ending == -1
[starting, ending]