Page 1 of 1

Regexp Search-replace causes TextPad lockup.

Posted: Sun Apr 17, 2011 8:29 pm
by sosimple
I searched the TextPad forums and I found no mention of this issue.

I was thinking this should really be reported as a bug, but I thought I would put it up for here first in case this has already been discussed.

Later I will report it here as a bug if it seems appropriate:
http://www.textpad.com/support/textpad.php

The issue is this...
Badly-formed (perhaps invalid) and less-than-optimal (but still valid) Regexp search/replace scenarios can lockup TextPad requiring the process to be killed and resulting in lost document edits.

I have had this happen a few times, but couldn't explain it until now.

The simplest example is this:
1) Search for a single question mark.
2) Replace with "Nothing" (delete).
3) Conditions:
(x) Text
[x] Regular expression
4) Scope:
(x) Active document
or (x) Selected text
3) Click "Replace All"
--> TextPad locks-up and must be killed.

This happened to me because I was doing plain text (not-Regexp)search/replace for "?" and at some point did a Regexp search/replace then returned to the plain-text search/replace but I forgot to un-check "Regular expression" ... oops.

But I would still consider this a bug, because a single ? is invalid as a regular expression search phrase and TextPad should have given an "Invalid Regular expression" pop-up instead of proceeding with the operation.

In any case, even valid regular expressions can result in TextPad locking-up.

I understand it is somewhat of a tough problem to address but there are a lot of things that can be done to prevent lockups.

For example, if a search operation results in a match-replace but the file is unchanged, this can be detected... And if this happens continuously, say 1-million times (or something reasonable) then call it an error and prompt the user to continue or abort.

Similarly, this could be done with a timer or other methods.

Or, how about checking the "cancel" button on the search-replace dialog once in a while to see if someone has clicked it ?

Kevin

Posted: Sun Apr 17, 2011 10:18 pm
by ben_josephs
I can reproduce this, and I agree it's a bug. As you say, a solitary ? is not a regular expression. However, I can stop the replacement simply by typing <Esc>.

TextPad 5.4.2, Windows XP.