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

Find/replace highlighting keeps coming back up after find prompt closed #6975

Open
James-Huffman opened this issue Jul 21, 2023 · 3 comments
Labels

Comments

@James-Huffman
Copy link

Description

Highlighting for find/replace in text editor comes back unexpectedly after closing find interface and typing additional text.
Screenshot 2023-07-21 130935
Screenshot 2023-07-21 131004

Reproduce

  1. Open a text document in jupyter notebook.
  2. Ctrl-f or use Edit -> Find... to open the find prompt.
  3. Type string you want to find
  4. Press enter to highlight matching cases in your document
  5. Press esc to close the find interface
  6. Type any new character - the find highlighting will reappear despite the closed interface.

This seems to only affect the text editor, not find/replace behavior within jupyter notebook cells.

Highlighting is resolved by clearing the find query before closing the find/replace interface.

Expected behavior

Text should remain unhighlighted until the find/replace interface is re-opened.

Context

  • Operating System and version: Windows 10 Enterprise
  • Browser and version: Chrome 114.0.5735.199
  • Jupyter Notebook version: 7.0.0
Troubleshoot Output
[troubleshoot.txt](https://github.com/jupyter/notebook/files/12131167/troubleshoot.txt)
Command Line Output
[command_line.txt](https://github.com/jupyter/notebook/files/12131168/command_line.txt)
Browser Output
No output.
@James-Huffman James-Huffman added bug status:Needs Triage Applied to issues that need triage labels Jul 21, 2023
@James-Huffman
Copy link
Author

James-Huffman commented Jul 21, 2023

Based on more research, this probably belongs as a bug report for /jupyterlab since it appears that notebook implements this find/replace method from there. Based on an initial test, the same bug behavior is present in jupyterlab. I'm not sure if it's possible to move it without having to completely rewrite this...

@James-Huffman
Copy link
Author

I'm not a web developer by any stretch, so take this with a grain of salt. Here goes...

It looks like what get implemented is a searchprovider class from /jupyterlab/packages/documentsearch/src/searchprovider/.ts This is itself an extension of the search provider class from /jupyterlab/packages/codemirror/src/searchprovider.ts.

In order to allow for search in a cell by cell manner in a notebook, this second class has the attribute isActive. This gets checked by the updateCodeMirror method(ln 448). If the query value is set and isActive is true, all matches are highlighted (ln 471). I suspect this bug comes from isActive not being properly handled for File Editor vs how it is handled Notebook on a cell by cell basis.

Again, I don't do web design, so I'm not familiar with these languages. This was my best effort to track down what might be causing this. Hopefully this gives someone a good starting point.

@JasonWeill
Copy link
Collaborator

This will likely be fixed as a result of fixing jupyterlab/jupyterlab#14871, filed by the same author. Thank you for your contribution!

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

No branches or pull requests

2 participants