Commit Graph

207 Commits

Author SHA1 Message Date
Michael Grant
56e9ca2dbe screen-redraw: erase only cells a pane owns, not its raw rectangle
image_redraw_start() was called with a pane's full nominal geometry
rather than the cells it actually owns in the current scene. When a
floating pane occluded part of that rectangle, the erase blanked the
floating pane's on-screen content, and the following text redraw
correctly skipped those cells (not owned by this pane), leaving them
blank with nothing to restore them.
2026-08-25 11:23:52 +01:00
Michael Grant
047308b156 image: retain ordered placements in the grid
Replace the per-cell image marker with sparse placement spans attached to
grid lines. A placement owns all of its spans and records the input
protocol, application image and placement IDs, z-index, and creation order.

This retains overlapping image layers without storing a list in every grid
cell. Grid operations move, split, clip, and remove only the affected spans.

Use the input protocol to determine image/text interaction: later text
damages SIXEL spans, while Kitty placements remain and are ordered by their
z-index. Rendering then adapts that one logical scene for each client,
rather than changing its semantics according to whether the outer terminal
uses Kitty or SIXEL.
2026-08-25 11:23:52 +01:00
Michael Grant
b6dbf10057 Redraw SIXEL images before or after text depending on which was placed first in the cell. 2026-08-25 11:23:52 +01:00
Michael Grant
03efb5e293 Preserve text behind transparent Kitty images. 2026-08-25 11:22:26 +01:00
Michael Grant
d8da527882 Refactor to centralize image-specific rendering and lifecycle code in image.c and the image-* backends. 2026-08-25 11:22:26 +01:00
Michael Grant
d601d0d8c5 Fix image flickering. 2026-08-25 11:22:26 +01:00
Michael Grant
f72e789240 Initial commit. Implement generalised image support. 2026-08-25 11:22:26 +01:00
Michael Grant
48e33179d4 server-client, popup, screen-redraw: fix damage-system regressions
Fixes the four bugs caught by the regression tests added in aed1209c
(popup-drag-status-line.sh, popup-drag-wide-character.sh,
popup-drag-pane-prompt.sh, switch-client-redraw.sh), based on fixes
from Michael K. Darling (github.com/darlingm/tmux, pr5516-regression-
fixes), reviewed and adapted:

- server-client.c: server_client_set_session()'s check for whether the
  client's window actually changed compared old->curw to s->curw, but
  when old == s these read the same, already-updated field, so a
  same-session window switch was never detected. Compare against the
  client's own cached redraw scene instead (redraw_client_has_window(),
  new in screen-redraw.c/tmux.h). Taken from darlingm as-is.

- popup.c: popup_damage() only translated a popup's client-coordinate
  rectangle into window coordinates, so a popup dragged across the
  status line never triggered a status-line redraw once it moved away -
  status_redraw()'s own "skip if content unchanged" optimization
  suppressed it, since only the popup moved, not the status content.
  Now detects overlap with the status line and forces a redraw via the
  existing (previously unused) CLIENT_REDRAWSTATUSALWAYS flag, and
  properly clips the reported rectangle to the pane area for
  status-at-top/bottom/off. Taken from darlingm as-is.

- screen-redraw.c: redraw_draw_damage_rect() clipped a span to a damage
  rectangle's raw geometric edges, which have no idea what's in the
  grid, so a clip edge could land mid-character and tear a wide
  character in half. Added redraw_damage_grow_span_clip(): widen the
  clip by one cell on each edge that isn't already at the span's own
  boundary. Reimplemented simpler than darlingm's version (which walked
  grid cells per span type via a switch and direct grid lookups) -
  since no grid cell is ever wider than two columns, an unconditional
  one-cell margin is always enough to pull a split character back in,
  with no need to inspect grid content at all.

- screen-redraw.c: redraw_draw_damage_rect() also never re-overlaid a
  pane's active in-pane prompt after drawing its underlying content, so
  damage crossing a prompt row erased it until an unrelated redraw
  restored it. Factored the existing full-redraw prompt-building code
  into a shared redraw_make_pane_prompt() helper and added
  redraw_damage_draw_pane_prompt(), which recomposes the prompt over
  the drawn range. Taken from darlingm as-is.

All 9 regression tests in regress/ now pass. redraw_damage_grow_span_clip
was verified independently by disabling it and confirming
popup-drag-wide-character.sh reproduces its original failure.

Co-Authored-By: Michael K. Darling <darlingm@gmail.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 10:25:29 +01:00
Michael Grant
d6074895bb screen-redraw, screen-write: add damage-rectangle tracking and composition
Introduce a per-window list of damaged rectangles (struct redraw_damage)
and redraw_damage_window() to record them, redraw_client_damage() to
consume them by composing exactly the damaged cells (via a new
redraw_draw_damage_rect(), which also force-refreshes any pane-status
span it touches, since window_make_pane_status()'s content-diff check
has no way to know the physical cells were disturbed by something else).

redraw_draw_span() now takes an explicit [clip_x, clip_x + clip_n) range
instead of always drawing a span's full width, so a damage rectangle can
redraw just the portion of a span it actually covers.

screen_write_redraw_cb() - the fallback when a write can't be applied
directly to the terminal - now reports damage for just the affected row
via this mechanism, instead of unconditionally flagging the whole pane
for a full redraw.
2026-08-22 15:45:29 +01:00
tmux update bot
29bf7fe2f7 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Replace outside as well as empty cells with the border.
2026-07-24 11:46:46 +00:00
nicm
47f210a9d2 Replace outside as well as empty cells with the border. 2026-07-24 11:46:45 +00:00
tmux update bot
190b5bde16 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Extend fill-character to allow inside and outside to be separate and use a different default (filled characters rather than dots) for inside.
2026-07-23 11:33:53 +00:00
nicm
8862390c34 Extend fill-character to allow inside and outside to be separate and use
a different default (filled characters rather than dots) for inside.
2026-07-23 11:33:52 +00:00
tmux update bot
7abb9af062 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Clip floating panes exactly at window edge, don't let the border creep into the first outside column.
  Invalidate scene when window is resized.
  Add a -C flag to new-pane to have a modal pane close when the mouse is clicked outside it, GitHub issue 5400.
2026-07-21 15:06:24 +00:00
nicm
a57b0f1282 Clip floating panes exactly at window edge, don't let the border creep
into the first outside column.
2026-07-21 15:06:22 +00:00
tmux update bot
92f090c0c0 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  If drawing border but not actually on a border, use the default line style.
  Add copy-mode-current-line-style to set style for current line in copy mode, GitHub issue 5391 from Leo Henon.
2026-07-21 12:55:45 +00:00
nicm
9d583cad5a If drawing border but not actually on a border, use the default line
style.
2026-07-21 12:55:44 +00:00
tmux update bot
6dacc024f0 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Remove the active-pane flag for now, there are some gaps in how this works and I don't like it. May come back in a different form (maybe just for windows).
2026-07-17 14:08:10 +00:00
nicm
1ce000062a Remove the active-pane flag for now, there are some gaps in how this
works and I don't like it. May come back in a different form (maybe just
for windows).
2026-07-17 14:08:08 +00:00
tmux update bot
f07ea87e20 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Do not redraw overlays unless actually asked to, GitHub issue 5398 from Noam Stolero.
2026-07-16 12:54:46 +00:00
nicm
824a07290f Do not redraw overlays unless actually asked to, GitHub issue 5398 from
Noam Stolero.
2026-07-16 12:54:45 +00:00
tmux update bot
4e586ed0b8 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  Switch menus also to be attached to the window instead of an overlay and drawn as part of the client's scene. This means removing the popup menu.
2026-07-14 22:13:52 +00:00
nicm
ad6832e697 Switch menus also to be attached to the window instead of an overlay and
drawn as part of the client's scene. This means removing the popup menu.
2026-07-14 22:13:51 +00:00
Thomas Adam
25e2e1d671 Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master:
  build: don't exit
  build: always attempt portable merge
  build: capture openbsd-base before filtering
  build: fetch cutover master before merge
  Use _exit in child after fork, from Yayo Razo in GitHub issue 5376.
  Add missing calloc check and use fatal. Prompted by a similar change from Yayo Razo.
  actions: use published openbsd-git as base update
  github actions: automate updates
  Do not make pty fds blocking again until all the data has been consumed or control mode clients can get stuck, GitHub issue 5356 from Ben Maurer.
  Add formats and events for OSC 133 commmands, as well as a -T flag to set-hook -B to only fire when the format is true.
  Replace the notification system with events. Events can carry a payload of additional payload (to reduce problems with lifetime of objects) and are delivered to one or more event sinks. This is more powerful and reduces the complex dependencies between control mode and hooks. Events are now used for hooks, control mode notifications and for monitors (set-hook -B).
2026-07-13 09:22:25 +01:00
nicm
d29aa12117 Replace the notification system with events. Events can carry a payload of
additional payload (to reduce problems with lifetime of objects) and are
delivered to one or more event sinks. This is more powerful and reduces the
complex dependencies between control mode and hooks. Events are now used for
hooks, control mode notifications and for monitors (set-hook -B).

wait-for can now wait for an event to fire (-E flag, with -F to for filter),
with -v to print the payload, as well as listing (-l) waiting clients on an
event and forcing one to wake (-w).

