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

Armin Rigo report at bugs.python.org
Wed Feb 11 16:28:17 CET 2015


Armin Rigo added the comment:

Ah, thanks, I missed there was already an issue.

The patch's logic is as follows: when pressing tab anywhere in the line, if the word to complete is empty (which might be for any number of reasons, like the cursor is after another space or a non-word character), then suggest as completion a string of N spaces, where N is a number from 1 to 4 so that the cursor ends up being aligned to a multiple of 4.  You have to press backspace several times to remove all these spaces.

Indeed, it could also suggest a single '\t' character, which would be simpler and revert exactly to the old behavior (including a single backspace to remove the whole tab).  I didn't do it only because it would typically indent to 8 characters instead of 4.  If people think it is anyway a better idea, I can submit a second (simpler) patch doing that.

----------

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


More information about the Python-bugs-list mailing list