Find and Replace

Discussions related to Visual Prolog
Kari Rastas
Active Member
Posts: 31
Joined: 4 Mar 2000 0:01

Find and Replace

Unread post by Kari Rastas » 24 Oct 2013 18:12

I have had for a halve year a notebook with touch screen and Windows 8. The computer has a large "hypersensitive" touchpad (difficult to find the right adjustment) which causes that sometimes the cursor "jumps to unwanted locations" if I am not careful when moving hands over the touchpad.

I have had a couple of times troubles with this VIP's Find and Replace form. Mostly I use the function to search some string in the code (= simply needing the Find "part"). Sometimes, when I believe having the focus in the window in which I happened to need the search, but the focus is still in the Find and Replace form. Then when I begin to write and press for example the letter A all the points where the search string exists are replaced with a empty string, which is the default in the replace field. If I do not notice what happened and use the undo in time it can cause confusion and rather needless extra work.

Maybe it would be worth considering in future versions using separate forms for the pure Find function and the Find/Replace function.

User avatar
Thomas Linder Puls
VIP Member
Posts: 1175
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 25 Oct 2013 13:13

Changing this dialog has proven that it is very difficult to agree on what is "best behavior" for such a dialog.

The most significant changes relating to your problem are:
  • The dialog now combines find and replace in a single dialog, and
  • it is now a modeless dialog (working on the currently active editor)
The rationale for these changes both have to do with the workflow. I think it is simplest explained through a use case: You find something in a file and decide that you want to replace it with something else. But if you have used a find dialog you cannot perform the replace, you will first have to close the find dialog and open the replace dialog (it could happen in a combined action, but at least one action is necessary). If you had used a replace dialog you could go ahead with the replace without such an action.

In effect there used to be two modes "find" and "find with replace", now there is only one mode (i.e. "find with replace").

Likewise, is it s strange workflow to have to close and reopen the dialog in order to switch its target editor, and even stranger to have to close and reopen it to copy something from an editor into it.

Leaving the dialog open makes it even more important that it doesn't have two modes "find"/"find and replace", because when it has been open for a while it is quite arbitraty, which mode it is in when you return to it. You might recognize this problem from the four other mode flags the dialog have ("regular expression", "whole words", "case sensitive" and "incremental search").

It is nice that such modes are remembered while you are in a long term complex operation involving several find and replaces, but when you start on a new operation these mode flags should nearly always be reset yo your "initial preference". Unfortunately, however, we cannot say when one long complex operation ends and the next one starts.

Leaving the dialog open (i.e. modeless) does however also have the drawback that, it can be the active even though you think it is another window that is active. With worstcase consequences like you describe.

However to invoke "Replace All" you will either have to put focus to that button and press enter, or press Alt+'a'. A plain 'a' can only go into the find or replace fields, it has no other meaning in that dialog. Alt+'a' has no binding in the editor, so that is not something you would press while editing.

It seems that you and your "hypersensitive" tuchpad does more than simply press 'a'. And it does not seem likely that people without "hypersensitivity" experience the problem by such simple actions.

While we will not change these two fundmental properties (modeless+single mode), we will however look on not leaving/having the "Replace" or "Replace All" buttons as the focus button, such that "enter" is not likely to cause problems.
Regards Thomas Linder Puls

Post Reply