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 command to open find with replace #7725
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
A quick survey:
Also:
On a mac, at least, it looks like the natural shortcut would be Alt Accel F. Thoughts? |
But first, thanks for doing this! |
Interesting. I am using Windows 10 here is what I see: Wordpad: Ctrl-H |
For Google Docs on macOS/Firefox, I see Accel Shift H brings up Find (and replace happens to be possible too from the dialog). |
In 2.0, we'll have the ability to have platform-specific shortcuts. However, there is a philosophical decision - should we be consistent across platforms (like pycharm), or should we be consistent with the platform? |
I lean slightly towards platform specific hotkeys when there is a clear standard. This gives users a more "native" experience and matches what both google and msft have done. It lets us avoid using hotkeys that have meaning on one platform (e.g. Accel H to hide on mac). Where is platform decided? I run my lab on linux but my browser is windows. |
I see this was moved to milestone future. Will this not be able to make the 2.0 cut? |
It can still make it into 2.0 since it's not backwards incompatible. I think the biggest blocker at this point might be deciding the default keyboard shortcut. A way around that discussion is to take off the default keyboard shortcut for now (and users would be able to assign a custom keyboard shortcut). |
Hotkeys are a complex issue with UX implications of consistency for the app vs. the platform a user is on. Removing default hotkeys to delay this decision.
@jasongrout the hotkey has been removed. Please let me know of any other changes you'd like |
Ping @jasongrout as I am hoping to for this to make it into 2.0! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this out locally and it works as expected.
I find the diff a bit confusing on github, but looking at it locally I can see this doesn't change much. It just
- Factors out current command
isEnabled
andexecute
into new functions. - Adds a new command that uses those functions to also open the find and replace after.
I renamed those two functions to try to be more clear about their intent.
One issue is that currently if you already have the find box open, and run this command, then it will not open the replace box.
However to fix this would require a deeper refactor in how this provider is set up. It passes the whole _displayState
to the React component which then won't re-render because it just uses it for the default props, I believe and the object doesn't change.
IMHO It's a bit of a mess currently, because the Search provider thing tries to not be aware of react, so you have these two different concepts of state management fighting over each other.
When I first worked on the improved find functionality, I also found this state in two places somewhat hard to grasp. |
Thanks! |
Adds a
Accel H
command by default which opens the find box with replace expanded. This mirrors how most editors and Microsoft products work.Code changes
Refactored the find command to add a find + replace option.
User-facing changes
New default hotkey added.