Unexpected behavior for Search/Replace

When doing a search and replace there are a couple of quirks that I find annoying and don't seem to be the expected behavior. They sort of seem related to this issue that was reported for WebStorm, but aren't exactly the same. I primarily notice the issue (but may be present otherwise) when performing a search and replace in a selection. There are 2 issues that happen.

First, if the search and replace box is already open, but I press ctrl+r to try to jump to the box to enter text it will kill my selection and move the cursor to some random place in my file. (It is suggested in the WebStorm bug that this location is a previous search point, although I am not 100% convinced of that). This is incredibly frustrating when my files are 1000s of lines and I have to manually go back and find the place I had selected the text.

The second case occurs when I have some selected text and the search box already has some text in it from a previous search. If I completely delete the text from the search box (using the backspace key) it will also kill my selection and move the cursor to a random place in my file. This is also incredibly frustrating.

I couldn't find one, but is this known/expected behavior or is there a bug report on this issue. I couldn't find one.

Thanks,
Reid

3 comments
Comment actions Permalink

Hi, 

I could not reproduce either issue. My steps:

1. Initial state: search box is opened, caret in the editor

2. I make selection in the editor and hit Ctrl+R

3. Result: The selected text is copied from the editor to the search box, regardless of the search box previous state (empty or not). If there was any text in the search box, it is overwritten with selection.

 

If I delete the text from the search box afterwards, the selection in the editor is dropped, but I think it's expected. I would suggest to report the issue as usability problem to the bug tracker, provide clear steps to reproduce and record a screencast or a gif to better demonstrate the issue.

0
Comment actions Permalink

Hi and thanks for the response.

After your comment I actually had a hard time reproducing the behavior I am experiencing on a fresh file and the description I gave. With a little more detail I can sort of reproduce them consistently, although there are some differences to what I see when I am in my normal workflow.

1st issue with regards to ctrl-r:

  1. Select some text.
  2. Make a search and replace (with in selection checked).
  3. Deselect the text in the editor, but keep the search and replace tool open and unaltered.
  4. Select some other text in the editor (that has the same search word in it).
  5. Hit ctrl-r
  6. The current selection is killed, the cursor is moved to the start of the previous selection, and the previous selection is now unexpectedly re-selected.

In this case I definitely would not expect the current selection to disappear and the old selection to reappear. When I am in my normal workflow the current selection disappears and the cursor jumps, but it does not always seem to be the previous selection nor does the previous selection get highlighted (although I am not really keeping track so it could be).

2nd issue when clearing the search box:

  1. Select some text.
  2. Make a search and replace (with in selection checked).
  3. Deselect the text.
  4. Select some other text.
  5. Click on the open search box and delete the current text (either one character at a time or all at once).
  6. The current selection is killed and the previous lines are now unexpectedly selected (same as above).

In my normal workflow I also notice that it doesn't always seem to highlight the old selection and where the cursor jumps to does not seem as predictable, but again I haven't been keeping close track, so maybe.

On the other hand, this one is a little more understandable (I think). The editor appears to be trying to do a search every time a character changes in the search input, so when it gets completely cleared it is probably searching for an empty character or something like that. It scans the selection and can't find it so it clears the selection. However, there are two issues. 1) It's strange that it re-highlights the old selection. 2) Often I want to start with a new search criteria, so starting by clearing the old one is natural to me. I wouldn't expect that to kill my selection.

Anyway I'll file my observations in the bug tracker as a usability issue. Thanks again.

0
Comment actions Permalink

I couldn't reproduce the first case, but reproduced the second one. You are right to report this as usability issue to bug tracker, but when you do, please record a screencast or gif demonstrating both issues.

0

Please sign in to leave a comment.