Enable partial-width prompt overlay with additional message-* options#4861
Enable partial-width prompt overlay with additional message-* options#4861taylorconor wants to merge 2 commits intotmux:mastertmux/tmux:masterfrom taylorconor:ct-custom-promptlinetaylorconor/tmux:ct-custom-promptlineCopy head branch name to clipboard
Conversation
|
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 |
|
What I'm suggesting would mean it could work like And If you want the ability to set the width I suggest adding a |
|
Thanks for the feedback! I've reworked the approach as suggested. Here's the changes in the updated commit:
Example configuration for a centered half-width prompt: The |
|
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.
2d7416e to
ca66f58
Compare
|
Oops my bad. Rebased! |
|
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 Similarly, why do you need to pull I think there should only be one 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... |
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
message-format#{message}message-margin0message-positionmessage-min-width0message-positionleftleft,centre,right)message-width100%auto)Visual example
Before (current behavior) -- the entire status line is replaced by the prompt:
After -- the prompt overlaysonly part of the status line, tabs and clock remain visible:
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
message-format,message-margin,message-min-width,message-position, andmessage-widthoptionsstatus_prompt_area()geometry calculation andstatus_prompt_draw_format()decoration helper; modifystatus_prompt_redraw(),status_message_redraw(),status_prompt_complete_list_menu(), andstatus_prompt_complete_window_menu()to use constrained prompt areaImplementation 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 inmessage-formatis handled by splitting the raw format string beforeformat_expand_time()so it survives expansion as a split point, then drawing the left/right decoration parts separately viaformat_draw().Testing notes
message-width 50%+message-position centre: tabs visible on both sides of promptmessage-width 50%+message-position right+message-margin 20: prompt inset from right edgemessage-width 20%+message-min-width 30: area clamps to 30 columns on narrow percentagesmessage-width auto: sizes to content, rounds to 10-column incrementsmessage-formatwith#[style]directives: powerline arrows render correctlystatus-position top/bottom, multi-line status bar, andstatus off