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

j key activate "activate previously used tab" #15

Open
ghost opened this issue Nov 1, 2020 · 6 comments
Open

j key activate "activate previously used tab" #15

ghost opened this issue Nov 1, 2020 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Nov 1, 2020

j key in normal mode actions is go down line

open my.py file and my.ipynb file
select my.py tab with editor
using vim keymap, press j at last line
I got activate my.ipynb tab

But at the last line of script, pressing j key
"activate previously used tab' which is bound to " ctrl + shift + ' "
Weired behavior

@axelfahy
Copy link
Collaborator

axelfahy commented Nov 2, 2020

I can reproduce, it is indeed a weird behavior.

@ianhi
Copy link
Collaborator

ianhi commented Nov 21, 2020

oh wacky. This is because the moveByCellOrLines https://github.com/axelfahy/jupyterlab-vim/blob/c4e43f940ef4be4c961608b6192412d2f3a33d1f/src/index.ts#L85
https://github.com/axelfahy/jupyterlab-vim/blob/c4e43f940ef4be4c961608b6192412d2f3a33d1f/src/index.ts#L127-L133
doesn't check if you're in a notebook so these notebook cell switching commands get run. This means you can also get the same behavior by using k at the top of the editor.

The fix for this is to add some sort of check to that function to only run the commands if you're in a notebook, not if in the editor.

@ianhi
Copy link
Collaborator

ianhi commented Sep 6, 2023

I believe this is fixed by #105

@ianhi ianhi closed this as completed Sep 6, 2023
@ianhi
Copy link
Collaborator

ianhi commented Sep 6, 2023

wait maybe not - I think i was confused. WIll re-open until i can properly check.

@ianhi ianhi reopened this Sep 6, 2023
@firai
Copy link
Collaborator

firai commented Sep 8, 2023

It seems like this only happens now in the first file editor instance if JL is loaded/reloaded with a URL pointing to a file editor-type document, and it doesn't always reproduce. It does not seem to happen after switching tabs.

I tried to track the modify calls when JL is loaded, but I don't comprehend what's happening. When the behavior exists, the following set of calls are logged when JL is loaded/reloaded:

onActiveEditorChanged()
shell.currentChanged() -> editorTracker -> modifyEditor()
onActiveCellChanged()
shell.currentChanged() -> notebookTracker -> modifyCell()
shell.currentChanged() -> editorTracker -> modifyEditor()
onActiveCellChanged()

When it doesn't happen, the following set of calls happen when JL is loaded/reloaded:

onActiveCellChanged()
shell.currentChanged() -> notebookTracker -> modifyCell()
onActiveEditorChanged()
shell.currentChanged() -> editorTracker -> modifyEditor()
onActiveCellChanged()

I'm not sure why there are so many changed signals fired at initial load, why the matching tracker flips back and forth, why the order of how it flips changes from load to load, or how the extra flip in the former case causes this behavior. Don't know why there's always an onActiveCellChanged() call when loading file editors either.

I wonder if the shell signals should be connected to the onActive... calls to fix some sort of race condition. EDIT: That doesn't fix the issue.

@firai
Copy link
Collaborator

firai commented Oct 15, 2023

The current behavior seems to be caused by notebookTracker.activeCellChanged or editorTracker.currentChanged signals firing as background tabs are initialized, but the resulting onActiveCellChanged() -> modifyCell() or onActiveEditorChanged() -> modifyEditor() operation modifies the editor or cell in the foreground.

@firai firai added the help wanted Extra attention is needed label Oct 15, 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 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants