[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] aggressive C color highlighting
From: |
delta |
Subject: |
Re: [Nano-devel] aggressive C color highlighting |
Date: |
Thu, 3 Aug 2006 16:29:02 -0600 |
On Thu, 3 Aug 2006 09:09:07 -0700 (PDT)
"John M. Gabriele" <address@hidden> wrote:
> I think that overlaps should be allowed only when the outer match
> totally encompasses the inner match:
>
> match1_start match2_start match2_end match1_end
> \---------------/
> \----------------------------------------------------/
>
> but not when they only partially overlap:
>
> match1_start match2_start match1_end match2_end
> \----------------------------------/
> \--------------------------------/
I already have this implemented in an patch to 1.3.0. There were a few bugs
with some additional features that kept me from releasing it and I lost my free
time before resolving them. I will try to port the code sans buggy features to
the latest source and post it here.
--
Nano colorizes every match on the screen before moving on to the next
expression. Match overlap removal can be handled using two different methods.
1) Apply all expressions to the current character pointer and increment to the
end of the match or to the next character when there is no match. This method
is quite simple and will give a significant speed boost.
2) Use the same technique as in the first method but store all matches in a
list and colorize the text using the list. The list must be rebuilt each time
the file is modified. This method uses more memory to store the list but gives
a huge speed increase when only viewing a file and no loss in speed compared to
the first method.
A force-color directive is required to always apply certain expressions such as
those that highlight whitespace at the end of lines.
Once this code is in place it becomes easy to apply sets of expressions to
matches.
# color bar when found after foo
color red "foo "
{
next-color blue "bar"
}
# color php code inside an html file
color begin="^<?php" end="^?>"
{
include "php.nanorc"
}
--
Brand Huntsman -- http://www.qzx.com
Gentoo Linux 2.6.14.2-k7 [AMD Athlon 64 3000+ @ 1299MHz]
up 29 days 23:13 hours
- Re: [Nano-devel] aggressive C color highlighting, David Lawrence Ramsey, 2006/08/01
- Re: [Nano-devel] aggressive C color highlighting, Mike Frysinger, 2006/08/02
- Re: [Nano-devel] aggressive C color highlighting, David Lawrence Ramsey, 2006/08/02
- Re: [Nano-devel] aggressive C color highlighting, Alexey Toptygin, 2006/08/02
- Re: [Nano-devel] aggressive C color highlighting, David Lawrence Ramsey, 2006/08/02
- Re: [Nano-devel] aggressive C color highlighting, Alexey Toptygin, 2006/08/02
- Re: [Nano-devel] aggressive C color highlighting, John M. Gabriele, 2006/08/03
- Re: [Nano-devel] aggressive C color highlighting,
delta <=
- Re: [Nano-devel] aggressive C color highlighting, Alexey Toptygin, 2006/08/03
- Re: [Nano-devel] aggressive C color highlighting, David Lawrence Ramsey, 2006/08/03
- Re: [Nano-devel] aggressive C color highlighting, Alexey Toptygin, 2006/08/03
- Re: [Nano-devel] aggressive C color highlighting, David Lawrence Ramsey, 2006/08/03