fix truncating filename at pull request diff page
This commit is contained in:
parent
7faa9e7699
commit
8ebf36dcb8
|
@ -28,11 +28,9 @@ class String
|
||||||
options[:omission] ||= "..."
|
options[:omission] ||= "..."
|
||||||
options[:separator] ||= '/'
|
options[:separator] ||= '/'
|
||||||
|
|
||||||
length_with_room_for_omission = length - options[:omission].mb_chars.length
|
|
||||||
chars = text.mb_chars
|
chars = text.mb_chars
|
||||||
stop = options[:separator] ?
|
start = chars.length - length + options[:omission].mb_chars.length
|
||||||
(chars.index(options[:separator].mb_chars, length_with_room_for_omission) || length_with_room_for_omission) : length_with_room_for_omission
|
stop = options[:separator] ? (chars.index(options[:separator].mb_chars, start) || start) : start
|
||||||
|
(chars.length > length ? "#{options[:omission]}#{chars[stop..-1]}" : text).to_s
|
||||||
(chars.length > length ? "#{options[:omission]}#{chars[-(stop+1)...-1]}" : text).to_s
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue