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

gg and G no longer working in jupyterlab 4.1.0 #134

Closed
lukashergt opened this issue Feb 5, 2024 · 14 comments · Fixed by jupyterlab/jupyterlab#15762, #135 or #137
Closed

gg and G no longer working in jupyterlab 4.1.0 #134

lukashergt opened this issue Feb 5, 2024 · 14 comments · Fixed by jupyterlab/jupyterlab#15762, #135 or #137
Labels
bug Something isn't working

Comments

@lukashergt
Copy link

Description

After updating from jupyterlab 4.0.11 to jupyterlab 4.1.0, the commands gg and G to navigate to the top/bottom cell of the notebook in jupyter mode no longer seem to work. Going back to jupyterlab 4.0.11 both gg and G work as expected.

Can anybody else confirm this?

Context

  • Python version: 3.12.1
  • jupyterlab-vim version: 4.1.0
  • Operating System and its version: Linux Manjaro
  • Browser and its version: Firefox 122.0-1
@lukashergt lukashergt added the bug Something isn't working label Feb 5, 2024
@ianhi
Copy link
Collaborator

ianhi commented Feb 6, 2024

edit: I was able to replicate i misread the issue at first


I was not able to replicate on:

python : 3.12.1
jupyterlab-vim: 4.1.0
jupyterlab : 4.1.0
firefox: 112 (on linux)

Was this in a totally fresh environment?

@lukashergt
Copy link
Author

I was not able to replicate on:

python : 3.12.1
jupyterlab-vim: 4.1.0
jupyterlab : 4.1.0
firefox: 112 (on linux)

Huh, weird.

Was this in a totally fresh environment?

Yes, new virtualenv...

@lukashergt
Copy link
Author

I tried again with a fresh virtualenv of python version 3.11.5. Same thing, gg and G work in jupyterlab==4.0.11, but do not work in jupyterlab==4.1.0...

@petergthatsme
Copy link

I can confirm, and for me other shortcuts stopped working in 4.1.0 as well e.g,. shift+O.
I downgraded to 4.0.11 for now, and things are ok.
thx.

@ianhi
Copy link
Collaborator

ianhi commented Feb 6, 2024

ahhh sorry i misread the original issue, i thought you were talking about inside of a cell. I agree I see the same

@ianhi
Copy link
Collaborator

ianhi commented Feb 6, 2024

@krassowski
Copy link
Collaborator

Yes, but JupyterLab 4.1 was supposed to handle the transition by transparent substitution in the background. I must have missed some selectors, sorry 🤦

@krassowski
Copy link
Collaborator

So jupyterlab/jupyterlab#15639 should have caught .jp-Notebook:focus usage as in:

{
"selector": ".jp-NotebookPanel[data-jp-vim-mode='true'] .jp-Notebook:focus",
"keys": ["G", "G"],
"command": "vim:select-first-cell"
},

@krassowski
Copy link
Collaborator

Ok, the selector substitution rules are good but only first shortcut gets fixed (for me Y Y):

image

instead there is a bug in the logic in:

if (
  oldSelector.includes(change.old) &&
  !selectorsAlreadyWarnedAbout.has(oldSelector)
) {
  newSelector = oldSelector.replace(change.old, change.new);
  selectorDeprecationWarnings.add(
    `"${change.old}" was replaced with "${change.new}" in ${change.versionDeprecated} (present in "${oldSelector}")`
  );
  selectorsAlreadyWarnedAbout.add(oldSelector);
}

selectorsAlreadyWarnedAbout should not be checked in the outer if as it skips subsequent shortcuts. I will open a PR against JupyterLab,

@krassowski
Copy link
Collaborator

This is getting fixed in:

reviews for both pull requests would be greatly appreciated!

@ianhi ianhi closed this as completed in #135 Feb 7, 2024
@lukashergt
Copy link
Author

I can confirm that with #135 gg and G now jump to the top and bottom cell of the notebook, respectively.

However, it seems the view does not jump. For example, if I am at the bottom of the notebook viewing the bottom cell which is currently highlighted, and I then press gg, then the highlight vanishes (and presumably jumps to the top cell), but I am still looking at the bottom cell. Only after pressing j or k or zz (at least twice actually...) does the view follow and jump to the selected cell...

@ianhi ianhi pinned this issue Feb 7, 2024
@krassowski
Copy link
Collaborator

Thank you @ianhi for the quick release and @lukashergt for testing. The scroller node has also changed in lab 4.1 (https://jupyterlab.readthedocs.io/en/latest/extension/extension_migration.html#css-class-name-change-in-the-windowedlist-superclass-of-staticnotebook), and instead of using the public API of notebook, this extension was doing scrolling manually:

if (content.activeCell !== null) {
ElementExt.scrollIntoViewIfNeeded(
content.node,
content.activeCell.node
);
}

I can take a look tomorrow.

@krassowski krassowski reopened this Feb 7, 2024
@ianhi
Copy link
Collaborator

ianhi commented Feb 7, 2024

ahhh sorry I didn't catch this. I did not make enough cells in my test notebook to trigger scrolling. I will add that to my mental checklist of things to check.

@lukashergt
Copy link
Author

Wow, completely resolved as far as I can tell, thanks for these quick fixes @krassowski, @ianhi!

@firai firai unpinned this issue Jul 10, 2024
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
4 participants