Skip to content

v0.67.1 - select_existing finds literal names

Latest

Choose a tag to compare

@tony tony released this 23 Nov 01:15

libtmux 0.67.1 fixes Session.new_window() with select_existing=True, which now finds a window by its literal name on every tmux and returns it instead of raising IndexError, and the format guide now says what a format can run.

Highlights

  • select_existing=True finds a literal name on every tmux. libtmux now looks the window name up itself instead of relying on tmux's new-window -S, which matches a name differently per release: tmux 3.3a compared the escaped name, so a name containing #, %, , or } created a duplicate window, and tmux 3.7 and later expanded it a second time, so a name like #{session_name} could select another window. A Format name is expanded once against the session, then looked up. The existing window is returned and selected only with attach=True, and two windows with the name raise LibTmuxException. With window_index or target_window, tmux's -S still decides (#917).
  • The format guide says what a format can run. A Format hands its text to tmux's format language, which runs #(...) as a shell command and expands an option's value again through E: and T:. The guide now says so, and that a plain str from a user passed to an argument tmux always expands, such as display_message, runs any #(...) it contains; Format.escape() shows such text exactly (#915).

Two limits of the select_existing lookup: the lookup and the creation are separate tmux commands, so two callers can both create the window, and a name containing a backslash is not found once tmux stores it escaped (after rename_window, and for any new window from tmux 3.7).

See Literal text and tmux formats and the changelog for details.

What's Changed

  • docs(formats): Say what a format can run by @tony in #915
  • Session(fix[new_window]): Look up reuse by name by @tony in #917

Full Changelog: v0.67.0...v0.67.1