This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Limited regex support in newlib cripples syntax highlighting in nano


Cygwin regex.h implementation doesn't support some special sequences,
for example \< (beginning of word), \> (end of word) and \b (word
boundary). This causes a usability bug with the nano editor, which
uses these sequences extensively in most of its syntax highlighting
rules. For example, in /usr/share/nano/c.nanorc, one of the rules goes
like this:
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
\< and \> are used so that other words, e.g. 'fifo', 'elsewhere',
'undo' don't match, as they aren't keywords.

Test case 1:
Open nano and write a test message, for example "if a fifo is full".
Do a regexp search (using ^W M-R) for "\<if\>". No matches will be
found, because \< and \> don't have their special meaning and simply
match the characters < and >.

Test case 2:
To include C syntax rules, do: echo 'include
"/usr/share/nano/c.nanorc"' >> ~/.nanorc
Open a C source file in nano. Enable syntax highlighting with M-Y.
Strings and preprocessor instructions are highlighted (because those
rules don't contain \< \>), but keywords (e.g. if, for, return)
aren't.

I tested both nano 2.0.6 (currently in cygwin) and 2.0.7 (latest
stable version, compiled manually from source). The problem wasn't
present in Linux glibc nano 2.0.7. When I found out that Cygwin uses
newlib instead of glibc, it led me to believe that insufficient regex
support in newlib might be the cause.

I attached the output of cygcheck -s -r -v, but I doubt this is a
problem with my system configuration.

Thank you for your time reading this.
Tomi Belan

Attachment: cygcheck.out
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]