[issue23441] rlcompleter: tab on empty prefix => insert spaces

Martin Sekera report at bugs.python.org
Sat Mar 14 23:58:23 CET 2015


Martin Sekera added the comment:

Is it necessary to force a predefined tab width (4) onto the user here? I prefer 2-character tabs for example, and have all my terminals set up accordingly (setterm --regtabs 2). I presume many people prefer 8-column tabs, hence the default width in most software.

Additionally, the user shouldn't have to backspace 4 characters to remove one level of indentation. Not only is it annoying, it is also prone to errors if the user miscounts (and ends up with an IndentationError).

I've been using the attached patch (just 5 lines) to emulate the behavior familiar from unix shells: pressing tab activates the completion function, but indents if the line is empty (i.e. '' or all whitespace). It also indents properly if the cursor is moved to whitespace in front of a line, as one would expect.

----------
nosy: +Martin Sekera
Added file: http://bugs.python.org/file38487/rlcompleter-tab.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23441>
_______________________________________


More information about the Python-bugs-list mailing list