CH> If the user does want to search for a regular expression, the problem remains.
CH> For example, while typing "{cat}|{dog}", the list goes empty twice.
If the user has the option activated while typing it surely could flash.
If the user has it turned off while entering the expression possibly nothing might be found,
only when he turns it on the regex takes place and may find something.
But then when the option is turned on and he starts to backspace trying to correct the input
we are back at the beginning. Even if we could move the cursor to correct the input it wouldn't
help.
Right now I think I can't find a (better) solution.
It's like you said before, life would be much easier to have a way to query if the expression
is/was valid. Sadly, at this point I don't know of any way to get this information out of SAL.
--
Eckhard mailto:
or...@ewetel.net
Ihre Nachricht vom Samstag, 25. Januar 2025 13:05:
CH> Thanks for the input!
CH> That would solve a different problem, namely giving the user the option to not search for a regular expression.
CH> If the user does want to search for a regular expression, the problem remains.
CH> For example, while typing "{cat}|{dog}", the list goes empty twice.
CH> That would be flashy and not pretty but perhaps acceptable.
CH> An underlying problem comes from the requirement to remain as near as possible to each previous current line.
CH> For that it would help to know if the lFind failed on an illegal regular expression like "{" or on not finding cats or dogs.
CH> Carlo
CH> -----Original Message-----
CH> From:
sem...@googlegroups.com <
sem...@googlegroups.com> On Behalf Of Eckhard Hillmann
CH> Sent: Saturday, January 25, 2025 11:50 AM
CH> To: Carlo Hogeveen <
sem...@googlegroups.com>
CH> Subject: Re: [TSE] lFind difference between a regexp error and not finding anything
CH> Hi Carlo,
CH> could it be an option to do it like isrch.s does,
CH> what I mean is make the search options switchable?
CH> Just the first thought that crossed my mind...
CH> --
CH> Best regards
CH> Eckhard mailto:
or...@ewetel.net
CH> Ihre Nachricht vom Samstag, 25. Januar 2025 11:21:
CH>> I have a macro programming problem that does have a laborious solution, but I am hoping/looking for a better one.
CH>> Context:
CH>> The eList macro shows the current buffer as a list, and shrinks the list each time the user types another character.
CH>> The typed characters are treated as a regular expression to search and shrink the list.
CH>> Some regular expressions justly find nothing, and eList should show an empty list.
CH>> But a half-typed regular expression can be illegal and therefore find nothing:
CH>> eList should not shrink the list but do nothing until the user finishes typing the regular expression.
CH>> Problem:
CH>> In the macro language there seems to be no way to distinguish between the lFind command getting an illegal regular expression and
CH>> justly finding nothing.
CH>> Both return 0, which is correct, and must remain so for backwards compatibility.
CH>> Laborious solution:
CH>> I could write a procedure that checks whether the search-string is a valid regular expression.
CH>> A further disadvantage would be, that this would make eList larger, and eList is also intended to be includable in other macros.
CH>> I have not been able to come up with a way around this.
CH>> For example, TSE does not have a queryable errorlevel or ErrorState that I am aware of.
CH>> That said, it cannot hurt to ask, so, is there a better solution?
CH>> Carlo
CH> --
CH> ---
CH> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
CH> To unsubscribe from this group and stop receiving emails from it, send an email to
semware+u...@googlegroups.com.
CH> To view this discussion visit
https://groups.google.com/d/msgid/semware/879451821.20250125114937%40ewetel.net.