[Python-checkins] python/dist/src/Modules readline.c,2.41.6.2,2.41.6.3
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sat, 05 Oct 2002 22:43:49 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv17507
Modified Files:
Tag: release22-maint
readline.c
Log Message:
Backport 2.49:
SF #558432: Prevent Annoying ' ' from readline (Holker Krekel).
readline in all python versions is configured
to append a 'space' character for a successful
completion. But for almost all python expressions
'space' is not wanted (see coding conventions PEP 8).
For example if you have a function 'longfunction'
and you type 'longf<TAB>' you get 'longfunction '
as a completion. note the unwanted space at the
end.
The patch fixes this behaviour by setting readline's
append_character to '\0' which means don't append
anything. This doesn't work with readline < 2.1
(AFAIK nowadays readline2.2 is in good use).
An alternative approach would be to make the
append_character
accessable from python so that modules like
the rlcompleter.py can set it to '\0'.
[Ed.: I think expecting readline >= 2.2 is fine. If a completer wants
another character they can append that to the keyword in the list.]
Index: readline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v
retrieving revision 2.41.6.2
retrieving revision 2.41.6.3
diff -C2 -d -r2.41.6.2 -r2.41.6.3
*** readline.c 24 Sep 2002 01:17:41 -0000 2.41.6.2
--- readline.c 6 Oct 2002 05:43:47 -0000 2.41.6.3
***************
*** 521,524 ****
--- 521,525 ----
strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
/* All nonalphanums except '.' */
+ rl_completion_append_character ='\0';
begidx = PyInt_FromLong(0L);