Fri 10 Jul 2015 08:36:26 PM UTC, original submission:
Add the following two lines to your .nanorc file:
syntax strings
color green start="'" end="'"
Then start nano with 'nano xxx -Y strings' and type the following three lines:
before 'first' after
middle
before 'second' after
In my opinion, only the words first and second should be coloured green, and all the other words not. But currently nano will colour also the words after "first" and on the same line green, and the words before "second" and on the same line, and often also all the lines in between (depending on whether you've just loaded the file or made an edit in one of the affected lines).
It seems that this is caused by nano searching, when it has already found a match for the end regex, for more matches for the start regex, starting at where it found the last start. But it shouldn't start there; it should start looking only after the found end. Any other start between the found start and the found end is irrelevant. And certainly when it has categorized a match as an end, it should not consider this any more as a possible start too.
Well... maybe the matching code still does the right thing, but when the time comes to actually colour the line, the end is also seen as matching a start, so colouring starts there again too.
(This issue was originally reported as bug #41313, but there the basic problem got snowed under.)
|