[issue16182] readline: Wrong tab completion scope indices in Unicode terminals

Kaarle Ritvanen report at bugs.python.org
Tue Oct 9 22:09:44 CEST 2012


New submission from Kaarle Ritvanen:

Tab completion in the readline module does not seem to work well with Unicode terminals. The get_line_buffer function converts the line buffer to the str type (which are Unicode strings in Python 3), but the indices returned by get_begidx and get_endidx are not adjusted with respect to possible wide characters in the buffer, and hence are not very useful. The documentation is a bit vague on the index functions, but I think they should be relative to code points, regardless of the encoding used by the C library. The suggested correction is attached.

My second point of complaint is related to the use of PyUnicode_FromString in the module. The strings returned by the readline library use the current locale encoding, which is not necessarily UTF-8. I wonder if PyUnicode_DecodeLocale should be used instead for more portable code.

----------
components: Library (Lib)
files: readline-wide-char-index.patch
keywords: patch
messages: 172517
nosy: kunkku
priority: normal
severity: normal
status: open
title: readline: Wrong tab completion scope indices in Unicode terminals
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file27508/readline-wide-char-index.patch

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


More information about the Python-bugs-list mailing list