A few additional hooks are also now available (pane-created, pane-resized, etc)
and some of the existing ones have additional format variables available.
2026-07-10 13:38:45 +00:00
Thomas Adam
7ac0d6bead Merge branch 'obsd-master' 2026-07-09 09:00:06 +01:00
nicm
e242da168b Clip the status line and menu against an open popup overlay, GitHub
issue 5350 from Noam Stolero.
2026-07-09 07:32:58 +00:00
Thomas Adam
53f3b05001 Merge branch 'obsd-master' 2026-07-08 10:30:05 +01:00
nicm
8e76565c9c Keep all modes except cursor during redraw, GitHub issue 5337 from Ayman
Bagabas.
2026-07-08 09:23:10 +00:00
Thomas Adam
1818b6ac16 Merge branch 'obsd-master' 2026-07-01 17:52:07 +01:00
nicm
565db46a19 Instead of fully redrawing the pane when sync ends, only redraw lines
that have been changed.
2026-07-01 15:44:13 +00:00
Thomas Adam
543d104f85 Merge branch 'obsd-master' 2026-06-29 20:15:07 +01:00
nicm
e06207c914 Cache scrollbar options in window to avoid a slow lookup when working
out visible ranges.
2026-06-29 19:03:34 +00:00
Thomas Adam
d5284be91d Merge branch 'obsd-master' 2026-06-29 09:00:09 +01:00
nicm
c29b41e527 Make pane scrollbars able to auto-hide after a short timeout. This
replaces the previous "modal" behaviour where the pane would be resized,
which tended to make a mess. Instead, the scrollbar appears when
scrolling or when hovered over with the mouse and disappears a
(configurable) short period later. From Michael Grant.
2026-06-29 07:45:09 +00:00
Thomas Adam
0b538b6f2a Merge branch 'obsd-master' 2026-06-25 13:29:53 +01:00
nicm
51d037e881 Major rework of prompts. The basic prompt mechanics (draw, editing, etc)
are now wrapped up in prompt*.c and do not depend on a client. These
functions are used to provide the original client prompt but also to
allow panes to have their own prompts, which works much much better for
floating panes. The mode prompts for both the tree modes and copy mode
are switched over to be per pane.

There are some visible changes (some of these may be changed if they
don't seem to be working well):

- Prompts in modes now appear in the bottom line, covering whatever
  content was there.

- command-prompt has a -P flag to open a pane prompt.

- Because they cover the content, the default style for prompts in modes
  now does not fill the entire line; the main command prompt stays the
  same.

- The old completion menu has gone, and completions are now shown after
  the text. Builtin aliases are no longer completed.

- Clicking the mouse on the prompt now moves the cursor or selects a
  completion.
2026-06-25 11:39:11 +00:00
Nicholas Marriott
505d557fbb Fix SIXEL, from Marc Haesen. 2026-06-23 15:48:02 +01:00
Nicholas Marriott
51b787e449 Fix SIXEL build. 2026-06-23 09:06:43 +01:00
Thomas Adam
52877c9af1 Merge branch 'obsd-master' 2026-06-23 07:35:51 +01:00
nicm
95afd7549c Rewrite screen-redraw.c to make it tidier and more maintainable. A scene
is generated and cached in the client: it holds positions and sizes of
panes, borders and so on. The scene is invalidated when a pane is moved
or resized or relevant option is changed. This scene is then drawn to
the client as needed and text and colours are filled in. With Michael
Grant.
2026-06-22 08:47:45 +00:00
Thomas Adam
c6b8ad6e7e Merge branch 'obsd-master' 2026-06-18 11:15:07 +01:00
nicm
d92a479d2f Add a dim= style attribute to dim the colours (as best as tmux is able
to). GitHub issue 4842.
2026-06-18 09:59:55 +00:00
Thomas Adam
6cb2233cd2 Merge branch 'obsd-master' 2026-06-16 12:55:00 +01:00
nicm
9ad75e1dc3 Rename the visible ranges functions since they really relate to windows
and put them nto a new file.
2026-06-16 10:47:35 +00:00
Thomas Adam
1d026b921c Merge branch 'obsd-master' 2026-06-16 10:15:14 +01:00
nicm
d2c23773ff Fix missing border when drawing floating panes. From Michael Grant. 2026-06-16 08:53:14 +00:00
Thomas Adam
408e9f1481 Merge branch 'obsd-master' 2026-06-15 23:00:06 +01:00
nicm
482e254a49 Rename window_pane_visible to match other functions, from Dane Jensen. 2026-06-15 21:47:01 +00:00
Thomas Adam
9031f59f7b Merge branch 'obsd-master' 2026-06-15 19:00:06 +01:00