Skip to content

Commit

Permalink
Tweak comments and update version history.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrose committed Nov 6, 2013
1 parent 691ce85 commit dadefbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions blessings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,7 @@ def _resolve_capability(self, atom):
"""
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''

Expand Down Expand Up @@ -436,12 +434,13 @@ def __call__(self, *args):
# 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
Expand Down

0 comments on commit dadefbb

Please sign in to comment.