[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] disable a time-consuming multiline regex?
From: |
Mike Frysinger |
Subject: |
Re: [Nano-devel] disable a time-consuming multiline regex? |
Date: |
Wed, 23 Dec 2015 12:38:07 -0500 |
On 01 Dec 2015 21:14, Benno Schulenberg wrote:
> The following regex in c.nanorc is very time-hungry:
>
> # Multiline strings. This regex is VERY resource intensive!
> color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
>
> For example, run 'src/nano --cons +4444 src/winio.c',
> then press and hold ^Y. See how the flying by of the
> pages is fairly smooth.
>
> Then exit nano and run the same command again, and
> type ^Y ^K. Then press and hold ^Y. See how after
> a few seconds the scrolling begins to stutter and
> pause (at least here it does, on a 1.6 GHz Atom).
>
> Maybe that string should be commented out by default?
> (When I do so, scrolling becomes fluid.)
>
> Also, the regex doesn't work fully correctly.
> For example, run 'src/nano imperfect.c' and type:
>
> "one
> two
> three"
>
> The string isn't coloured, which is correct, because backslashes
> are missing. Now type a backslah after "one" -- all three words
> are coloured. But that should happen only when there is also a
> backslash after "two". Nano's regexes are not capable of expressing
> this, so maybe also therefore such an imperfect matcher should be
> disabled?
i tend to disable it as well because it gets other cases wrong like:
#define FOO() \
printf("ok!"); \
blah; \
printf("done!");
it causes the whole body of the macro to be highlighted
-mike
signature.asc
Description: Digital signature