Tab key should insert 4 spaces in qt console #900

Closed
fperez opened this Issue Oct 19, 2011 · 1 comment

2 participants

@fperez
IPython member

Currently the tab key, when not completing, inserts a hard tab in the qt console. That makes it harder to paste that code later into editors, and also causes other issues as discussed in #513.

I'm tagging this as bug and not enhancement b/c tab-as-4-spaces is pretty much a universal python standard at this point, so the fact that we don't quite follow it in this context, should be seen as a bug.

@minrk
IPython member

#513 isn't actually other issues, it's exactly this. It was misunderstood as the wrong number of spaces because tabs align with tab-stops, so vary in width.

I added a fix to the qtconsole-menu PR, as it's two lines. Should close both issues.

Now that tabs=4sp is so standard, you might think the Python interpreter would stop reading tabs as 8 spaces with respect to indentation:

exec "def foo():\n\ta=5\n        return a\nprint foo()"
@minrk minrk added a commit that closed this issue Oct 20, 2011
@minrk minrk add 4-space soft-tabs to qtconsole
pressing tab inserts four spaces, so there should never be any '\t' characters
inserted by typing.

closes gh-900
closes gh-513
33cfae8
@minrk minrk closed this in 33cfae8 Oct 20, 2011
@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
@minrk minrk add 4-space soft-tabs to qtconsole
pressing tab inserts four spaces, so there should never be any '\t' characters
inserted by typing.

closes gh-900
closes gh-513
cc6d90c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment