Tue 22 Mar 2016 10:43:06 AM UTC, comment #13:
Fixed in SVN, r5759.
Thanks for the patch.
|
Mon 21 Mar 2016 07:21:54 AM UTC, comment #12:
Another version of the patch, as discussed in the mailing list
(file #36707)
|
Sun 13 Mar 2016 09:41:52 PM UTC, comment #11:
Yes. And here's the patch against trunk (rev.5734).
Again, not only does the REG_ENHANCED flag avoid unnecessary fixbounds() calls, but also unlocks a ton of other features like \b, \w, \d, and many more. Those are only available in enhanced mode on Mac OS.
Actually, the bug report title falls short on that fact.
(file #36625)
|
Sun 13 Mar 2016 07:48:00 PM UTC, comment #10:
The partial fix was applied to SVN, r5731.
So... if I understand, you want ./configure on a Mac to detect that GNU word bounds are supported, so that fixbounds() becomes a no-op instead of a somewhat expensive and unnecessary substitution function?
If so, I will need an updated version of your patch, because things have changed a bit in SVN (something that I planned to do for a while).
|
Sat 12 Mar 2016 07:41:02 PM UTC, comment #9:
Yes, I am the original poster. Comment #2 is from someone else, but I agree with him ;)
The reason that I moved the detection to the autoconf file is that the GNU_WORDBOUNDS detection (line 604/624 in configure.ac before/after patching) relies on extended regular expressions.
For things to work as intended, NANO_REG_EXTENDED must be used there too, instead of REG_EXTENDED. In order to avoid duplicate code there, I decided to store the correct flag to a SH variable.
|
Sat 12 Mar 2016 04:34:39 PM UTC, comment #8:
@Thomas
Okay, so the one-line patch would fix the issue with \< and \> not working in Search on non-GNU machines. Then I will apply that as a separate patch, as a clear bug fix.
The second part of this bug is that you request REG_ENHANCED support on Macs. :) Okay. But... why isn't the #ifdef that was proposed in the beginning not enough? Why must things be detected through ./configure?
BTW, you are the original poster of this bug, Thomas?
|
Sat 12 Mar 2016 11:51:48 AM UTC, comment #7:
> if REG_EXTENDED is used
That should be "if REG_ENHANCED is used"
|
Sat 12 Mar 2016 11:39:45 AM UTC, comment #6:
@Benno
Your patch works, but it does not really fix the issue. The point is, Mac supports \< and \> just fine if REG_EXTENDED is used. Additionally, that flag provides features like lazy matching etc.
However, your fix is fine for other systems (not GNU, not Mac).
The reason why my first fix didn't work is I forgot to include regex.h before the check. How embarassing.
Please see the improved patch, which now works fine on my machine.
(file #36609)
|
Sun 06 Mar 2016 12:56:46 PM UTC, comment #5:
Aaah. You cannot use \< and \> on a Mac. You would have to use [[:<:]] and [[:>:]] instead. (Yes, I know, untypable.) That's why fixbounds() translates the first two to the latter two in the defined syntaxes. But when you type regexes at the search prompt, you will have to type the complicated expressions yourself.
Maybe nano should call fixbounds() on those typed strings too? Please try the attached patch. Then you should be able to use \< and \> (after turning regexes on with M-R).
(file #36558)
|
Sun 06 Mar 2016 08:06:31 AM UTC, comment #4:
The search is still broken. Actually, syntax highlighting works just fine, even without the patch, when nano is compiled on the Mac.
Apparently this has something to do with fixbounds() in utils.c, which depends on GNU_WORDBOUNDS, set in configure.ac.
Not sure if I fully understand what exactly is going on there, but it looks some sort of feature detection.
|
Fri 04 Mar 2016 12:19:06 PM UTC, comment #3:
Can you try attached patch (against nano-2.5.3)?
(file #36547)
|
Fri 04 Mar 2016 03:59:06 AM UTC, comment #2:
Benno: Yes that's right, the syntax colorings do not work on Mac and \< and \> are interpreted as the literals < and >.
|
Thu 03 Mar 2016 08:28:56 PM UTC, comment #1:
(For \< not working properly anyhow, see bug #45630.)
Adding the proposed #ifdef should be possible, but... if OS X needs REG_ENHANCED to see \< and \> as word boundaries, doesn't that mean that several of the syntax colorings aren't working on Macs? As what does OS X interpret a \> when REG_ENHANCED is not given? As a literal >?
|
Wed 02 Mar 2016 11:46:42 PM UTC, original submission:
I know that nano uses the OS's regex engine with the REG_EXTENDED flag passed. Mac OS X additionally requires the REG_ENHANCED flag to provide all features.
In addition to \< and \>, those features include \b,\B,\d,\D,\s,\S,\w,\W, +?, *?, and more.
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/re_format.7.html
Since grep uses REG_ENHANCED, it is a pain to write regexes for nano, because there's a lot of trial and error involved
Would it be possible to include this flag? Something like
#if defined REG_ENHANCED
REG_EXTENDED | REG_ENHANCED
#else
REG_EXTENDED
#endif
|