diff options
author | Erik Rose <grinch@grinchcentral.com> | 2013-11-05 23:04:19 -0500 |
---|---|---|
committer | Erik Rose <grinch@grinchcentral.com> | 2013-11-05 23:04:27 -0500 |
commit | dadefbbc4e862cd54c2fae72b29001bdd676aa73 (patch) | |
tree | c5544fc66e46c459e76fcd145f2edd063d3c4fb6 | |
parent | 691ce85b4acf55e699c2305e6302adc655d6fc70 (diff) | |
download | blessings-dadefbbc4e862cd54c2fae72b29001bdd676aa73.tar.gz |
Tweak comments and update version history.
-rw-r--r-- | README.rst | 2 | ||||
-rw-r--r-- | blessings/__init__.py | 11 |
2 files changed, 7 insertions, 6 deletions
@@ -439,6 +439,8 @@ Version History * Make ``is_a_tty`` a read-only property, like ``does_styling``. Writing to it never would have done anything constructive. * Add ``fullscreen()`` and ``hidden_cursor()`` to the auto-generated docs. + * Support terminal types, such as kermit and avatar, that use bytes 127-255 + in their escape sequences. (jquast) 1.5.1 * Clean up fabfile, removing the redundant ``test`` command. diff --git a/blessings/__init__.py b/blessings/__init__.py index d968bb5..a5013aa 100644 --- a/blessings/__init__.py +++ b/blessings/__init__.py @@ -364,9 +364,7 @@ class Terminal(object): """ code = tigetstr(self._sugar.get(atom, atom)) if code: - # We can encode escape sequences as UTF-8 because they never - # contain chars > 127, and UTF-8 never changes anything within that - # range.. + # See the comment in ParametrizingString for why this is latin1. return code.decode('latin1') return u'' @@ -436,12 +434,13 @@ class ParametrizingString(unicode): # Re-encode the cap, because tparm() takes a bytestring in Python # 3. However, appear to be a plain Unicode string otherwise so # concats work. - # We use *latin1* encoding so that bytes emitted by tparam are + # + # We use *latin1* encoding so that bytes emitted by tparm are # encoded to their native value: some terminal kinds, such as # 'avatar' or 'kermit', emit 8-bit bytes in range 0x7f to 0xff. # latin1 leaves these values unmodified in their conversion to - # unicode byte values. The terminal emulator will 'catch' and - # handle these values, even if emitting utf8 encoded text, where + # unicode byte values. The terminal emulator will "catch" and + # handle these values, even if emitting utf8-encoded text, where # these bytes would otherwise be illegal utf8 start bytes. parametrized = tparm(self.encode('latin1'), *args).decode('latin1') return (parametrized if self._normal is None else |