Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Enable partial-width prompt overlay with additional message-* options#4861

Open
taylorconor wants to merge 2 commits intotmux:mastertmux/tmux:masterfrom
taylorconor:ct-custom-promptlinetaylorconor/tmux:ct-custom-promptlineCopy head branch name to clipboard
Open

Enable partial-width prompt overlay with additional message-* options#4861
taylorconor wants to merge 2 commits intotmux:mastertmux/tmux:masterfrom
taylorconor:ct-custom-promptlinetaylorconor/tmux:ct-custom-promptlineCopy head branch name to clipboard

Conversation

@taylorconor
Copy link

Overview

Allow prompts and messages to occupy only a portion of the status bar, overlaying the normal status content rather than replacing the entire line.

Currently, when the command prompt or a message is displayed, it overwrites the entire status line. This hides all window tabs and status information. With these changes, users can configure the prompt to occupy only part of the status bar (e.g. 20% right-aligned with a margin and minimum width), keeping the surrounding status content visible.

New options

Option Type Default Description
message-format string #{message} Format string wrapping prompt content with decorations
message-margin number 0 Column offset between the message area and the status line edge determined by message-position
message-min-width number 0 Minimum width of the message area in columns
message-position choice left Horizontal position (left, centre, right)
message-width string 100% Width of prompt/message area (percentage, absolute, or auto)

Visual example

Before (current behavior) -- the entire status line is replaced by the prompt:

(rename-window) bash

After -- the prompt overlaysonly part of the status line, tabs and clock remain visible:

1:bash   2:bash   3:bash   4:bash                | (rename-window) bash    | Sun Feb 15  22:20

Backwards compatibility

Default values (message-width "100%", message-position "left", message-margin 0, message-min-width 0, message-format "#{message}") produce identical behavior to the current release. No visual change for users who do not configure the new options.

Files changed

  • options-table.c -- Register message-format, message-margin, message-min-width, message-position, and message-width options
  • status.c -- Add status_prompt_area() geometry calculation and status_prompt_draw_format() decoration helper; modify status_prompt_redraw(), status_message_redraw(), status_prompt_complete_list_menu(), and status_prompt_complete_window_menu() to use constrained prompt area
  • tmux.1 -- Document the five new options

Implementation approach

The rendering follows the existing "copy base status, then selectively overwrite" pattern. The only change is reducing the overwrite region from full-width to the computed prompt area. The #{message} marker in message-format is handled by splitting the raw format string before format_expand_time() so it survives expansion as a split point, then drawing the left/right decoration parts separately via format_draw().

Testing notes

  • Default configuration (no new options set): identical output to current release
  • message-width 50% + message-position centre: tabs visible on both sides of prompt
  • message-width 50% + message-position right + message-margin 20: prompt inset from right edge
  • message-width 20% + message-min-width 30: area clamps to 30 columns on narrow percentages
  • Long input with constrained width: existing scroll logic works within the narrower area
  • Tab completion menus: correctly offset by prompt area position
  • message-width auto: sizes to content, rounds to 10-column increments
  • message-format with #[style] directives: powerline arrows render correctly
  • Works with status-position top/bottom, multi-line status bar, and status off

@nicm
Copy link
Member

nicm commented Feb 16, 2026

I like the idea but I think this should be expressed through styles and not options, we are trying to move away from multiple options for styling the same thing. It would be better to make it so the message is drawn on top of the existing status line as standard and message-style (or message-format) must contain a fill directive if it is to be cleared (the default can do this).

@nicm
Copy link
Member

nicm commented Feb 16, 2026

What I'm suggesting would mean it could work like status-format and the default message-format could be something like:

#[#{E:message-style}]#{message}

And message-style something like:

align=left fill=yellow bg=yellow

If you want the ability to set the width I suggest adding a width directive for styles. This could take either a fixed width (<= max available) or a %.

@taylorconor
Copy link
Author

Thanks for the feedback! I've reworked the approach as suggested.

Here's the changes in the updated commit:

  • Removed message-width, message-position, message-margin, and message-min-width options entirely. Width and position are now expressed through style directives on message-style.

  • Added percentage support to the width style directive (width=50%), so message-style can set either a fixed width or a percentage of available space.

  • Changed the default message-format to #[#{E:message-style}]#{message}, so the format references the style directly.

  • Added fill to the default message-style (bg=yellow,fg=black,fill=yellow) and message-command-style (bg=black,fg=yellow,fill=black). The message is now always drawn on top of the existing status line, and the fill directive controls whether the background is cleared. Removing fill from the style would leave the status bar content visible behind the message text.

  • The align directive on message-style controls horizontal position (left, centre, right) of the prompt area within the status line.

Example configuration for a centered half-width prompt:

set -g message-style "bg=yellow,fg=black,fill=yellow,align=centre,width=50%"

The message-format option is still available for adding decorations (powerline arrows etc.) around #{message}, but the geometry is entirely driven by the style.

@taylorconor taylorconor marked this pull request as ready for review February 17, 2026 05:17
@nicm
Copy link
Member

nicm commented Feb 17, 2026

This looks good, but it has your neighbour stuff as well, could you take that out? (Need to take a look at that when I have time, sorry for delay...)

…h, and message-format options

Allow prompts and messages to occupy only a portion of the status
line, overlaying the normal status content rather than replacing the
entire line. Tabs and status-left/status-right remain visible around
the prompt area when a non-full-width prompt is configured.
@taylorconor
Copy link
Author

Oops my bad. Rebased!

@nicm
Copy link
Member

nicm commented Feb 18, 2026

The code looks good but I don't like how this is building the screen based on information that is not in the format.

If you want part of the text to be on the right you should have to say #[align=right]. I don't think having it mysteriously infer what is left and what is right based on where it is relative to #{message} is intuitive.

Similarly, why do you need to pull fill out of message-style? What happens if I set message-format to #[fill=blue]#{message} instead? Ideally message-style should not be checked in C code but instead embedded in message-format as something like #[#{?command_mode,#{E:message-command-style},#{E:message-style}}].

I think there should only be one format_draw call and it should take care of everything, it already understands how to align to left and right. Take a look at status.c:453 - it sets up the screen, then calls format_draw to draw the entire status line. Can we not do the same for this? Except instead of clearing the status line, we start by copying the existing one to draw the message on top.

It may need some tweaks to the formats to handle width - it may need to differentiate between "available width" (the total draw area) and the width the user wants (ie "width=X"). I can't remember how that is handled right now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.