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

Jump to line keyboard shortcut #7704

Open
guarin opened this issue Dec 27, 2019 · 18 comments
Open

Jump to line keyboard shortcut #7704

guarin opened this issue Dec 27, 2019 · 18 comments
Labels
pkg:codemirror tag:Keyboard Compatibility issues with keyboards, including locale-specific and layout-specific issues

Comments

@guarin
Copy link

guarin commented Dec 27, 2019

Description

The keyboard shortcut for the "jump to line" command overwrites one of the keys I use but I cannot find the location where to disable to command/shortcut. I am talking about the command that opens the following window:

Screen Shot 2019-12-27 at 13 08 56

It is not listed in Settings -> Keyboard Shortcuts -> Default Settings and I did not add/overwrite it in the User Settings.

Reproduce

On my keyboard: Alt G

Context

  • Operating System and version: macOS-10.11.6-x86_64-i386-64bit
  • Browser and version: Google Chrome: Version 79.0.3945.88 (Official Build) (64-bit)
  • JupyterLab version: 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:19) [Clang 9.0.0 (tags/RELEASE_900/final)]
Troubleshoot Output
$PATH:
    /opt/anaconda3/envs/jlab-test/bin
    /opt/anaconda3/condabin
    /Library/Frameworks/Python.framework/Versions/3.8/bin

sys.path:
/opt/anaconda3/envs/jlab-test/bin
/opt/anaconda3/envs/jlab-test/lib/python38.zip
/opt/anaconda3/envs/jlab-test/lib/python3.8
/opt/anaconda3/envs/jlab-test/lib/python3.8/lib-dynload
/opt/anaconda3/envs/jlab-test/lib/python3.8/site-packages

sys.executable:
/opt/anaconda3/envs/jlab-test/bin/python

sys.version:
3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:19)
[Clang 9.0.0 (tags/RELEASE_900/final)]

platform.platform():
macOS-10.11.6-x86_64-i386-64bit

which -a jupyter:
/opt/anaconda3/envs/jlab-test/bin/jupyter

pip list:
Package Version
------------------ -------------------
appnope 0.1.0
attrs 19.3.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.11.28
decorator 4.4.1
defusedxml 0.6.0
entrypoints 0.3
importlib-metadata 1.3.0
ipykernel 5.1.3
ipython 7.10.2
ipython-genutils 0.2.0
jedi 0.15.2
Jinja2 2.10.3
json5 0.8.5
jsonschema 3.2.0
jupyter-client 5.3.3
jupyter-core 4.6.1
jupyterlab 1.2.4
jupyterlab-server 1.0.6
MarkupSafe 1.1.1
mistune 0.8.4
more-itertools 8.0.2
nbconvert 5.6.1
nbformat 4.4.0
notebook 6.0.1
pandocfilters 1.4.2
parso 0.5.2
pexpect 4.7.0
pickleshare 0.7.5
pip 19.3.1
prometheus-client 0.7.1
prompt-toolkit 3.0.2
ptyprocess 0.6.0
Pygments 2.5.2
pyrsistent 0.15.6
python-dateutil 2.8.1
pyzmq 18.1.1
Send2Trash 1.5.0
setuptools 42.0.2.post20191201
six 1.13.0
terminado 0.8.3
testpath 0.4.4
tornado 6.0.3
traitlets 4.3.3
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.33.6
zipp 0.6.0

conda list:
# packages in environment at /opt/anaconda3/envs/jlab-test:
#
# Name Version Build Channel
appnope 0.1.0 py38_1000 conda-forge
attrs 19.3.0 py_0 conda-forge
backcall 0.1.0 py_0 conda-forge
bleach 3.1.0 py_0 conda-forge
ca-certificates 2019.11.28 hecc5488_0 conda-forge
certifi 2019.11.28 py38_0 conda-forge
decorator 4.4.1 py_0 conda-forge
defusedxml 0.6.0 py_0 conda-forge
entrypoints 0.3 py38_1000 conda-forge
importlib_metadata 1.3.0 py38_0 conda-forge
ipykernel 5.1.3 py38h5ca1d4c_0 conda-forge
ipython 7.10.2 py38h5ca1d4c_0 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
jedi 0.15.2 py38_0 conda-forge
jinja2 2.10.3 py_0 conda-forge
json5 0.8.5 py_0 conda-forge
jsonschema 3.2.0 py38_0 conda-forge
jupyter_client 5.3.3 py38_1 conda-forge
jupyter_core 4.6.1 py38_0 conda-forge
jupyterlab 1.2.4 py_0 conda-forge
jupyterlab_server 1.0.6 py_0 conda-forge
libcxx 9.0.0 h89e68fa_1 conda-forge
libffi 3.2.1 h6de7cb9_1006 conda-forge
libsodium 1.0.17 h01d97ff_0 conda-forge
markupsafe 1.1.1 py38h0b31af3_0 conda-forge
mistune 0.8.4 py38h0b31af3_1000 conda-forge
more-itertools 8.0.2 py_0 conda-forge
nbconvert 5.6.1 py38_0 conda-forge
nbformat 4.4.0 py_1 conda-forge
ncurses 6.1 h0a44026_1002 conda-forge
notebook 6.0.1 py38_0 conda-forge
openssl 1.1.1d h0b31af3_0 conda-forge
pandoc 2.9.1 0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.5.2 py_0 conda-forge
pexpect 4.7.0 py38_0 conda-forge
pickleshare 0.7.5 py38_1000 conda-forge
pip 19.3.1 py38_0 conda-forge
prometheus_client 0.7.1 py_0 conda-forge
prompt_toolkit 3.0.2 py_0 conda-forge
ptyprocess 0.6.0 py_1001 conda-forge
pygments 2.5.2 py_0 conda-forge
pyrsistent 0.15.6 py38h0b31af3_0 conda-forge
python 3.8.0 hd366da7_5 conda-forge
python-dateutil 2.8.1 py_0 conda-forge
pyzmq 18.1.1 py38h4bf09a9_0 conda-forge
readline 8.0 hcfe32e1_0 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 42.0.2 py38_0 conda-forge
six 1.13.0 py38_0 conda-forge
sqlite 3.30.1 h93121df_0 conda-forge
terminado 0.8.3 py38_0 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hbbe82c9_0 conda-forge
tornado 6.0.3 py38h0b31af3_0 conda-forge
traitlets 4.3.3 py38_0 conda-forge
wcwidth 0.1.7 py_1 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.33.6 py38_0 conda-forge
xz 5.2.4 h1de35cc_1001 conda-forge
zeromq 4.3.2 h6de7cb9_2 conda-forge
zipp 0.6.0 py_0 conda-forge
zlib 1.2.11 h0b31af3_1006 conda-forge

Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here.
@simonstingelin
Copy link

Overwriting the Setting does not solve the problem. Does anybody know a workaround?

@jasongrout
Copy link
Contributor

This comes from the CodeMirror jump-to-line extension we load: https://github.com/codemirror/CodeMirror/blob/b9e6190b3edf16fe959055c45807e06f833f9d1f/addon/search/jump-to-line.js#L52

I don't have a keyboard where Alt G prints a key, but a workaround might be to define a keyboard shortcut in Settings>Advanced Settings>Keyboard Shortcuts that explicitly prints @ into the editor when you press Alt G:

{
  shortcuts: [
    {
      command: 'apputils:run-first-enabled',
      selector: 'body',
      keys: [
        'Alt G',
      ],
      args: {
        commands: [
          'console:replace-selection',
          'fileeditor:replace-selection',
          'notebook:replace-selection',
        ],
        args: {
          text: '@',
        },
      },
    },
  ],
}

@fabianegli
Copy link

@jasongrout Thank you, that works. I wonder if this could be a checkbox somewhere in the settings for users on macOS?

@jasongrout
Copy link
Contributor

I think it is not about macOS, but about keyboard layouts in general. One problem here is that some editor keyboard shortcuts do not use the jlab keyboard shortcut system (like this Alt G). Instead, I think we should reimplement these keyboard shortcuts using the jlab keyboard shortcut system if possible. That would make it easy to customize the shortcut.

@JLTastet
Copy link

I don't have a keyboard where Alt G prints a key, but a workaround might be to define a keyboard shortcut in Settings>Advanced Settings>Keyboard Shortcuts that explicitly prints @ into the editor when you press Alt G:

Note that this workaround will most likely not work if Alt/AltGr + G is a dead key, which is for instance the case for the ergonomic bepo layout, where it is used to switch to the greek layer (which is surprisingly useful in Unicode-friendly languages like Julia, since it is faster than typing "\alpha" then TAB).

@jasongrout
Copy link
Contributor

Note that this workaround will most likely not work if Alt/AltGr + G is a dead key, which is for instance the case for the ergonomic bepo layout, where it is used to switch to the greek layer (which is surprisingly useful in Unicode-friendly languages like Julia, since it is faster than typing "\alpha" then TAB).

Right, we were trying to solve the problem of Alt+G being the combination to type @.

Or are you saying that in JupyterLab, instead of switching to the greek layer, Alt/AltGr + G is triggering the go to line functionality in CodeMirror?

@JLTastet
Copy link

Or are you saying that in JupyterLab, instead of switching to the greek layer, Alt/AltGr + G is triggering the go to line functionality in CodeMirror?

Yes, this is what I meant: with my keyboard layout, the "go to line" shortcut from CodeMirror is conflicting with a dead key and prevents access to an entire layer. In principle, I could use your workaround to explicitly redefine all the AltGr/Opt + g + [a-zA-Z], but that would be cumbersome.

Sorry if I wasn’t clear.

@meeseeksmachine
Copy link
Contributor

This issue has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/unbinding-right-alt-g-from-jupyterlab/12855/2

@stepelu
Copy link

stepelu commented Sep 13, 2022

Hi, has there been any progress on this issue?
I can confirm that it is a pain point, for example I am using this math keyboard
https://www.cs.cornell.edu/andru/release/lattice-kbd/
where all the greeks are mapped via the alt-g dead key...

@JLTastet
Copy link

In Jupyter Lab 3.4.5 and 3.5.0 I still encounter this issue, but only with Firefox (106.0.5). I have no problem with Brave (1.45.123) or Safari (16.1). I am on macOS 12.6.1 (ARM).

@burnpanck
Copy link

burnpanck commented Nov 5, 2023

Still major pain point. For almost 4 years now! Contributes to that fact that the Jupyter Notebook 7 user experience feels extremely frustrating even months after switching from JN 6.

@rofr
Copy link

rofr commented Feb 11, 2024

Unlike standard English keyboards, which prioritize letters and commonly used symbols, keyboards designed for other languages may allocate space differently to accommodate characters specific to that language. As a result, certain characters, particularly those used less frequently in the primary language, are accessed through modifier keys like "Alt Gr" on Windows or "Option" on Mac. This design allows users to type in their native language while still having the ability to input special characters when necessary without cluttering the keyboard layout.

Using the "Alt" or "Option" key, alone or with "Shift" together with a number for short cuts is going to cause problems for many users and should probably be avoided.

Here is what my keyboard looks like, notice how some key characters used for programming are missing:

image

And here are the key combinations for some of those missing characters:

Alt 2 -> @
Alt 3 -> £
Alt 4 -> $
Alt 7 -> |
Alt 8 -> [
Alt 9 -> ]
Alt Shift 7 -> \
Alt Shift 8 -> {
Alt Shift 9 -> }

To able to use the editor in jupyterlab at all I had to figure out what was going on and then disable the conflicting keyboard shorts which took me maybe 30 minutes.

@krassowski
Copy link
Member

@rofr if you are using JupyterLab 4.1.0 I believe you might be running into #15744.

@rofr
Copy link

rofr commented Feb 12, 2024

@rofr if you are using JupyterLab 4.1.0 I believe you might be running into #15744.

Yes, confirmed. There are multiple related issues with the same underlying cause. And all fixed by #15761

@burnpanck
Copy link

@krassowski @rofr this looks like a separate issue to me. This issue is about Alt-G specifically, which is not any of the Alt - number keys, and according to the title thus is not fixed by #15761.

@krassowski
Copy link
Member

@burnpanck yes, this issue (#7704) is not fixed by #15761, but #15744 (mostly) is.

@krassowski
Copy link
Member

Actually #15790 + replacing Alt + G from CM6 binding to a lumino command would also solve this issue.

@burnpanck
Copy link

I don't know the codebase at all ("CM6 binding" and "lumino command" mean absolutely nothing to me), but if #15790 is able to fix the alt-g issue, that would be great. Just wanted to point out that the alt-g issue does not only appear in the JupyterLab frontend, but also in the "classic notebook" (which is still my favourite interface, despite some severe user-experience step-backs since the change to the JupyterLab backend with version 7). Given that the alt-g key binding seems to live outside of the "normal" JupyterLab shortcuts within the Jupyter notebook, this may or may not be related with that "CM6 binding".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:codemirror tag:Keyboard Compatibility issues with keyboards, including locale-specific and layout-specific issues
Projects
None yet
Development

No branches or pull requests