Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of Shift+F7 and Alt+F7 in Viewer and Editor #600

Closed
MKadaner opened this issue Jan 8, 2023 · 9 comments
Closed

Behavior of Shift+F7 and Alt+F7 in Viewer and Editor #600

MKadaner opened this issue Jan 8, 2023 · 9 comments
Assignees

Comments

@MKadaner
Copy link
Contributor

MKadaner commented Jan 8, 2023

Description of the new feature or improvement

Currently, the search direction of Shift+F7 and Alt+F7 depends on the "Reverse search" option of the Search dialog, viz.

  • Shift+F7 continues searching in the direction set in the Search dialog.
  • Alt+F7 continues searching in the direction opposite to that set in the Search dialog.

Somehow, this behavior confuses me to no end. In fact, because of this behavior, I never check "Reverse search" checkbox in the dialog, and use Shift+F7 and Alt+F7 hotkeys as if they search in the absolute direction, no matter the dialog option:

  • Shift+F7 continues searching forward.
  • Alt+F7 continues searching backward.

This effectively means that if I want to search backward, towards the beginning of the file, I open the dialog, leave "Reverse search" checkbox unchecked, press "Enter" and as soon as the next pattern is found, press Alt+F7 to find the previous pattern. I then proceed pressing Alt+F7 if I want to continue searching.

I would like to have a global "far:config" parameter controlling this behavior. By default (false), the current behavior is used. If the parameter is set to true, the new behavior is activated. The parameter could be called something like "SearchContinueAbsoluteDirection".

Proposed technical implementation details (optional)

Though Editor / Viewer search implementation is a bit tricky, I think I can do this feature. Any objections?

@alabuzhev
Copy link
Contributor

If the parameter is set to true, the new behavior is activated

So what exactly the new behavior should be?
Shift+F7 always forward and Alt+F7 always backward, [x] Reverse search affects only F7 Enter?

@MKadaner
Copy link
Contributor Author

MKadaner commented Jan 8, 2023

That is correct. [x] Reverse search becomes somewhat less useful. I would use it in a scenario where I am in the middle of a large log (think millions of lines) looking for something relatively rare, just a few occurrences. I know that the place of interest is above the current position--I want to find the instance of this something which happened before here, where I am observing the consequences. If I F7, [ ] Reverse search, Enter, as I usually do, I first jump forward to an undefined and irrelevant position and risk losing the context of my operation. Sometimes, I literally close my eyes before pressing Enter and immediately press Alt+F7.

The current behavior is especially vexing in a situation when I was tracking something for some time jumping back and forth multiple times with Shift+F7 / Alt+F7, then did something else, maybe even switched to another task, then want to find the next occurrence in a certain direction. I know that the search string is still what I am looking for, but I absolutely cannot remember what the value of Reverse search was. I should either open the dialog again only to set the right search direction, or continue searching with 50% chance of getting to a wrong place.

@alabuzhev
Copy link
Contributor

alabuzhev commented Jan 8, 2023

It is confusing indeed. I also never use the checkbox and either press enter and then Alt+F7 or jump to the beginning before searching.

I'm not a big fan of new far:config options though, maybe we can do it without them?

A couple of alternative solutions:

  • Automatically uncheck the [x] Reverse search when the dialog is closed.
    The initial direction depends on the checkbox, afterwards Shift+F7 searches forward, Alt+F7 - backward.
  • Remove the checkbox and replace the { Search } button with { Search down } [ Search up ].
    The initial direction depends on the pressed button, afterwards Shift+F7 searches forward, Alt+F7 - backward.

@MKadaner
Copy link
Contributor Author

MKadaner commented Jan 8, 2023

Of the two solutions, I certainly prefer the latter, with two buttons. Auto-clearing [x] Reverse search will be also confusing. Most other dialog options in many dialogs are preserved between dialog invocations.

Let me finish Text / Hex controls on the standard search dialog, then I will implement { Search down } [ Search up ] buttons on it (if there are no better ideas by that time).

By the way, how about something like this:

{ ⇓ Search ⇓ } [ ⇑ Search ⇑ ]

with the hotkeys Alt+Down and Alt+Up respectfully?

@alabuzhev
Copy link
Contributor

I'd probably prefer the latter too as more obvious.

{ ⇓ Search ⇓ } [ ⇑ Search ⇑ ]

This probably will be unreadable with raster fonts (yes, there are people who still use them for some reason).

@MKadaner
Copy link
Contributor Author

MKadaner commented Jan 8, 2023

there are people who still use [raster fonts]

Ugh!

The words it is! Less hassle implementing non-standard behavior.

@HamRusTal
Copy link
Contributor

HamRusTal commented Jan 9, 2023

Remove the checkbox and replace the { Search } button with { Search down } [ Search up ].

I'm definitely for this solution. And plain words are better than fancy symbols as words are easier to communicate to another person. To avoid the up/down metaphor, we might use the forward/backward pair.

@rohitab
Copy link
Contributor

rohitab commented Jan 9, 2023

Remove the checkbox and replace the { Search } button with { Search down } [ Search up ].
The initial direction depends on the pressed button, afterwards Shift+F7 searches forward, Alt+F7 - backward.

This is definitely more user-friendly, and similar to how it's implemented in other editors, like Visual Studio.

@MKadaner
Copy link
Contributor Author

@alabuzhev, assign this one to me please.

MKadaner added a commit to MKadaner/FarManager that referenced this issue Feb 20, 2023
Also, on the Search / Replace dialog, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 3, 2023
Also, on the Search / Replace dialog, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 4, 2023
Also, on the Search / Replace dialog, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 5, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 5, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 5, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 5, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 5, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 8, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
MKadaner added a commit to MKadaner/FarManager that referenced this issue Mar 8, 2023
… (down or up respectfully)

instead of reversing the direction defined by the last invocation of the Search / Replace dialog.
Also, on the dialog itself, replaced "Reverse" checkbox with "Search Down / Up" buttons.
alabuzhev added a commit that referenced this issue Mar 8, 2023
gh-600: Shift+F7 and Alt+F7 now search in absolute directions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants