Diff parser glitches for deleted lines starting with "--"

25 prikaza
Preskoči na prvu nepročitanu poruku

Sven Strickroth

nepročitano,
20. sij 2017. 16:29:4520. 01. 2017.
u scintilla...@googlegroups.com
Hi,

the diff lexer doesn't correctly parse/colorize deleted lines starting
with "--".

There are two cases, whereas I can provide a fix for the first one.

A deleted line "-->" is parsed as HEADER (the attached patch
"Correctly-color-code-deleted-lines-starting-with" fixes this).

When you open example.patch you can see, that a deleted line which only
contains "--" is also colored wrongly, however, the fix is not that easy
and requires context (i.e., we already parsed the header and are in a
hunk context). I'm not sure how to quell this w/o breaking stuff and,
thus, I haven't worked on a patch. - Here unittests with a set of
example files and the the expected parsing would help a lot.

--
Best regards,
Sven Strickroth
PGP key id F5A9D4C4 @ any key-server
Correctly-color-code-deleted-lines-starting-with.patch
example.patch

Neil Hodgson

nepročitano,
21. sij 2017. 00:39:5721. 01. 2017.
u scintilla...@googlegroups.com
Sven Strickroth:

> the diff lexer doesn't correctly parse/colorize deleted lines starting
> with "--“.

There is a related bug at
https://sourceforge.net/p/scintilla/bugs/1823/

> There are two cases, whereas I can provide a fix for the first one.
>
> A deleted line "-->" is parsed as HEADER (the attached patch
> "Correctly-color-code-deleted-lines-starting-with" fixes this).

The patch seems reasonable.

> When you open example.patch you can see, that a deleted line which only
> contains "--" is also colored wrongly, however, the fix is not that easy
> and requires context (i.e., we already parsed the header and are in a
> hunk context). I'm not sure how to quell this w/o breaking stuff and,
> thus, I haven't worked on a patch. - Here unittests with a set of
> example files and the the expected parsing would help a lot.

Its quite difficult as patch formats overlap and they are generated by different programs and may be processed in various ways such as being copied and pasted from terminal sessions or passed through mailers.

Neil

Neil Hodgson

nepročitano,
22. sij 2017. 23:08:0722. 01. 2017.
u Scintilla mailing list
Sven Strickroth:

> A deleted line "-->" is parsed as HEADER (the attached patch
> "Correctly-color-code-deleted-lines-starting-with" fixes this).

This patch was committed as
https://sourceforge.net/p/scintilla/code/ci/6b563404748320a12f1425b2320980972b0b0506/

Neil

Odgovori svima
Odgovori autoru
Proslijedi
0 novih poruka