diff options
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/scanners/diff.rb | 2 | ||||
-rw-r--r-- | lib/coderay/tokens.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index 38efaf4..8e3bf3c 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -45,7 +45,7 @@ module Scanners if match = scan(/--- |\+\+\+ |=+|_+/) encoder.begin_line line_kind = :head encoder.text_token match, :head - if match = scan(/.*?(?=$|[\t\n\x00]| \(revision)/) + if match = scan(/.+?(?=$|[\t\n\x00]| \(revision)/) encoder.text_token match, :filename if options[:highlight_code] && match != '/dev/null' file_type = CodeRay::FileType.fetch(match, :text) diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index c747017..6957d69 100644 --- a/lib/coderay/tokens.rb +++ b/lib/coderay/tokens.rb @@ -93,6 +93,7 @@ module CodeRay # This method is used by @Scanner#tokenize@ when called with an Array # of source strings. The Diff encoder uses it for inline highlighting. def split_into_parts *sizes + return Array.new(sizes.size) { Tokens.new } if size == 2 && first == '' parts = [] opened = [] content = nil |