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

Error in display of tabulator in editor #7432

Closed
10 tasks done
feichtinger opened this issue Jul 12, 2018 · 14 comments
Closed
10 tasks done

Error in display of tabulator in editor #7432

feichtinger opened this issue Jul 12, 2018 · 14 comments

Comments

@feichtinger
Copy link

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

The Spyder editor does not display tabulators right.

What steps reproduce the problem?

  1. open Spyder with default settings

  2. load the attached file into Spyder editor
    temp.txt

  3. see it?

What is the expected output? What do you see instead?

A Tab should be EXACTLY 4 spaces wide, as configured in the settings. But in appears more like ~4.5 spaces making lines not aligned

Versions

  • Spyder version: 3.2.6
  • Python version: 3.6.5
  • Qt version: 5.9.5
  • PyQt version: 5.10.1
  • Operating System name/version: Ubuntu 18.04 LTS

Dependencies

IPython >=4.0    :  5.5.0 (OK)
cython >=0.21    :  None (NOK)
jedi >=0.9.0     :  0.11.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.13.3 (OK)
pandas >=0.13.1  :  None (NOK)
psutil >=0.3     :  5.4.2 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.3 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.5 (OK)
sphinx >=0.6.6   :  1.6.7 (OK)
sympy >=0.7.3    :  None (NOK)

@ccordoba12
Copy link
Member

But in appears more like ~4.5 spaces making lines not aligned

Please post a screenshot because I don't understand what you mean by 4.5 spaces.

@feichtinger
Copy link
Author

Sceenshot:

bildschirmfoto von 2018-07-12 16-56-54

@feichtinger
Copy link
Author

The same file with a different editor (Geany):

bildschirmfoto von 2018-07-12 16-59-23

@ccordoba12
Copy link
Member

I can't reproduce this

seleccion_006

so it looks like a problem with the font you choose.

@bcolsen
Copy link
Member

bcolsen commented Jul 12, 2018

I get it in spyder 4 on Ubuntu 16.04.

It's a mix of spaces and tabs which isn't clear without downloading the text file.

Ubuntu Mono(size 11):
spyder_tabs

Monospace:
tab s monospace

New Courier:
courier

Turning on or off show spaces has no effect.

Font size does matter
Ubuntu Mono(size:10):
font_size

@ccordoba12
Copy link
Member

Mixing spaces and tabs is a very bad idea, so I'd be in favor of closing this one. Realistically we also don't have time to invest in fixing this one.

What do you say @bcolsen?

@bcolsen
Copy link
Member

bcolsen commented Jul 13, 2018

Mixing spaces and tabs is a very bad idea, so I'd be in favor of closing this one.

This is not really a case of mixing spaces and tabs. The bug is there when you just use tabs (also a bad idea) The current way tabs are drawn would make it quite difficult to use the editor. The spacing can be off by 1.5 spaces depending on the font and size(Monospace 12) :

tabs

The two sections should be identical. Notice how the guides don't work either. This is a rendering bug that could impact code readability if you use tabs.

Realistically we also don't have time to invest in fixing this one.

This is true, but this bug should be kept as reference to the issue. I don't use tabs so it's low on my priorities

@feichtinger
Copy link
Author

The bug is there when you just use tabs (also a bad idea)
Well, in my opinion it is a bad idea to use SPACES to indent, but that's a different discussion. Everyone should have the choice of using tabs OR spaces. It is true that mixing spaces and tabs does not make sense, I just used them in the example to make the problem clear.

The point is, that a program editor has to use a monospace font and render it correctly in order to make things line up. But in Spyder editor this does not work when using tabs. So in my opinion this is a SEVERE bug.

I mean, this is a text editor. If this was a MINOR bug, what are your SEVERE bugs that you have to fix first??? Not being able to load a text file?

@bcolsen: Did you find a combination of font and font size so that the editor is usable again?

@ccordoba12
Copy link
Member

So in my opinion this is a SEVERE bug.

You're welcome to fix it. I consider this low priority because you're the first person to report it.

@feichtinger
Copy link
Author

feichtinger commented Jul 14, 2018

You're welcome to fix it.

OK, I will give it a try. Can you give me a hint where to start? Which file is responsible for rendering the editor window content?

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Jul 14, 2018

For the record, I can reproduce it on Spyder 3.3.0 on Win8.1/Python 3.6.6/Qt 5.6 as well.

I'm not as familiar with the details of the underpinnings as some, but the Editor widget would be one place to start. Since this is a bug, if it ends up being straightforward you could probably justify fixing this on 3.x, in my opinion.

@ccordoba12 ccordoba12 modified the milestones: v4.0betaX, v3.3.1 Jul 16, 2018
@ccordoba12 ccordoba12 changed the title display of tabulator in editor Error in display of tabulator in editor Jul 16, 2018
@ccordoba12
Copy link
Member

ccordoba12 commented Jul 16, 2018

@feichtinger, the fix for this will be available in our 3.3.1 version.

@feichtinger
Copy link
Author

Thanks for investigating this bug. Unfortunately the issue is still not fixed on my system.
bildschirmfoto von 2018-07-19 10-13-46

I pulled the latest 3.x branch from github (commit: a2c60d7) and used the bootstrap.py script.

@feichtinger
Copy link
Author

This should fix it:
#7502

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

No branches or pull requests

4 participants