Re: [code] [textadept] Regex-functionality

From: Mitchell <m.att.foicica.com>
Date: Tue, 22 May 2018 23:30:17 -0400 (EDT)

Hi Johannes,

On Mon, 21 May 2018, Mitchell wrote:

> Hi Johannes,
>
> On Sun, 20 May 2018, johannes wrote:
>
>> Hello Mitchell,
>>
>> some weeks ago I searched for a new texteditor and finally discovered
>> Textadept. Mainly because of the wide configuration possibilities and the
>> clear api-documentation. So thank you for your great work.
>>
>> My configuration efforts ended up in writing additional functions which I
>> want to pack together in an open source module. The module will include a
>> "goto_keyline" and "goto_related_keyline" functionality which should be
>> based
>> on regex pattern-matching. These functions should be working similar like
>> goto-symbol and goto definition. Therefore I wrote a function in the style
>> of
>> yours "find_in_files"-function. With this function the performance of
>> finding
>> matches seems good. Anyway, to do the proper matching, I'm missing some
>> standard regex-functionality:
>>     -   The operator for alternatives doesn't work, i.e. (foo|bar) doesn't
>> match foo
>
> This works for me when I use the Find & Replace pane with the "Regex" and "In
> Files" options selected. Can you be more specific?
>
>>     -   the search token \n doesn't detect newlines
>>     -   Whitespace \s* doesn't include newlines (\n)
>
> Yes, it looks like multi-line regex searching does not work. Thanks for the
> report.

I've looked into this and inquired[1] on the Scintilla mailing list (Scintilla is the text editing component that Textadept uses) and it looks like Scintilla does not support regex searches that include newlines. The C++11 regex standard[2] also appears to not include newline characters in character classes like `\s`. I suspect `$` will have to be sufficient unless you'd like to use the Lua API with Lua patterns. I've committed a note to the manual on this topic[3].

>
>>
>> Also I found a bug in find_in_files search:
>> -   If a find-results starts at line beginning, the result get's wrong
>> selected when cycling through the results
>
> Thanks for the report. I will look into this.

I've committed a fix for this[4].

Cheers,
Mitchell

[1]: https://groups.google.com/forum/?_escaped_fragment_=topic/scintilla-interest/9s4Yckf7wGs#!topic/scintilla-interest/9s4Yckf7wGs
[2]: http://www.cplusplus.com/reference/regex/ECMAScript/
[3]: https://foicica.com/hg/textadept/rev/dd69b151a00f
[4]: https://foicica.com/hg/textadept/rev/84baf4041048

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 22 May 2018 - 23:30:17 EDT

This archive was generated by hypermail 2.2.0 : Wed 23 May 2018 - 06:43:49 EDT