fix encode bugs on diff not utf-8 encode's code
This commit is contained in:
parent
f114a4f349
commit
12c01d7401
2 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
- line_new = 0
|
- line_new = 0
|
||||||
- lines_arr = diff.diff.lines.to_a
|
- lines_arr = diff.diff.lines.to_a
|
||||||
- lines_arr.each do |line|
|
- lines_arr.each do |line|
|
||||||
- encode(line)
|
- line = encode(line)
|
||||||
- next if line.match(/^--- \/dev\/null/)
|
- next if line.match(/^--- \/dev\/null/)
|
||||||
- next if line.match(/^--- a/)
|
- next if line.match(/^--- a/)
|
||||||
- next if line.match(/^\+\+\+ b/)
|
- next if line.match(/^\+\+\+ b/)
|
||||||
|
|
|
@ -29,12 +29,12 @@ module Utils
|
||||||
module Colorize
|
module Colorize
|
||||||
include CharEncode
|
include CharEncode
|
||||||
def colorize
|
def colorize
|
||||||
system_colorize(encode(data), name)
|
system_colorize(data, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def system_colorize(data, file_name)
|
def system_colorize(data, file_name)
|
||||||
ft = handle_file_type(file_name)
|
ft = handle_file_type(file_name)
|
||||||
Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
|
Pygments.highlight(encode(data), :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' })
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_file_type(file_name, mime_type = nil)
|
def handle_file_type(file_name, mime_type = nil)
|
||||||
|
|
Loading…
Add table
Reference in a new issue