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

Block indent always inserts spaces for indentation, even when configured to use tabs. #7027

Open
fake-name opened this issue Sep 1, 2023 · 4 comments
Labels

Comments

@fake-name
Copy link

fake-name commented Sep 1, 2023

Description

When in a jupyter notebook, with indentation set to tab, if you select a block of code and hit tab to indent it, it inserts spaces. If you're using python, this is obviously a problem, particularly on python3.

Reproduce

In jupyter notebook (codemirror? Jupyter has too many poorly delineated components):

  1. Set the indentation to tabs:
    image
  2. Select a block of code.
  3. Hit Tab
  4. You get spaces:
    image

Expected behavior

If you have the editor set to tab mode (the correct way to indent things), I'd expect the block indentation operation to insert tabs.

Additionally, Notebook 7 seems to no longer have visible tab characters, whereas they are shown in 6 and/or "nbclassic". I'd call that a regression.

Context

  • Operating System and version: Server: Ubuntu 22.04. Client: Windows 10
  • Browser and version: Vivaldi 6.1.3035.302 (Stable channel) (64-bit)
  • Jupyter Notebook version: 7.0.3

I don't think the rest of the template is relevant, since this seems to be a logic error rather then a bug in the sense of the code doing something it's not intended to do.

@fake-name fake-name added bug status:Needs Triage Applied to issues that need triage labels Sep 1, 2023
@jtpio
Copy link
Member

jtpio commented Sep 4, 2023

Thanks @fake-name for reporting 👍

Would you be able to check if this is an issue in JupyterLab as well? (since Notebook 7 is based on JupyterLab)

@RRosio RRosio removed the status:Needs Triage Applied to issues that need triage label Sep 5, 2023
@krassowski
Copy link
Member

krassowski commented Sep 5, 2023

It works well in text editor in JupyterLab. I think the problem here is that this menu should not be shown when Notebook (rather than a Text Editor) is active. The underlying problem is the same as issues:

In this sense it is a bug in Notebook because in JupyterLab there is no such an entry in the view menu when using a notebook.

@krassowski
Copy link
Member

Oh, sorry it is there in JupyterLab too. I think that a good solutions would be to add a new "Cell Editor Indentation" which would toggle indentation for all types of cell (this is what Auto Close Brackets does if I remember correctly), and only show it notebook view, while hiding the "Text Editor Indentation".

@fake-name for now you should be able to adjust the indentation in "Settings Editor", under "CodeMirror" (to adjust them globally) or under "Notebook" to adjust it on per-cell-type basis.

@FeelUsM
Copy link

FeelUsM commented Feb 1, 2024

so, how to change indentation settings in jupyter notebook?

I try to change Settings->Text Editr Indentation, but it affects only the editor but not the notebook. This does not depend on whether I open the notebook in a separate browser tab or in Jupiterlab.

Where is notebook settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants