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

Can not insert line breaks in a specific notebook cell #4165

Closed
fuglede opened this issue Mar 10, 2018 · 15 comments · Fixed by #5858
Closed

Can not insert line breaks in a specific notebook cell #4165

fuglede opened this issue Mar 10, 2018 · 15 comments · Fixed by #5858
Labels
bug pkg:cells status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@fuglede
Copy link

fuglede commented Mar 10, 2018

Unfortunately, I am unable to reproduce this issue, so debugging this seems tricky, but the issue seems major so let me at least try to spell out what I was doing in case that makes it obvious to contributors what could be happening. When I

  • created a new Python 3 notebook,
  • opened that notebook,
  • moved the notebook to another folder,
  • inserted the altair snippet below into a cell and executed it,

then I was no longer able to insert line breaks into that cell by pressing return. All other characters could be entered just fine, but adding line breaks was impossible. It is possible, however, to add a line break by copying and pasting one from another cell.

If I copy the contents of the cell to another cell, then that cell works fine, even if I execute the contents. Similarly, if I copy the cell itself (through command mode+C+V), then the newly created cell also works as expected. Likewise, if I add cells above or below the problematic cell, then those also work as expected. Only the initially created cell causes issues.

The code in the problematic cell:

import altair as alt
import json
# Uncomment/run this line to enable Altair in JupyterLab/nteract:
alt.enable_mime_rendering()

# load data as a pandas DataFrame
cars = alt.load_dataset('cars')
cars.to_csv('cars.csv')
chart = alt.Chart(cars).mark_point().encode(
    x='Horsepower',
    y='Miles_per_Gallon',
    color='Origin',
)
d = chart.to_dict()
json.dumps(d)

Some version numbers:

altair                    1.2.1                      py_0    conda-forge
jupyter                   1.0.0                    py36_4
jupyter_client            5.2.2                    py36_0
jupyter_console           5.2.0            py36h6d89b47_1
jupyter_core              4.4.0            py36h56e9d50_0
jupyterlab                0.31.12                  py36_1    conda-forge
jupyterlab_launcher       0.10.5                   py36_0    conda-forge
vega                      0.4.4                    py36_1    conda-forge
@lukeolson13
Copy link

This happens to me as well, although I haven't been moving notebooks to different folders. I notice it sometimes when I "Restart Kernel and Clear Outputs...".

@saulshanabrook saulshanabrook added this to the Future milestone Sep 10, 2018
@fuglede
Copy link
Author

fuglede commented Sep 26, 2018

I am still not able to reproduce this consistently but just had it happen again. Hopefully this isn't a red herring, but this time it occurred after clicking shift+tab to produce a tool-tip for a function, and clicking away from the active cell to some other cell.

@jasongrout
Copy link
Contributor

@fuglede - are you on current jupyterlab now? 0.34.12?

@fuglede
Copy link
Author

fuglede commented Sep 29, 2018

@jasongrout I believe this was in 0.34.1; are there any changes in the most recent versions that could affect this? In any case, I've now made sure to update to 0.34.9 (which seems to be the most recent one available through conda) and will continue to have an eye on it.

Edit: Just noticed that 0.34.12 is in conda-forge, so let me go with that one instead.

@mgab
Copy link

mgab commented Nov 16, 2018

I experience this bug, too, but I cannot reproduce it consistently. Some cell stops accepting newline characters (although they can be introduced by copy pasting). Copying the content of the cell into a new cell (or even copying the whole cell with c and v) produces a correctly functioning cell. No moving notebooks around in my case. Closing the notebook tab and opening it again seems to fix the behaviour.

I'm using Jupyter 4.4.0 with jupyter lab 0.35.4, installed with conda 4.5.11.

Does anyone have any idea of some more information that could be useful?

@jasongrout
Copy link
Contributor

Do you have any custom keyboard shortcuts?

@fuglede
Copy link
Author

fuglede commented Nov 16, 2018

A few in Windows but not in Firefox/Jupyter.

@jasongrout
Copy link
Contributor

Are there any javascript console errors when you notice the misbehavior?

Can you reproduce it when running in incognito mode with no browser extensions? Sometimes a browser extension will interact in weird ways with content on the page.

@mgab
Copy link

mgab commented Nov 19, 2018

Do you have any custom keyboard shortcuts?

No custom keyboard shortcuts in my case.

Are there any javascript console errors when you notice the misbehavior?

I'll check it next time I experience the cell misbehavior.

Can you reproduce it when running in incognito mode with no browser extensions?

The problem occurs from time to time and I wasn't able to reproduce it in a controlled manner. Thus, I haven't managed to test it in a controlled environment. I also have a few jupyterlab extensions installed. I have already disabled them, I guess I don't need to uninstall them, right?

@jasongrout
Copy link
Contributor

Disabling the extensions should be enough.

@fuglede
Copy link
Author

fuglede commented Nov 19, 2018

No JupyterLab extensions here.

@gaurav-kaushik
Copy link

I have jupyterlab==0.35.4 with no extensions installed. Return/Enter will stop working in random cells. Restarting kernels does not fix the issue. Moving the notebook, however, does. I don't get this issue with Jupyter Notebooks (i.e. w/o Lab).

jupyter==1.0.0
jupyter-client==5.2.3
jupyter-console==5.2.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.4.0
jupyter-core==4.4.0
jupyter-highlight-selected-word==0.1.0
jupyter-latex-envs==1.4.4
jupyter-nbextensions-configurator==0.4.0
jupyterlab==0.35.4
jupyterlab-launcher==0.10.5
jupyterlab-server==0.2.0
jupyterthemes==0.18.3

@cbuhl
Copy link

cbuhl commented Jan 11, 2019

I can consistently reproduce this behavior, by starting a string with autocompletion (fx a directory path), and while the suggestions are still open, pressing Shift+Enter. I am on a Mac.

MWE description:
Start a string in a cell with '.
Begin the string with a ~ and the /.
Press TAB, and have a small selection of various directories show up.
Press SHIFT+ENTER, without selecting any of the options.

Now the cell does not insert line breaks when pressing ENTER.
This also works in incognito mode.

@fuglede
Copy link
Author

fuglede commented Jan 11, 2019

Yep, I can verify that this also produces the issue consistently here. Brilliant!

@ian-r-rose
Copy link
Member

Yep, I can reproduce as well. Thanks for the report @fuglede, as well as the nice exampel @cbuhl! I think I will try to fix this as part of fixing #2360, which is also in the works.

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug pkg:cells status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants