FarManager icon indicating copy to clipboard operation
FarManager copied to clipboard

Find the Pattern under Caret with Reverse Search

Open MKadaner opened this issue 2 years ago • 3 comments

Description of the new feature or improvement

At some point between 3.0.5720.0 and now, the behavior of Internal Editor's reverse search changes slightly. In the olden days, if I reverse search for abc with the caret at the line abc in the position of the b or c, the pattern I am at will be found. Now it is skipped, and the previous occurrence, if exists, is found or "Could not find..." dialog is displayed.

I almost started implementing the change but happened to check the behavior of MSVC editor. Not entirely surprisingly, it also skips the pattern under the caret when searches backward. It does make some sense. After all, if I search forward, the pattern under caret is not found, and it feels quite natural. My only problem is that somehow I am fine with this behavior in VS, but expect different behavior from Far. It breaks my workflow. 🙂 Just recently, I was sorting out through a large list of long similar-looking strings and for some time could not understand why I could not find a certain string, even though I've just found it searching forward from the beginning of the file.

What is general opinion about reverting the old behavior?

Proposed technical implementation details (optional)

I can implement this change if people here think it's a good idea.

MKadaner avatar Aug 15 '22 00:08 MKadaner

@MKadaner I am fine with either behavior, as long as:

  1. it is consistent between the regular search and the regex search (looks like currently it is not)
  2. next/previous searches do not stuck, regardless of the Cursor at the end option.

P.S. I do not remember changing this intentionally. It could be accidental or an attempt to fix #⁠2.

alabuzhev avatar Aug 15 '22 01:08 alabuzhev

Thank you, @alabuzhev, I'll look at it then. (I did not even remember there was this option. 🙂)

What do you mean "stuck?" The search does not progress on repeated pressing of Shift+F7/Alt+F7?

MKadaner avatar Aug 15 '22 04:08 MKadaner

What do you mean "stuck?" The search does not progress on repeated pressing of Shift+F7/Alt+F7?

Yes, and F7 Enter.

alabuzhev avatar Aug 15 '22 17:08 alabuzhev

Please assign this issue to me. I am knee deep in search anyway.

MKadaner avatar Mar 04 '23 23:03 MKadaner

What do you mean "stuck?" The search does not progress on repeated pressing of Shift+F7/Alt+F7?

Yes, and F7 Enter.

IMHO F7 Enter should not move forward if the caret is at a match already (in a sense that this exact match should me found). And if the Cursor at the end option is off, then even the caret should not move in this case. The reason behind my opinion is that once we open a Search/Replace dialog and accept it, we initiate a brand new search that should discard any context from any previous search.

HamRusTal avatar Mar 28 '23 01:03 HamRusTal

... once we open a Search/Replace dialog and accept it, we initiate a brand new search that should discard any context from any previous search.

I think this is what I did in #651. Could you please double check and create a bug report if it doesn't work this way?

MKadaner avatar Mar 28 '23 05:03 MKadaner

create a bug report if it doesn't work this way?

I did not say it doesn't. I just expressed disagreement with the opinion of alabuzhev on the expected behavior. :) I'm glad you implemented it that way, thank you!

HamRusTal avatar Mar 29 '23 00:03 HamRusTal

Sorry, I did not presume you said that. It was a roundabout way to ask for more testing. :)

MKadaner avatar Mar 29 '23 03:03 MKadaner