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

Opening text editor after notebook causes normal mode j & k in cells to be stuck within a cell #103

Closed
firai opened this issue Aug 4, 2023 · 5 comments · Fixed by #105
Closed
Labels
bug Something isn't working

Comments

@firai
Copy link
Collaborator

firai commented Aug 4, 2023

Description

If a file editor is opened after opening notebooks, when I switch back to a notebook, j and k in normal mode aren't able to move between cells if I enter normal mode directly in the first cell that has focus. That is, it appears to cause j and k to be unbound from moveByLinesOrCell. Escaping to command mode and moving to another cell appears to fix the binding.

Reproduce

  1. Open or create a notebook with multiple cells
  2. Open or create a file-editor-type document (text, Markdown or code)
  3. Switch back to the notebook
  4. Enter normal mode in the first cell that has focus
  5. Navigate to the edges of the cell with j or k and try to move beyond the edges

Expected behavior

Opening file editors should not affect the behavior in notebooks

Context

  • JupyterLab package version: 4.0.4
  • Extension version: 4.0.1
  • Operating System and its version: Windows 11
  • Browser and its version: Firefox 115
@firai firai added the bug Something isn't working label Aug 4, 2023
@firai
Copy link
Collaborator Author

firai commented Aug 4, 2023

By the way, I hit this while trying to develop a setting that would allow j and k to be remapped to gj and gk-type behavior but have the ability to cross cell boundaries. The proof of concept generally works for notebooks, but opening a file editor causes regular j and k to take over (at least until I move between cells in command mode in a notebook).

@krassowski
Copy link
Collaborator

We need to invoke modifyCell method after switching active widget of the shell (if the new widget is a notebook). For now we are only listening to cell changes. Should be easy to fix.

@firai
Copy link
Collaborator Author

firai commented Aug 4, 2023

Thanks for the quick response! I'm also hitting a quirk where j or k pressed at the bottom or top of file editors, respectively, moves the cursor to a notebook tab if the notebook was the last active tab (as opposed to another file editor). Does that sound like a related issue or should I open another issue for this?

@ianhi
Copy link
Collaborator

ianhi commented Aug 4, 2023

if the notebook was the last active tab (as opposed to another file editor). Does that sound like a related issue or should I open another issue for this?

I think that that is this oldish issue: #15

@firai
Copy link
Collaborator Author

firai commented Aug 4, 2023

if the notebook was the last active tab (as opposed to another file editor). Does that sound like a related issue or should I open another issue for this?

I think that that is this oldish issue: #15

Thanks for the heads up! I didn't see that one. Good that I checked before opening another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants