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

Add First/Last button to Search dialog #603

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

windymilla
Copy link
Collaborator

The First/Last button finds the first occurrence of the string in the file if searching forwards, and the last occurrence if searching backwards.

Note that searching backwards can be done by turning on "Reverse" checkbox. The currently selected value of "Reverse" is itself reversed if the First/Last button is Shift clicked, just like the Search button.

So, if "Reverse" is off, click First/Last for the first match, shift-click it for last match. If "Reverse" is on, click First/Last for last match and shift-click it for first match.

Since this behavior is identical to the Search button behavior, it should be intuitive to the user. If not, they don't need to use the Shift key and can just use the Reverse checkbox.

The First/Last button finds the first occurrence of the string
in the file if searching forwards, and the last occurrence if
searching backwards.

Note that searching backwards can be done by turning on
"Reverse" checkbox. The currently selected value of
"Reverse" is itself reversed if the First/Last button is Shift
clicked, just like the Search button.

So, if "Reverse" is off, click First/Last for the first match,
shift-click it for last match. If "Reverse" is on, click
First/Last for last match and shift-click it for first match.

Since this behavior is identical to the Search button behavior,
it should be intuitive to the user. If not, they don't need to
use the Shift key and can just use the Reverse checkbox.
Copy link
Member

@srjfoo srjfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work just fine.

Personal opinion, only: I honestly don't see a need for it. It's a one-button shortcut for home/end (cmd+up/down arrow) plus find again. I'm far from a minimalist, but I'd rather limit the clutter until we need something. So, it's something of a design philosophy, I guess. You've got users wanting it because they had it before, and it's always harder to take something away than it is to not implement it in the first place.

Copy link
Collaborator

@tangledhelix tangledhelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reading the forums I'll have to disagree with Sharon's review. It seems to be something the users want.

However, as implemented I find it confusing. Reading your explanation I understand how it works, but my 2¢ is it would be better simplified:

  • Label the button "First"
  • On click, it goes to the first match
  • No shift-click binding

I could see that if Reverse is checked, going to Last instead could make sense. Is it possible to make the label on the button reactive to the state of the Reverse checkbox, such that if Reverse is checked, the label is Last, but otherwise it's First?

I'd be just as happy not doing that, and having a no-frills "First" button.

@srjfoo
Copy link
Member

srjfoo commented Dec 25, 2024

After reading the forums I'll have to disagree with Sharon's review. It seems to be something the users want.

Part of my review was my personal opinion, and the main reason that I'm not in favor of it is that I just don't see a real need for it -- it adds clutter, and it's not really necessary.

I've accepted that it will probably be implemented, and I hate to be the one voting against some things. My main concern is the "give a mouse a cookie" syndrome (aka "slippery slope"?). The more things like this that are implemented, the more will be requested, and the interface will be nickeled and dimed to death.

That being said, @windymilla has certainly implemented a lot of things that I've asked for, as have you.

@windymilla
Copy link
Collaborator Author

Agree with @tangledhelix that it's unnecessarily complicated (though actually simpler to implement) with the Shift-to-reverse option. I'll put up another commit that removes that feature.

1. Remove Shift-to-reverse feature.
2. Change text from "First" to "Last" if "Reverse" flag is set.
@windymilla
Copy link
Collaborator Author

Is it possible to make the label on the button reactive to the state of the Reverse checkbox, such that if Reverse is checked, the label is Last, but otherwise it's First?

My latest commit does this, and removes the Shift-to-reverse complication.

@srjfoo
Copy link
Member

srjfoo commented Dec 26, 2024

Is it possible to make the label on the button reactive to the state of the Reverse checkbox, such that if Reverse is checked, the label is Last, but otherwise it's First?

My latest commit does this, and removes the Shift-to-reverse complication.

I'm not seeing this -- it still says First/Last. I tried disabling Wrap Around and multi-replace, but those had no effect. Did I misunderstand?

edit: When I ran poetry install on this, it reverted to the previous version of astroid, but rebasing against master fixed that. I don't think that would mess up the branch, but thought I'd mention it.

Never mind -- I thought I'd fetched the latest commit, but I hadn't. Looks good to me, although I'll admit that I'm really missing the shift-for-reverse, even just for the testing. That being said, this is not likely to be something I'll use, so, I'm happy with however you think it should be implemented.

@windymilla
Copy link
Collaborator Author

I'll admit that I'm really missing the shift-for-reverse,

If a user says, "hey, I can shift-click on Search, why can't I do that on First/Last?" we can add it in a heartbeat

@windymilla windymilla merged commit fbf9797 into DistributedProofreaders:master Dec 26, 2024
1 check passed
@windymilla windymilla deleted the search-first branch December 26, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants