Repository navigation
5.1.0
What's Changed
Security fixes 🛡
- Keep web display sessions private to their user: the session id was the name of a FIFO in the shared
pipe_dir, so any local user could list it, type into another user's application and read its screen. Session files now live in a0700directory per user under hashed names, the daemon runs withumask 077, andmax_clientscounts only the user's own sessions (GHSA-xm5p-pwm6-5w65) by @penguinolog in GHSA-xm5p-pwm6-5w65 - Keep control characters of a
Terminalchild off the host terminal: a child that selected the IBM PC character set could run OSC 52, OSC 2 or CSI commands on the host terminal through a UTF-8 encoded C1 control; also see "Bug fixes" below: Harden the displays against hostile input and failed start or stop by @penguinolog in #1599 - Stop buffering an over-long DECRPM reply from terminal input, which grew memory without limit and took quadratic time, and apply a DECRPM reply only as the answer to a query the raw display sent, so pasted text shaped like a reply cannot switch terminal modes by @penguinolog in #1599
Major features 🗹
- Add
Table: a fixed header over a scrolling body of rows whose columns share their widths, withTableColumn(packed, given or weighted width, per-column attribute map),TableRowandTableLayoutfor shared widths outside aTableby @penguinolog in #1550 and #1559 - Add
Tabs: a row of tab labels over the selected tab's body, with overflow markers, an optional underline row, theCommand.NEXT_TABandCommand.PREVIOUS_TABcommands and the"focus changed"signal by @penguinolog in #1566 and #1594 - Add
Edit(placeholder=...), whole-value validation (validator=,Severity,ValidationMessage, the"validation"signal) and completion (text_completer=, the"completion_cycle"signal) by @penguinolog in #1561 - Add readline editing commands and
CommandMap.bind_readline(),Edit(undo_limit=...)with undo and redo, andEdit(kill_buffer=...)with yank by @penguinolog in #1565 - Keep the focus child marked while a container is unfocused:
Pile,Columns,ListBoxandGridFlowtakeunfocused_focus_attr=by @penguinolog in #1549 - Add
get_running_loop()andget_running_loop_or_none()for theMainLoopof the current thread and task; aTerminalbuilt withoutmain_loop=watches its pty on the running loop and shows the child's output by @penguinolog in #1569
New features 🗹
- Add
MainLoop.call_from_thread()to run a callback on the loop thread from another thread or a signal handler, andMainLoop(poll_interval=...)for screens without event loop support, such as curses by @penguinolog in #1573 - Add a WebSocket display,
urwid.display.websocket.Screen, that any HTTP server library can drive,GuardedEventLoopto keep one application's error off a shared event loop, andexamples/websocket_tornado.pyby @penguinolog in #1597 - Add
OverlayStack: nested dialogs over a base widget, optionally closed on Esc or a click outside by @penguinolog in #1592 - Add
FilteredListWalker: a read-only filtered view over a list or deque walker by @penguinolog in #1593 - Add
Notifications: timed messages for a footer or a status line by @penguinolog in #1572 - Add
Spinner: an activity indicator for work without a total by @penguinolog in #1585 - Send
"menu"fromOverlaywhen its top widget leaves Esc unhandled by @penguinolog in #1547 - Close pop-ups and
Overlaydialogs on a click outside them: theOverlaysignal"click outside"andPopUpLauncher(close_on_click_outside=True), whichDropDownturns on by @penguinolog in #1570 - Send
"focus changed"fromFrameby @penguinolog in #1563 - Add
RadioButton.selected_buttonby @penguinolog in #1562 - Add the
Editsignal"cancel", sent on the menu key (Esc) by @penguinolog in #1582 - Add
ListBox(edge="stop"): Up and Down stop at the ends of the list instead of leaving it by @penguinolog in #1583 - Add
TreeWidget.Symbols(TreeSymbols), tree icons of any width,TreeWidget.leaf_iconand connector lines by @penguinolog in #1571 - Add
MouseButton: named mouse buttons, including the horizontal wheel and the back and forward buttons by @penguinolog in #1579 - Add
Screen.set_title()for the terminal window title; the raw display restores the previous title on stop by @penguinolog in #1578 - Add
Screen.copy_to_clipboard()over OSC 52 by @penguinolog in #1580 - Add
InputClosedError, aRuntimeErrorthe raw display raises when its input reaches end of file by @penguinolog in #1581 - Add
BaseScreen.palette, a read-only view of the registered palette, andregister_palette(..., replace=True)by @penguinolog in #1588 - Add hex digits, brackets and math signs to the BigText fonts by @penguinolog in #1591
Deprecations ⚡
- Deprecate the LCD display module,
urwid.display.lcd, for removal in 6.0 by @penguinolog in #1587
Bug fixes 🕷
Containers and layout
- Hide zero-height
Pilerows from the cursor and keys by @charan-rathore in #1543 - Skip hidden
Pilerows andColumnscolumns in focus moves by @penguinolog in #1545 - Move the
Columnsfocus only to columns the last layout drew: aColumnswider than the screen no longer scrolls to a hidden column by keys by @penguinolog in #1550 - Keep weighted
Pilerow heights the same for every focus position, and redraw a container when a child it did not draw changes size by @penguinolog in #1564 - Redraw widgets when a layout attribute is assigned, such as
Padding.leftorOverlay.topby @penguinolog in #1546 - Measure a flow-sized
Overlaytop widget at the width it is rendered at, so its last rows are no longer cut off; render a fixed-only widget in a given-widthPaddingby @penguinolog in #1596 - Pack and render a fixed-only widget in
LineBoxby @penguinolog in #1590 - Cut a
LineBoxtitle wider than the box with an ellipsis by @penguinolog in #1548
Widgets, lists and walkers
- Report one focus move when
ListBoxcompletesset_focus()by @penguinolog in #1544 - Do not fail when a
ListBoxwith no rows is drawn or gets a key by @nk-batman21 in #1552 - Notify after partially extending a monitored deque by @charan-rathore in #1553
- Draw
ScrollBarend markers only from 4 rows by @penguinolog in #1558 - Make a
DropDownwith a single option read-only by @penguinolog in #1560 - Clear the group when a
RadioButtonis created selected by @penguinolog in #1577 - Fix
BarGraphrows for interleaved segments of adjacent bars, which raisedBarGraphErroror drew the wrong colours by @rahul05ranjan in #1538
Displays and terminals
- Clear
IEXTENandFLUSHOin the raw and curses displays, so ctrl v, ctrl o and ctrl y reach the application on macOS and the BSDs by @penguinolog in #1589 - Keep the closed-input error when the terminal hangs up by @penguinolog in #1576
- Restore the terminal when a display start or stop fails, stop the curses input spinning once the terminal is gone, keep curses mouse positions past column or row 222, and decode curses mouse events on PyPy; also see "Security fixes" above by @penguinolog in #1599
- Remove the
Terminalpty watch by its handle, which left the watch registered on tornado and raisedAttributeErroron trio by @penguinolog in #1568 - Run
watch_file()andwatch_pipe()callbacks in the main loop of a screen without event loop support, such as curses by @penguinolog in #1569 - Let the CF635 LCD screen run under
MainLoopagain by @penguinolog in #1575 - Free an
Overlay,FrameorListBoxwithout a cycle collection after itscontentswas read, and close only the owned loop when anAsyncioEventLoopis finalised while another asyncio loop runs by @penguinolog in #1592
Performance 🛠
- Speed up
PileandColumnssizing loops (up to 19% less time forPile.rowsandkeypress) by @penguinolog in #1595 - Speed up
Pilesizing with 0-high rows (27% less time) by @dexhunter in #1574 - Speed up
Overlayrendering (up to 14% less time for nested dialogs) by @penguinolog in #1596
Documentation 🕮
- Rebuild the calc example: two tabs, big digits and themes; it replaces
examples/pop_up.pyby @penguinolog in #1598
New Contributors
- @rahul05ranjan made their first contribution in #1538
- @dexhunter made their first contribution in #1574
Full Changelog: 5.0.1...5.1.0