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

Search And replace. #285

Merged
merged 13 commits into from
Aug 26, 2015
Merged

Search And replace. #285

merged 13 commits into from
Aug 26, 2015

Conversation

Carreau
Copy link
Member

@Carreau Carreau commented Aug 13, 2015

On top of the command palette, and WIP.
Search and replace.
snr-2

@jdfreder
Copy link
Contributor

Awesome!

@Carreau
Copy link
Member Author

Carreau commented Aug 14, 2015

May I just scream here super loudly ?

@Carreau
Copy link
Member Author

Carreau commented Aug 14, 2015

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

    。゜(`Д´)゜。
┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻

@jdfreder
Copy link
Contributor

lol, u mad bro?

@Carreau
Copy link
Member Author

Carreau commented Aug 14, 2015

Yeahhhhh working, just need to cleanup things now....

@Carreau
Copy link
Member Author

Carreau commented Aug 14, 2015

cc @dhermes and @michaelpacer

@Carreau
Copy link
Member Author

Carreau commented Aug 14, 2015

Not working case:

def something():
  pass
^( ){1,3}(\w)
    $2

@Carreau
Copy link
Member Author

Carreau commented Aug 15, 2015

Ok, mostly ready for comments.

@ellisonbg
Copy link
Contributor

I didn't see a standard keyboard shortcut or Edit menu item for this. I know it may be difficult to find a good keyboard shortcut (maybe not) but there should definitely be an Edit menu item for this as it is a very common action.

Also, what would it take to enable this and the command pallette on the text editor page as well?

@Carreau
Copy link
Member Author

Carreau commented Aug 15, 2015

I didn't see a standard keyboard shortcut or Edit menu item for this.

We can bikeshed on that in another smaller PR.
It is "a very common action" but no-one was able to use it for the past 4 years, so it can wait a week.
I would prefer to land that and test it quick then someone can decide on icon and menu naming later.

Also, what would it take to enable this and the command palette on the text editor page as well?

What would be the point ? The command palette is made to list actions and work with a keyboard_manager which the text-editor lacks. Plus menus do not use actions, so what would be the use of the command palette?

@ellisonbg
Copy link
Contributor

I am fine merging and iterating in master. But I don't understand why you
refer to a discussion/decision about keyboard shortcuts and menu items as
bikeshedding. Do you mean that we shouldn't have the discussion?

IIRC there was a PR to add the keyboard manager to the file browser so
adding it to the text editor would also make sense? I didn't realize that
menus were not yet using actions. My logic about the commad pallette is
that as we move to a single page app where there are many different
components on a page, having a command pallette would be very useful - even
for non-notebook components.

On Sat, Aug 15, 2015 at 8:36 AM, Matthias Bussonnier <
notifications@github.com> wrote:

I didn't see a standard keyboard shortcut or Edit menu item for this.

We can bikeshed on that in another smaller PR.
It is "a very common action" but no-one was able to use it for the past 4
years, so it can wait a week.
I would prefer to land that and test it quick then someone can decide on
icon and menu naming later.

Also, what would it take to enable this and the command palette on the
text editor page as well?

What would be the point ? The command palette is made to list actions and
work with a keyboard_manager which the text-editor lacks. Plus menus do
not use actions ipython/ipython#7285, so what
would be the use of the command palette?


Reply to this email directly or view it on GitHub
#285 (comment).

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Aug 15, 2015

No bikeshedding just in the sens that people will disagree on F vs Shift-F, vs Ctrl/Cmd-Shift-F, menu naming, position in the menu, separator or not, wether is conflit on Chrome/FF/safari/Linux, and how it is not possible to trigger the search and replace on a Mac running Linux with a physical german windows keyoard configured to use a Dvorak layout.

We can have the discussion, but I don't want to introduce (too much) non-technical change in this PR.

The other thing that could go into the discussion is the tabindex position of the "Use regEx" and "case sensitive" button in the current dialog layout.

I fail to see the use on the command palette on the "tree" view, and I don't see any reason to have a keyboard_manager on the editor, as it is already "just" a full page codemirror instance that have it's own keybindings, and no concept of actions either.

Though if actions are added to the editor or tree view, I can adapt the code of the command palette to also work there, it shouldn't be too hard.

Might want to consider it as an option on the dialog maybe...
@Carreau
Copy link
Member Author

Carreau commented Aug 16, 2015

Updates to have 2 actions, replace in all notebook, or only in selected cells.

UI to replace only in selected cell, use bootstrap way of doing it.

Button order is now more keyboard friendly
@Carreau
Copy link
Member Author

Carreau commented Aug 18, 2015

Last version of the UI, with lots of though and improvement.

Search is focused by default.
Tab switch focus to Replace.

So you can easily search/replace with keyboard.

CaseSensitive / RegEx toggle are just before Search, So just a Shift-Tab Away.

I did it this way because having this after Search, or Replace was too far, or annoying. to tab 4 times to go to replace.

Case & RegEx auto focus input after toggle, which reduce the number of keypress needed.

The replace only is selected cells is just after the Replace field which make it easy to toggel just before validating.

Recap of flow, Search selected by default. Shift Tab, does of course inverse of Tab.
CaseSensitive-[tab]->RegEx Toggle
RegEx Toggle-[tab]->Search
Search-[tab]->Replace
Replace-[tab]->Only Selected toggle

Switch Case Sensitive -> Search focused.
Switch RegEx -> Search focused.
Switch only selected cell -> replace focused.

screen shot 2015-08-18 at 13 29 11

@ghost
Copy link

ghost commented Aug 19, 2015

@Carreau Super! Really happy(#261) about this + #266 = super power Jupyter notebook:) Your implementation looks very cool.

@Carreau
Copy link
Member Author

Carreau commented Aug 19, 2015

@Carreau Super! Really happy(#261) about this + #266 = super power Jupyter notebook:) Your implementation looks very cool.

Thanks.

@Carreau
Copy link
Member Author

Carreau commented Aug 26, 2015

Ping.

Otherwise I'll merge and wait for complaints.

@ellisonbg
Copy link
Contributor

+1, we know we want this, let's merge and iterate in master if we need to.

On Wed, Aug 26, 2015 at 1:52 AM, Matthias Bussonnier <
notifications@github.com> wrote:

Ping.

Otherwise I'll merge and wait for complaints.


Reply to this email directly or view it on GitHub
#285 (comment).

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Aug 26, 2015

You haven't pushed the Green Button in a while, do I leave you to do it ?

@Carreau
Copy link
Member Author

Carreau commented Aug 26, 2015

(and also why are you up so early)

ellisonbg added a commit that referenced this pull request Aug 26, 2015
@ellisonbg ellisonbg merged commit 21f63d4 into jupyter:master Aug 26, 2015
@ellisonbg
Copy link
Contributor

Merged! - woke up at 6:30 for no particular reason - my mind must have sensed my inbox filling up :)

@ellisonbg
Copy link
Contributor

any many thanks for the work on this one - super useful!

On Wed, Aug 26, 2015 at 7:31 AM, Matthias Bussonnier <
notifications@github.com> wrote:

(and also why are you up so early)


Reply to this email directly or view it on GitHub
#285 (comment).

Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com

@Carreau
Copy link
Member Author

Carreau commented Aug 26, 2015

Great !
Let me now open a PR with the keybinding, menu, and toolbar icon.

@Carreau
Copy link
Member Author

Carreau commented Aug 26, 2015

Merged! - woke up at 6:30 for no particular reason - my mind must have sensed my inbox filling up :)

:-) I can ping you on more things.

@bollwyvl
Copy link
Contributor

Hadn't even seen this! how cool.

I assume the modal is not the long-term home for this? Being able to use the search results as a navigation mechanism for long documents is really key. Currently, I think the pager answers the mail, while a phosphor panel would make long term sense...

@Carreau
Copy link
Member Author

Carreau commented Sep 16, 2015

the "Search" part is not really done, the replace mostly. I would use search through the browser it is more reliable.

@gandalfsaxe
Copy link

Sorry for my ignorance, but how do I get access to find and replace? How do I open this "Command palette" (Googling "jupiter command palette" gives me nothing useful). I could really use some find and replace functionality in my work right now where I have to rename a bunch of variables.

Regarding versions:
Clicking about in Jupiter Notebook: "The version of the notebook server is 4.0.4"
conda update jupyter: "jupyter 1.0.0 py34_0"

@minrk
Copy link
Member

minrk commented Sep 23, 2015

@gandalfsaxe this hasn't been released, so you would need to install the notebook from master, or wait for the release of 4.1.

@gandalfsaxe
Copy link

@minrk Ah fair enough. Looking forward to it 👍

@minrk minrk added this to the 4.1 milestone Sep 23, 2015
@eulerreich
Copy link

@Carreau I know you said the "search part" is not really done, but I'd love if you could implement the look ahead and look behind features of regex.

@geekan
Copy link

geekan commented Oct 8, 2015

Awesome work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants