Version History
- 1.44
improve: reduce errant XTGETTCAP output for Terminal.app and ConEmu.exe PR #385.
- 1.43
bugfix: regression of XTGETTCAP responses leaking into first call for empty/non-response terminals (libvte/Gnome Terminal), in versions 1.40 to 1.42 PR #383.
- 1.42
- 1.41
bugfix:
get_location()broken in 1.40, returned a generator instead of a tuple. #378.
- 1.40
improved: jinxed is now required on all platforms, providing a curses-free and singleton-free implementation of the subset of curses used by blessed. The jinxed 1.5.0 release provides a terminal capability database <https://jinxed.readthedocs.io/en/stable/capabilities.html#database> of 45 terminals and their common aliases.
improved: Class initialization of
Terminal()now uses XTGETTCAP to determine preferred terminal nameTN, 24-bit color supportRGB, number of colorsCo, italic, and blink capabilities.This improves detection of Terminal kind and number_of_colors over protocols like serial that cannot forward any environment variables or ssh that do not forward
COLORTERM.introduced: A
UserWarningis emitted when__getattr__()resolves an unknown terminal capability name, helping developers catch typos liketerm.bld(missingbold). The warning can be suppressed by setting the environment variableBLESSED_NOWARN_UNKNOWN_CAPS.bugfix: Fixed internal typo
susimpleriptto the correct terminfo namessubmfor theenter_susimpleript_modecapability. This was previously masked by curses returning an empty string for unknown capabilities.
- 1.39
introduced:
progress_bar()for OSC 9;4 sequence.introduced:
text_sized()– wrap text in Kitty text sizing protocol (OSC 66) escape sequences, with graceful fallback to plain text when the terminal does not support the protocol.introduced:
Keystrokeof nameCPR_RESPONSEfor asynchronous capture of Cursor Position Report responses viainkey(). New argumentcapture_cpr=Trueresolves the legacy F3 key ambiguity and matches againstCPR_RESPONSE. New propertiescpr_yxandcpr_xyreturn the decoded cursor coordinates. PR #369.improved:
inkey()raisesEOFErrorwhen keyboard fd is at EOF, rather than returning an emptyKeystroke. PR #371.improved:
ljust(),rjust(), andcenter()now measure text containing hyperlinks, Kitty text sizing protocol sequences, and overtyping (backspace/cursor-left with painter’s algorithm), introduced by wcwidth 0.7.0.
- 1.38
introduced:
does_osc52_clipboard(),clipboard_copy(), andclipboard_paste()to detect, copy, and read from clipboard.introduced:
get_color_scheme().introduced:
does_kitty_query()for Kitty’s XTGETTCAP query extensions.introduced:
does_decrqss()for DECRQSS (Request Status String).introduced:
does_styled_underlines()anddoes_colored_underlines()– detect extended underline styles (Smulx) and colored underlines (Setulc) via XTGETTCAP.introduced:
set_window_title()andwindow_title()– set the terminal window and/or icon title via xterm OSC sequences, with a context manager that pushes and pops the title stack (XTWINOPS).introduced:
DecModeResponse.recognizedandDecModeResponse.supportedproperties – distinguish modes the terminal acknowledges from those it can actually use.improved:
SmulxandSetulcadded to XTGETTCAP capability list.bugfix:
EOFwhen stdin is connected to a Pipe (eg. pytest capture) caused infinite loop PR #366.bugfix: Background SGR not applying to text/suggestion content in
blessed.line_editor.LineEditor, now prepend bg_sgr before each content SGR sequence.bugfix: OSC responses for ‘ST’ in addition to ‘BEL’ terminated iTerm2 capabilities, Kitty notifications, Kitty pointer shapes responses
- 1.37
bugfix: legacy CSI letter-form sequences with explicit modifiers and event type (e.g.,
\x1b[1;1:1Afor arrow key press) were not resolved to key names, this affected only some terminals, such as Ghostty. PR #363.
- 1.36
bugfix:
[key returnednameof valueCSIin Kitty keyboard protocol mode, it now returnsKEY_LEFT_SQUARE_BRACKET.improved: Kitty keyboard protocol now synthesizes
namefor all ASCII alphanumeric and punctuation keys, including unmodified press events (e.g.,KEY_A,KEY_PERIOD,KEY_LEFT_SQUARE_BRACKET). Previously, only modified or released/repeated keys received synthesized names.
- 1.35
introduced:
cursor_shape()context manager andCursorShapeconstants for DECSCUSR cursor shape control (block, underline, bar – steady or blinking).introduced: methods
key_name()andkey_value()allow for better key and value tracking when using kitty keyboard protocol with pressed, released, and repeated events.improved: Synthesize
namefor “released” and “repeated” key states, when using the kitty keyboard protocol.bugfix:
get_fgcolor()andget_bgcolor()now correctly interprets ST-terminated OSC responses in addition to BEL-terminated.
- 1.34
improved: Windows now supports
does_mouse(),notify_on_resize(), andmouse_enabled(). More than 100x improvement of response times to keyboard input and automatic response sequences on the Windows platform by usingWaitForSingleObjectinitially proposed by cr545l, PR #354.bugfix:
async_inkey()no longer raises NotImplementedError on Windows.
- 1.33
bugfix:
blessed.line_editor.LineEditorexceed limit when using Yank (Ctrl+Y).
- 1.32
bugfix:
get_kitty_keyboard_state()should not check fordoes_stylingas a requirement.bugfix:
get_fgcolor()andget_bgcolor()now return “no support” value,(-1, -1, -1)whendoes_stylingis False.introduced:
does_kitty_clipboard(),does_kitty_pointer_shapes(), anddoes_text_sizing()introduced:
to_dict()andDecPrivateMode.BRACKETED_PASTE_MIMEconstant (mode 5522).
- 1.31
bugfix:
cbreak()andraw()should useTCSADRAINto preserve keystrokes buffered during mode switches, previouslyTCSAFLUSHwas used which discarded unread input, dropping keystrokes.improved: all terminal query methods now use a CPR boundary guard for fast negative detection of unsupported features:
get_fgcolor(),get_bgcolor(),get_device_attributes(), andget_software_version().introduced:
async_inkey()– asyncio-compatible version ofinkey().introduced:
blessed.line_editor.LineEditor, a “headless” single-line editor.introduced:
get_xtgettcap()– query terminal capabilities via XTGETTCAP andget_iterm2_capabilities()for iTerm2 protocol features.introduced: terminal feature detection methods
does_bracketed_paste(),does_focus_events(),does_grapheme_clustering()does_iterm2(),does_iterm2_graphics(),does_kitty_graphics(),does_kitty_notifications(),does_synchronized_output(), anddoes_xtgettcap().
- 1.30
- 1.29
bugfix:
Terminal.get_kitty_keyboard_state()failed to match PR #348.
- 1.28
improved: upgrade to wcwidth 0.5, improving performance and correctness of
Terminal.wrap(),Terminal.ljust(), and related functions, PR #344.deprecated: Python 3.7 and earlier no longer supported. PR #344.
- 1.27
bugfix missing tests, bin, and docs folder in 1.26 release, PR #341.
- 1.26
introduced:
Terminal.detect_ambiguous_width(), PR #339.introduced:
Terminal.no_line_wrap(), context manager for attributesdisable_line_wrapandenable_line_wrapPR #337.introduced: New methods
Terminal.color_hex()andTerminal.on_color_hex()and bugfix parsing of uncommon responses inTerminal.get_fgcolor()and bgcolor, PR #335.improved: performance of
Terminal.wrap(), PR #331 by grayjk.improved:
Terminal.wrap()gets break_on_hyphen support, matching behavior oftextwrap.wrap()by ps06756 in PR #330.bugfix: for missing leading sequences in
Terminal.center(),Terminal.wrap(), add support for emojis containing Zero Width Joiner (u200D) or Variation Selector-16 (uFE0F), PR #338
- 1.25
- 1.24
- 1.23
introduced: Environment values FORCE_COLOR, CLICOLOR_FORCE, and NO_COLOR overrides
blessed.Terminalargument value,force_stylingPR #295improved: performance of
rgb_downconvert()for 256-color terminals, PR #298.deprecated: Python 2.7 through 3.6 no longer supported. PR #299.
improved: keyboard support for modifier keys, PR #306.
introduced: kitty keyboard protocol support, PR #309.
introduced: mouse support, Synchronized Output, and support for DEC Private Modes, PR #310
introduced: methods to determine Sixel, dimensions and color depth PR #312
introduced: in-band resize support (DEC Private Mode 2048) PR #313
introduced: XTVersion identification: PR #314
bugfix: default timeout for get_bgcolor, get_fgcolor PR #315
- 1.22
- 1.21
- 1.20
introduced:
get_fgcolor()andget_bgcolor()to query the terminal for the currently set colors. #237 by stefanholekbugfix: Copy globals dict before iterating to avoid RuntimeError in multithreaded applications, #248 by adamnovak
- 1.19
introduced:
truncate()to truncate a string while retaining the sequences, #211 by fishermans-friendenhancement: Add small sleep in
kbhit()on Windows to reduce CPU load #209 by numerlorenhancement:
rjust(),ljust(), andcenter()now acceptSupportsIndextypes, #234enhancement: When 88 colors is detected, it is now interpreted as 16 colors rather than raising an
AssertionError, #235bugfix: Fix global variable declarations in type annotations, #230 by mwchase
- 1.18
- 1.17
introduced: Hyperlinks, method
link(), #116.introduced: 24-bit color support, detected by
term.number_of_colors == 1 << 24, and 24-bit color foreground methodcolor_rgb()and background methodon_color_rgb(), as well as 676 common X11 color attribute names are now possible, such asterm.aquamarine_on_wheat, #60.introduced:
term.move_xy, recommended over built-inmovecapability, as the argument order,(x, y)matches the return value ofget_location(), and all other common graphics library calls, #65.introduced:
move_up(),move_down(),Terminal.move_left(),move_right()which are strings that move the cursor one cell in the respective direction, are now also callables for moving n cells to the given direction, such asterm.move_right(9).introduced:
pixel_widthandpixel_heightfor libsixel support or general curiosity.introduced:
formatter()which returns callable formatters for valid text formatters such as ‘red’ or ‘bold_on_red’, returning aNullCallableStringif passed an invalid text formatter.bugfix: prevent
ValueError: I/O operation on closed fileonsys.stdinin multiprocessing environments, where the keyboard wouldn’t work, anyway.bugfix: prevent error condition,
ValueError: underlying buffer has been detachedin rare conditions where sys.__stdout__ has been detached in test frameworks. #126.bugfix: off-by-one error in
get_location(), now accounts for%iin cursor_report, #94.bugfix
split_seqs()and related functions failed to match when the color index was greater than 15, #101.bugfix: Context Managers,
fullscreen(),hidden_cursor(), andkeypad()now flush the stream after writing their sequences.bugfix:
chr(127),\x7fhas changed from keycodeterm.DELETEto the more common match,term.BACKSPACE, #115 by jwezel.bugfix: ensure
FormattingOtherStringmay be pickled.bugfix: Use
UTF-8for keyboard if input encoding cannot be determined.deprecated: the curses
move()capability is no longer recommended, suggest to usemove_xy(), which matches the return value ofget_location().deprecated:
superscript,subscript,shadow, anddimare no longer “compoundable” with colors, such as in phraseTerminal.blue_subscript('a'). These attributes are not typically supported, anyway. Use Unicode text or 256 or 24-bit color codes instead.deprecated: additional key names, such as
KEY_TAB, are no longer “injected” into the curses module namespace.bugfix: briefly tried calling
curses.setupterm()withos.devnullas the file descriptor, reverted. #59.deprecated:
inkey()no longer raises RuntimeError whenstreamis not a terminal, programs usinginkey()to block indefinitely if a keyboard is not attached. #69.deprecated: using argument
_intr_continueto methodkbhit(), behavior is as though such value is always True since 1.9.bugfix: Now imports on 3.10+
bugfix: Fix detection of shift+arrow keys when using tmux. #178.
enhancement: Instantiate SequenceTextWrapper only once in
wrap(). #184.
- 1.16
- 1.15
- 1.14
- 1.13
enhancement:
split_seqs()introduced, and 4x cost reduction in related sequence-aware functions, #29.deprecated:
blessed.sequences.measure_lengthfunction superseded byiter_parse()if necessary.deprecated: warnings about “binary-packed capabilities” are no longer emitted on strange terminal types, making best effort.
- 1.12
enhancement:
get_location()returns the(row, col)position of the cursor at the time of call for attached terminal.enhancement: a keyboard now detected as stdin when
streamissys.stderr.
- 1.11
enhancement:
inkey()can return more quickly for combinations such asAlt + ZwhenMetaSendsEscapeis enabled, #30.enhancement:
FormattingStringmay now be nested, such ast.red('red', t.underline('rum')), #61
- 1.10
workaround: provide
scandrcfor Terminals ofkind='ansi', repairinglocation()#44.bugfix: length of simple SGR reset sequence
\x1b[mwas not correctly determined on all terminal types, #45.deprecated:
_intr_continuearguments introduced in 1.8 are now marked deprecated in 1.10: beginning with python 3.5, the default behavior is as though this argument is always True, PEP-475, blessed does the same.
- 1.9
enhancement:
break_long_wordsnow supported byTerminal.wrap()Ignore
curses.errormessage'tparm() returned NULL': this occurs on win32 or other platforms using a limited curses implementation, such as PDCurses, wherecurses.tparm()is not implemented, or no terminal capability database is available.Context manager
keypad()emits sequences that enable “application keys” such as the diagonal keys on the numpad. This is equivalent tocurses.window.keypad().bugfix: translate keypad application keys correctly.
enhancement: no longer depend on the ‘2to3’ tool for python 3 support.
enhancement: allow
civisandcnorm(hide_cursor, normal_hide) to work with terminal-type ansi by emulating support by proxy.enhancement: new public attribute:
kind: the very same as givenTerminal.__init__.kindkeyword argument. Or, when not given, determined by and equivalent to theTERMEnvironment variable.
- 1.8
enhancement: export keyboard-read function as public method
getch(), so that it may be overridden by custom terminal implementers.enhancement: allow
inkey()andkbhit()to return early when interrupted by signal by passing argument_intr_continue=False.enhancement: allow
hpaandvpa(move_x, move_y) to work on tmux(1) or screen(1) by emulating support by proxy.enhancement: add
rstrip()andlstrip(), strips both sequences and trailing or leading whitespace, respectively.enhancement: include wcwidth library support for
length(): the printable width of many kinds of CJK (Chinese, Japanese, Korean) ideographs and various combining characters may now be determined.enhancement: better support for detecting the length or sequences of externally-generated ecma-48 codes when using
xtermoraixterm.bugfix: when
locale.getpreferredencoding()returns empty string or an encoding that is not valid forcodecs.getincrementaldecoder, fallback to ASCII and emit a warning.bugfix: ensure
FormattingStringandParameterizingStringmay be pickled.bugfix: allow ~.inkey and related to be called without a keyboard.
change:
term.keyboard_fdis setNoneifstreamorsys.stdoutis not a tty, makingterm.inkey(),term.cbreak(),term.raw(), no-op.bugfix:
\x1bOH(KEY_HOME) was incorrectly mapped as KEY_LEFT.
- 1.7
Forked github project erikrose/blessings to jquast/blessed, this project was previously known as blessings version 1.6 and prior.
introduced: context manager
cbreak(), which is equivalent to entering terminal state bytty.setcbreak()and returning on exit, as well as the lesser recommendedraw(), pairing fromtty.setraw().introduced:
inkey(), which will return one or more characters received by the keyboard as a unicode sequence, with additional attributescodeandname. This allows application keys (such as the up arrow, or home key) to be detected. Optional valuetimeoutallows for timed poll.introduced:
center(),rjust(),ljust(), allowing text containing sequences to be aligned to detected horizontal screen width, or bywidthspecified.introduced:
wrap()method. Allows text containing sequences to be word-wrapped without breaking mid-sequence, honoring their printable width.introduced:
strip(), strips all sequences and whitespace.introduced:
strip_seqs()strip only sequences.introduced:
rstrip()andlstrip()strips both sequences and trailing or leading whitespace, respectively.bugfix: cannot call
curses.setupterm()more than once per process (fromTerminal.__init__()): Previously, blessed pretended to support several instances of different Terminalkind, but was actually using thekindspecified by the first instantiation ofTerminal. A warning is now issued. Although this misbehavior is still allowed, awarnings.WarningMessageis now emitted to notify about subsequent terminal misbehavior.bugfix: resolved issue where
number_of_colorsfails whendoes_stylingisFalse. Resolves issue where piping tests output would fail.bugfix: warn and set
does_stylingtoFalsewhen the givenkindis not found in the terminal capability database.bugfix: allow unsupported terminal capabilities to be callable just as supported capabilities, so that the return value of
color(n) may be called on terminals without color capabilities.bugfix: for terminals without underline, such as vt220,
term.underline('text')would emit'text' + term.normal. Now it emits only'text'.enhancement: some attributes are now properties, raise exceptions when assigned.
enhancement: pypy is now a supported python platform implementation.
enhancement: removed pokemon
curses.errorexceptions.enhancement: do not ignore
curses.errorexceptions, unhandled curses errors are legitimate errors and should be reported as a bug.enhancement: converted nose tests to pytest, merged travis and tox.
enhancement: pytest fixtures, paired with a new
@as_subprocessdecorator are used to test a multitude of terminal types.enhancement: test accessories
@as_subprocessresolves various issues with different terminal types that previously went untested.deprecation: python2.5 is no longer supported (as tox does not supported).
- 1.6
Add
does_styling. This takesforce_stylinginto account and should replace most uses ofis_a_tty.Make
is_a_ttya read-only property likedoes_styling. Writing to it never would have done anything constructive.Add
fullscreen`()andhidden_cursor()to the auto-generated docs.
- 1.5.1
Clean up fabfile, removing the redundant
testcommand.Add Travis support.
Make
python setup.py testwork without spurious errors on 2.6.Work around a tox parsing bug in its config file.
Make context managers clean up after themselves even if there’s an exception (Vitja Makarov #29 <https://github.com/erikrose/blessings/pull/29>).
Parameterizing a capability no longer crashes when there is no tty (<Vitja Makarov #31 <https://github.com/erikrose/blessings/pull/31>)
- 1.5
Add syntactic sugar and documentation for
enter_fullscreenandexit_fullscreen.Add context managers
fullscreen()andhidden_cursor().Now you can force a
Terminalto never to emit styles by passing keyword argumentforce_styling=None.
- 1.4
Add syntactic sugar for cursor visibility control and single-space-movement capabilities.
Endorse the
location()context manager for restoring cursor position after a series of manual movements.Fix a bug in which
location()that wouldn’t do anything when passed zeros.Allow tests to be run with
python setup.py test.
- 1.3
Added
number_of_colors, which tells you how many colors the terminal supports.Made
color(n) andon_color(n) callable to wrap a string, like the named colors can. Also, make them both fall back to thesetfandsetbcapabilities (like the named colors do) if the termcap entries forsetafandsetabare not available.Allowed
colorto act as an unparametrized string, not just a callable.Made
heightandwidthexamine any passed-in stream before falling back to stdout (This rarely if ever affects actual behavior; it’s mostly philosophical).Made caching simpler and slightly more efficient.
Got rid of a reference cycle between
TerminalandFormattingString.Updated docs to reflect that terminal addressing (as in
location()) is 0-based.
- 1.2
Added support for Python 3! We need 3.2.3 or greater, because the curses library couldn’t decide whether to accept strs or bytes before that (https://bugs.python.org/issue10570).
Everything that comes out of the library is now unicode. This lets us support Python 3 without making a mess of the code, and Python 2 should continue to work unless you were testing types (and badly). Please file a bug if this causes trouble for you.
Changed to the MIT License for better world domination.
Added Sphinx docs.
- 1.1
Added nicely named attributes for colors.
Introduced compound formatting.
Added wrapper behavior for styling and colors.
Let you force capabilities to be non-empty, even if the output stream is not a terminal.
Added
is_a_ttyto determine whether the output stream is a terminal.Sugared the remaining interesting string capabilities.
Allow
location()to operate on just an x or y coordinate.
- 1.0
Extracted Blessed from nose-progressive.