diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:12:48 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:12:48 +0100 |
commit | 0b8c69cfb7a65bec04c44e58e5776e323d2aa1af (patch) | |
tree | fd81bf6229bfc0d173f5b744534a76b5c70eb440 /lib/coderay/scanners/diff.rb | |
parent | 916711c9983483c39f9a68c29e21a0ed40004bd2 (diff) | |
parent | 0a1f500d524ff0fb5eeafef051ccbb641954a87a (diff) | |
download | coderay-paint-integration.tar.gz |
Merge branch 'master' into paint-integrationpaint-integration
Diffstat (limited to 'lib/coderay/scanners/diff.rb')
-rw-r--r-- | lib/coderay/scanners/diff.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb index af0f755..74a6c27 100644 --- a/lib/coderay/scanners/diff.rb +++ b/lib/coderay/scanners/diff.rb @@ -69,7 +69,7 @@ module Scanners state = :added elsif match = scan(/\\ .*/) encoder.text_token match, :comment - elsif match = scan(/@@(?>[^@\n]*)@@/) + elsif match = scan(/@@(?>[^@\n]+)@@/) content_scanner.state = :initial unless match?(/\n\+/) content_scanner_entry_state = nil if check(/\n|$/) @@ -100,7 +100,7 @@ module Scanners next elsif match = scan(/-/) deleted_lines_count += 1 - if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/) + if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && changed_lines_count <= 100_000 && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/) deleted_lines = Array.new(changed_lines_count) { |i| skip(/\n\-/) if i > 0; scan(/.*/) } inserted_lines = Array.new(changed_lines_count) { |i| skip(/\n\+/) ; scan(/.*/) } |