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

Esc key does not exit insert mode in notebooks opened from file browser or launcher #94

Closed
firai opened this issue Aug 1, 2023 · 7 comments · Fixed by #95
Closed

Esc key does not exit insert mode in notebooks opened from file browser or launcher #94

firai opened this issue Aug 1, 2023 · 7 comments · Fixed by #95
Labels
bug Something isn't working

Comments

@firai
Copy link
Collaborator

firai commented Aug 1, 2023

Description

After entering insert mode from a notebook opened from the file browser or launcher, pressing Esc does not exit out of insert mode. Instead, it fires a "Cannot execute key binding 'Escape': command 'documentsearch:end' is not enabled." warning (see console log at bottom).

If the notebook is already opened when the JL page is refreshed, Esc exits out of insert mode as expected. In this case, pressing Esc in normal mode fires the warning above, without apparent user-facing side effects.

Ctrl+] is able to exit insert mode as a workaround.

I'm wondering if this has something to do with #90... @krassowski, do you know if this is expected to resolve itself when JL 4.1 is released?

Context

  • Jupyterlab-vim 4.0.0
  • Jupyterlab 4.0.3
  • Operating System and its version: Windows 11
  • Browser and its version: Firefox 115 and Microsoft Edge 115
Console log
Language pack 'English_United States' not valid! [jlab_core.0faecc546c73b7263d33.js:1:1441965](http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33)
Uncaught (in promise) Error: Editor not available
    modifyEditor http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6:1
    updateLastActive http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6:1
    x http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6:1
    activate http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6:1
    promise callback*activate http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6:1
    promise http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33:1
    promise callback*activatePlugin http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33:1
    i http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33:1
    start http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33:1
    K http://localhost:8888/static/lab/812.b5f86ce00b402f3e2056.js?v=b5f86ce00b402f3e2056:1
    e http://localhost:8888/static/lab/main.2e96fbfd279ab7fd7ade.js?v=2e96fbfd279ab7fd7ade:1
    37559 http://localhost:8888/static/lab/main.2e96fbfd279ab7fd7ade.js?v=2e96fbfd279ab7fd7ade:1
    t http://localhost:8888/static/lab/main.2e96fbfd279ab7fd7ade.js?v=2e96fbfd279ab7fd7ade:1
     http://localhost:8888/static/lab/main.2e96fbfd279ab7fd7ade.js?v=2e96fbfd279ab7fd7ade:1
     http://localhost:8888/static/lab/main.2e96fbfd279ab7fd7ade.js?v=2e96fbfd279ab7fd7ade:1
[353.8b609c372dc07b2baac6.js:1:547](http://localhost:8888/lab/extensions/@axlair/jupyterlab_vim/static/353.8b609c372dc07b2baac6.js?v=8b609c372dc07b2baac6)
Cannot execute key binding 'Escape': command 'documentsearch:end' is not enabled. [jlab_core.0faecc546c73b7263d33.js:1:1608961](http://localhost:8888/static/lab/jlab_core.0faecc546c73b7263d33.js?v=0faecc546c73b7263d33)
@firai firai added the bug Something isn't working label Aug 1, 2023
@krassowski
Copy link
Collaborator

do you know if this is expected to resolve itself when JL 4.1 is released?

Yes, but the goal is to have this extension work without bugs until then so we need to fix it ;) As mentioned in #90 the search shortcut is problematic as it takes precedence. It is no longer the case in JupyterLab 4.1 alpha. We could try to backport a fix but it involves changing shortcuts and does not really belong in a patch release.

In #90 I worked around the issue for file editors by adding a shortcut with higher precedence (which relies on some lumino implementation detail and DOM hierarchy). Something like:

{
  "command": "vim:enter-normal-mode",
  "keys": ["Escape"],
  "selector": ".jp-Notebook"
},

for notebook may do. Can you confirm if this helps?

@firai
Copy link
Collaborator Author

firai commented Aug 1, 2023

{
  "command": "vim:enter-normal-mode",
  "keys": ["Escape"],
  "selector": ".jp-Notebook"
},

for notebook may do. Can you confirm if this helps?

Yes, this seems to work. Thanks for the quick response! Can you add a PR then?

@firai
Copy link
Collaborator Author

firai commented Aug 1, 2023

Upon further testing, it seems like at least some command mode shortcuts, i.e., those starting with Ctrl+O, seem to also be borked in version 4.0.0, presumably after #90 was merged. I don't know if whether it's related or a separate issue that I should open a separate ticket for.

@krassowski
Copy link
Collaborator

Can you confirm that #95 fixes both issues?

@firai
Copy link
Collaborator Author

firai commented Aug 1, 2023

Yes. Thanks!

@ianhi ianhi closed this as completed in #95 Aug 1, 2023
@ianhi ianhi pinned this issue Aug 1, 2023
@ianhi
Copy link
Collaborator

ianhi commented Aug 1, 2023

Should be fixed in the latest release. and hopefully this release will also work on conda-forge as well

@firai
Copy link
Collaborator Author

firai commented Oct 1, 2023

Hi @ianhi, I think this can be unpinned now. What do you think?

@firai firai unpinned this issue Oct 4, 2023
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
Development

Successfully merging a pull request may close this issue.

3 participants