* feat(plugin-api): let a plugin give its layout space back while empty
A plugin mounted in a layout as a bar keeps the row the layout reserved
for it even when it has nothing to draw, so an empty bar shows as a blank
line. Nothing in the plugin API could give that row up: HideSelf
suppresses the pane and brings it back through add_tiled_pane, which
re-inserts it by splitting rather than at its layout position, and
CloseSelf does not come back at all.
SetSelfCollapsed takes the pane out of the constraint solve without
taking it out of the layout. The pane keeps its size constraint while it
is out, so a Fixed(1) bar is still Fixed(1) when it rejoins and expanding
restores exactly what the layout asked for, while constrain_spans makes
its neighbors grow over the space in the meantime.
Collapsed panes are tracked separately from panes_to_hide, which
fullscreen overwrites wholesale, so a collapse survives entering and
leaving fullscreen. They are also left out of the viewport offset, since
a pane holding no space must not shrink the viewport, and their state is
dropped when the pane closes so a reused pane id does not arrive already
invisible.
* test(tab): cover collapsing a pane out of the layout and back
Pins down what the collapse is for: the neighbors take the space, the
collapsed pane keeps its size constraint so expanding restores the layout
exactly rather than approximately, and the collapse outlives a fullscreen,
which rebuilds the hidden set from scratch.
Also covers the two ways it should do nothing: a second collapse of an
already collapsed pane, and a pane id that is not in the tab. Closing a
collapsed pane drops the state, so a reused id does not come back
invisible.
* fix(screen): keep one deferred collapse per pane instead of a queue
A plugin sends this whenever its content comes and goes, so a plugin
with no pane in any tab would otherwise leave an entry behind on every
change, all of them replayed the next time a tab is created. Only the
most recent word on a pane means anything, so drop the earlier one.
* fix(tab): keep a collapsed pane's geometry current across a relayout
Being filtered out of the constraint solve is what stops a collapsed pane
from holding space, but it also means nothing writes geometry to it. That
was fine while the tab kept its shape and wrong the moment it did not: the
pane was left describing a display area that no longer existed.
Worse than stale, because the solver reads the layout tree back off where
the panes currently sit. A one-row bar collapsed in a 121x20 tab that then
became 118x23 stayed at y 19 in a tab whose last row was 22, so the next
solve was handed a tree that did not match the screen and gave up. The bar
came back three rows above the bottom, at a width wider than the tab, and
its neighbor never gave the row back.
Let collapsed panes take part in the resize and the relayout, then collapse
them again over the result, which is what fullscreen already does a few
lines above for the same reason.
* docs(changelog): note the plugin collapse command
Links the tracking issue rather than a pull request, since no pull
request is open yet. Wants updating to the pull request URL once there
is one, to match every entry in the released sections.
* fix(tab): give a collapsed pane's row back to the viewport after a relayout
A relayout solves with the collapsed panes taking part, and the layout
offsets the viewport while they are still there. Collapsing them again
afterwards handed their rows back to the panes around them, but not to the
viewport, so a collapsed bar went on holding its row out of it until the
next resize. Fullscreen reads the viewport, so it would not cover that row
either.
Offset the viewport again once the collapsed panes are gone, the same as
resize_whole_tab already does.
* refactor(tiled-panes): keep the hidden pane bookkeeping in PanesToHide
Fullscreen and collapse both hide tiled panes, and each needs to undo only
what it hid. Until now that was done by keeping collapsed panes in a set of
their own and rebuilding panes_to_hide from both sources whenever either
changed, which every caller had to remember to do.
panes_to_hide is now a PanesToHide struct that tracks the two reasons
separately: panes beneath a fullscreen pane, and covered panes such as a
plugin that collapsed itself. set_fullscreen and unset_fullscreen only
touch the first, set_covered and unset_covered only the second, so a
covered pane stays hidden across a fullscreen without any rebuilding, and
the fullscreen pane itself is never hidden.
add_to_hidden_panels and remove_from_hidden_panels had no callers and
wrote straight into the set, so they are gone.
* fix(plugin-api): collapse the slot being rendered for a shared plugin
set_self_collapsed sent env.plugin_id, which for a shared plugin is the
instance and not any of its panes, so a shared plugin such as the bundled
bars could not collapse at all. Resolve the pane through self_pane_id like
the other self commands do, and list SetSelfCollapsed in is_self_command so
a shared plugin can only use it while a slot is current.
* feat(plugin-api): let a shared plugin collapse a slot by id
The other self commands have a slot form that names the pane outright, so
a shared plugin can use them from update or pipe, where no slot is current
and the self form is refused. set_collapsed_slot does the same for
set_self_collapsed, with the ownership check and response the other slot
commands give.
* fix: resurrection, covering selectable panes, mouse clicks, closing, paneinfo
* rebuild assets
---------
Co-authored-by: Aram Drevekenin <[email protected]>
* ui components
* right click menu + popups
* settings screen
* various fixes
* presets in config
* zellij prompt - ui elements in the cli
* context menu shortcuts and toggle, keybindings in popups, info popups + zellij prompt notify
* smart config writing and some leftovers
* keybindings/right-click/config editors
* some wrapups
* feat(plugins): add prompt() plugin API for zellij:prompt, dialog forms, and Text labels in widgets
* theme editors
* upstream by-id action types, config env for new panes only, smaller saved menu config, web right-click, example config
* upstreamify
* rustfmt
* fix windows and theme editor layout
* add pr
* fix(screen): keep sending events to suppressed plugin panes
A plugin that hides itself (hide_self, hide_pane_with_id or hide_slot)
moves into the tab's suppressed panes. Event delivery only looked at the
tiled and floating panes, so a hidden plugin stopped receiving ModeUpdate,
TabUpdate, PaneUpdate and InputReceived, and could never learn that it
should show itself again.
Include suppressed plugin panes when updating input modes and when picking
the plugins for a broadcast event. Render targeting and the client visible
plugins report still use get_plugin_ids, so a suppressed plugin is not
rendered.
* docs(changelog): note suppressed plugins receiving events
* fix: preserve display width when erasing wide characters
Calculate end-of-line padding from the retained row's display width instead of character indices, ensuring erased wide characters are replaced with enough spaces to cover all their screen columns.
Add regression coverage for wide characters, including erasing from the second half of a character.
* some additional correctness fixes
* rustfmt
* add pr
* fix flaky test
---------
Co-authored-by: Aram Drevekenin <[email protected]>
* feat(web): add WebSocket heartbeat to prevent false disconnections
Idle WebSocket connections are often silently closed by network
intermediaries (e.g. Cloudflare's 100s idle timeout), causing false
"connection lost" messages even though the session is still alive.
Keep the control WebSocket alive by sending a protocol-level Ping
every 30s and closing the connection if no Pong is received within
45s. Browsers reply to Pings automatically below the JS layer, so
this keep-alive survives JS event-loop blocks and tab throttling.
* add some cleanups
* rustfmt
* add pr
---------
Co-authored-by: Aram Drevekenin <[email protected]>
* fix(kitty-graphics): zlib-compress images forwarded to the host terminal
`emit_kitty_transmit` sent every image to the host as uncompressed RGBA
base64 (`f=32,t=d`), about 20x the size of a PNG the application sent,
and re-sent it on every tab switch, pane split and resize step. Compress
the cached host payload with zlib and tag the transmit with `o=z`, which
the kitty protocol defines as part of its base feature set.
Measured with a headless client at 429x77 (8x17 px cells): a 121 KB PNG
went from 2.4 MB to 163 KB on the wire, a 943 KB PNG from 19.9 MB to
1.9 MB, with no measurable change in server CPU.
Fixes#5596
* fix: conditional zlib compression depending on outer terminal support
* rustfmt
* add pr
---------
Co-authored-by: Aram Drevekenin <[email protected]>
* refactor(plugin-api): share the keybinding protobuf conversions
The conversion between a keybinding table and its protobuf form was written
out four times: once each way for the ModeUpdate and InitialKeybinds events.
Collect them into `keybinds_to_protobuf` and `keybinds_from_protobuf`.
Decoding now drops a binding whose key is missing instead of unwrapping it,
so a malformed or foreign payload can no longer panic the conversion, and a
mode whose key fails to convert costs only that binding rather than every
binding in the mode.
* feat(nested-sessions): carry input mode and keybindings over the protocol
A session hosting a nested session has no way to learn what that session is
doing, so its plugins cannot show hints for the session the user is actually
typing into. Add the three messages that carry it:
- GuestModeUpdate, sent by a guest whenever its input mode changes, so a host
always knows which of the guest's bindings currently apply.
- RequestGuestKeybinds and GuestKeybindsUpdate, a query and its answer, for
the far larger keybinding table. Keeping the table behind a query means it
is fetched once by whoever wants it rather than pushed at every host.
The table travels as an encoded plugin-API payload in an opaque bytes field.
Describing keybindings natively here would mean restating the whole Action
schema in this contract, which the codegen compiles with only its own include
path. Reusing the existing payload also means a host and a guest built from
different Zellij versions exchange whatever both understand and silently drop
the rest, which is the behavior this wire needs.
An input mode is written under the name InputMode::from_str reads, so adding a
mode needs no change to this contract and an unknown mode is rejected rather
than misread.
Peers advertise the new HintReporting capability, so each side can tell
whether the other can take part before asking it anything.
* feat(plugin-api): expose nested session mode and keybinding events
Plugins running in a host session can see that a pane holds a nested guest
session, but they have no way to learn what that guest is doing. A status bar
in the host therefore keeps showing the host's own hints while the user is
descended into the guest, which is the wrong keybinding table for the keys the
user is actually pressing.
Add two events and one command covering that gap:
- Event::NestedSessionModeUpdate reports a guest's input mode as it changes.
- Event::NestedSessionKeybinds delivers a guest's full keybinding table.
- PluginCommand::RequestNestedSessionKeybinds asks a guest pane for that
table, which arrives asynchronously as the event above.
Both events carry the pane the guest runs in and the guest's session name, so
a plugin watching several nested panes can tell them apart. Keybindings are
requested rather than pushed because the table is large and most plugins never
need it.
* feat(nested-sessions): report guest input mode and keybindings to the host
Wire the nested session hint events end to end.
A guest announces the HintReporting capability during the handshake and, from
then on, emits a GuestModeUpdate frame whenever its input mode changes. The
mode is reported on every change rather than only while the host is descended,
so the host already holds the right mode the moment focus arrives and the
status bar does not lag behind the descent.
The host turns each such frame into Event::NestedSessionModeUpdate. It answers
PluginCommand::RequestNestedSessionKeybinds by writing a RequestGuestKeybinds
frame into the guest pane; the guest replies with its keybinding table plus its
current mode, and the host forwards the table as Event::NestedSessionKeybinds.
Requests to guests that did not advertise HintReporting are dropped rather than
written, and frames from panes whose guest is not currently live are ignored,
matching how the other guest-to-host frames are handled.
Both events and the command require the ReadApplicationState permission, the
same gate ModeUpdate uses.
* test(nested-sessions): cover guest mode and keybinding reporting
Unit tests over the contract check that every input mode survives the round
trip under its own name, that a mode name the reading side does not know is
rejected rather than guessed at, and that a keybinding table keeps its modes,
keys and actions across the wire. The undecodable and empty payload cases are
covered too, since a host and a guest may be built from different versions.
Integration tests drive two real sessions bridged through a pane: both sides
advertise hint reporting during the handshake, the guest answers a keybinding
request with a populated table plus its current mode, and the guest reports
each mode change while the user is descended into it.
* test(nested-sessions): drop unknown capabilities without losing known ones
A peer built from a newer Zellij can advertise capabilities this side has
never heard of, so pin down that they are ignored individually rather than
invalidating the whole advertisement.
* feat(nested-sessions): carry the guest's base mode alongside its input mode
A host plugin that only knows a guest's current mode cannot tell which of the
guest's bindings are inherited from its base mode. Zellij's own hint rendering
leans on that distinction: bindings the base mode already advertises are
inherited by every other mode through `shared_except` groups, so repeating them
in each mode is noise. Without the guest's base mode a host plugin either
suppresses the wrong bindings or suppresses none.
A guest with a non-Normal base mode, such as an unlock-first config, is where
this shows: assuming Normal there hides the wrong half of its bindings.
The base mode rides along on the existing mode message, so a guest that has not
switched modes yet still reports one, resolved the way the rest of Screen
resolves it (the configured default mode is the base). It stays optional on the
wire, so a name the reading side does not recognize costs only the
inherited-binding distinction rather than the whole message.
* feat(nested-sessions): report the guest's mode when the handshake completes
A guest only pushed its input mode when that mode changed, so a host that
had just picked up a nested session learned nothing about it until the user
happened to switch modes inside it. A host plugin has no other way to tell
which of its panes holds a session worth asking for keybindings, which left
it unable to act on the feature at all in the common case of a guest sitting
in its starting mode.
Send the report once on contact as well, and reuse the same client mode
lookup the keybinding answer already did.
* docs(changelog): note the nested session hint reporting events
* fix(nested-sessions): drop guest keybindings on control characters
Nothing a guest says is authenticated. Its frames travel in the terminal
stream of the pane it runs in, so any program with that pane can write them,
including a keybinding table claiming a binding on a raw control character.
A host that draws those bindings puts their keys on its own screen, where a
control character is a terminal escape in the host's output rather than a
key anyone could press.
Drop them where the guest's payload is decoded, so no host plugin inherits
the problem. Zellij spells the control keys that do exist as their own
BareKey variants, so a Char holding one describes no binding worth keeping.
* test(nested-sessions): expect hint reporting in the announce ack
The host now advertises HintReporting alongside NestedControl when it
acknowledges a guest, so the assertion on the exact capability list had to
follow.
* fix(plugin-api): drop only what has no protobuf form when writing keybindings
keybinds_to_protobuf failed the whole table on the first key or mode it could
not represent, so one unrepresentable binding cost the caller every binding:
a ModeUpdate that failed to convert entirely, and a nested session's answer
that reached its host as an empty table indistinguishable from a session with
no bindings at all.
Drop the individual mode, key or action instead, which is what the reading
half already does and what the writing half already did for actions. A table
now survives the trip between builds minus whatever they do not have in
common.
* fix(nested-sessions): keep a host's view of the guest fresh across a reconfigure
A reconfigure rewrites a session's keybindings and base mode without going
through change_mode, and keybindings are otherwise only ever sent in answer
to a request. A host that had already asked once therefore kept drawing the
table the guest had before its config was reloaded, with no way of noticing
it had gone stale, and would not have picked up the new base mode until the
user happened to switch modes inside the guest.
Report both from reconfigure, next to the shortcut broadcast that already
happens there. Answer a keybinding request from the requesting client's own
table too, since a reconfigure with write_to_disk unset rebinds only the
client that asked: the mode in the same reply already came from that client,
so the two halves now describe the same thing.
* fix: adjust protocol + API
* Update CHANGELOG.md
---------
Co-authored-by: Aram Drevekenin <[email protected]>
ASSET_MAP stored the builtin plugins as include_bytes!(..).to_vec(), so the first access copied all of them (~17.6 MiB) onto the heap for the lifetime of the server. This stores &'static [u8] instead.
Server with one pane and one client on macOS: 45 MB -> 28 MB.
* feat: capture OSC 7 working directory on Grid and expose via Pane trait
Add osc7_payload field to Grid, handle the b"7" OSC sequence in
osc_dispatch, expose it via a Grid accessor, add osc7_payload() to
the Pane trait (default None), and implement it on TerminalPane by
delegating to the Grid. Follows the has_bell/consume_bell pattern.
* feat: forward OSC 7 from focused pane to parent terminal on render
* fix: validate OSC 7 URI and clean up state on client disconnect
Reject URIs containing control characters (< 0x20 or 0x7f) to prevent
injection into the parent terminal when the URI is re-emitted via OSC 7
forwarding. Also remove per-client OSC 7 forwarding state in
remove_client() to avoid stale entries accumulating after disconnect.
* style: fix formatting in OSC 7 tests
* fix: add control char test, clear osc7 on reset, doc comment
- Add test for control character rejection in OSC 7 URIs
- Clear osc7_payload in reset_terminal_state() (RIS/\ec)
- Add doc comment on osc7_payload() getter
* fix: address PR review feedback
- Reject C1 control characters (U+0080..U+009F) in OSC 7 URIs using
char::is_control() instead of byte-level check
- Reject entire OSC 7 if any param segment has invalid UTF-8 instead
of silently dropping bad segments
- Avoid String allocation in render hot path by comparing borrowed
&str, only allocating when the value actually changes
- Add test for C1 control character rejection
* fix: integrate OSC 7 forwarding with upstream CWD tracking
* add some more tests
* docs: update changelog
---------
Co-authored-by: Aram Drevekenin <[email protected]>
apply_pipe_message_to_plugin sends UnblockCliPipes on every success path,
including the path for old plugins that do not export `pipe`, but not when
the call into the plugin fails. When a plugin traps while handling a pipe
message, both call sites in wasm_bridge only log and call handle_plugin_crash,
which paints a loading-indication error on the pane and does not unload the
plugin. The (plugin_id, client_id) entry therefore stays in PendingPipes and
the `zellij pipe` client blocks until the plugin is unloaded or the session
ends.
Move the body to apply_pipe_message_to_plugin_inner and have the wrapper
release the pipe on any error before re-returning it, so neither call site
can forget.
Adds a regression test driving a fixture-plugin branch that panics while
handling a pipe, asserting UnblockCliPipeInput is emitted at crash time
rather than at teardown.
* fix: keep single-pane tabs when serializing, stop the busy-spin on IPC disconnect, and make client-less CLI actions either work or fail loudly
* fix: some tab closing/ordering issues
* test: integration coverage for OSC 133 selection, scroll retention, paste-read opt-in, theme actions, and input fragmentation
* rendering-width regression tests
* fix: forward alt+mouse events into a guest pane the client is descended into
* fix: alt + [] delay in non-kitty
* allow disabling mouse hover tips while keeping the other effects
* more osc133 actions
* fix: base mode race when changing keybinding presets
* fix compilation warnings
* make releases drafts and remove diagnostic logging
* add pr
* fix(clipboard): don't kill copy_command processes that own the selection
The reaping added in #4298 kills the copy_command process if it is still
running one second after the copied text was written to its stdin. X11 and
Wayland clipboard helpers are supposed to keep running: they own the
selection and serve it to whoever pastes it, so killing them empties the
clipboard.
Wait for the process instead of polling it with a deadline. Commands that
exit on their own are still reaped as soon as they do, so the zombies #4298
was about don't come back.
* docs(changelog): add PR
* fix(scroll): keep scroll position when leaving scroll mode
Leaving Scroll mode for Normal or Locked snapped the active pane back to
the bottom. Switching panes requires leaving Scroll mode, so that reset
is what prevented keeping a pane scrolled while working in another.
It is also redundant: the scroll keymap already binds an explicit
ScrollToBottom on exit, so users who want to follow live output keep it,
while a plain exit now preserves the scroll position. Output is still
buffered while a pane is scrolled and replayed when scroll is cleared,
so the buffer-overwrite protection is unaffected.
* fix(scroll): re-enter scroll mode when focusing a scrolled pane
Focusing a scrolled pane now switches the client into Scroll mode, and
focusing an unscrolled one returns it to Normal. Only the Normal<->Scroll
pair is synced, so a client in another mode is left alone.
* fix(scroll): re-enter scroll mode on focus-last-pane too
Cover the FocusLastPane action added in #4241 with the same focus-to-scroll
sync as the other focus moves, so landing on a scrolled pane via focus-last
behaves like landing on it via MoveFocus.
* fix(scroll): sync the default mode with scroll, cover mouse focus
Follow imsnif's review on #5299. The focus sync now switches between Scroll
and the configured default mode read from default_mode_info instead of a
hardcoded Normal, so unlock-first sessions (default Locked) return to Locked
rather than Normal. It also fires on mouse focus changes (click, click-through,
focus-follows-mouse) by hooking the existing active-pane diff in
handle_mouse_event, not only keyboard focus moves.
Tests parameterize the focus-sync assertion over the default mode (Normal and
Locked) and add a mouse-click variant.
* cover some more cases
* sync also on mouse scroll
* rustfmt
---------
Co-authored-by: Aram Drevekenin <[email protected]>
When `stacked_pane_list` is on and the user adds a stacked pane, the classic
in-grid stack path first collapses the pre-existing pane to `Fixed(1)` and
then `focus_pane` fires `reapply_pane_frames`, which sends `resize_pty!` to
the collapsed pane at 1 row. The stack-list groupify pass (invoked later
during `render`) then extracts the pane to `suppressed_panes` and resizes it
back to the visible size, issuing a second `resize_pty!`. The two rapid
WINCH events cause the shell (nushell, pwsh, bash, …) inside the pane to
redraw its prompt twice, overwriting previously-visible rows of output.
The grid data is preserved in `lines_above`, but the visible viewport ends
up mostly blank — the user sees only the pre-existing rows that had already
scrolled off, giving the impression of a truncated buffer.
Sync stacked-pane-list mode right after the classic mutation, before
`focus_pane`. `groupify_all` moves the collapsed member into
`suppressed_panes` first, so the subsequent `reapply_pane_frames` (which
only iterates `tiled_panes`) never sends a 1-row `resize_pty!` to that
shell. The pane is then resized once to the visible size via
`resize_stack_list_hidden_members`.
Regression test asserts that after adding a stacked pane in this mode, the
pre-existing pane is in `suppressed_panes` and the new visible member has
non-fixed row dimensions — proving groupify happened before any classic
`reapply_pane_frames` step.
Co-authored-by: divens <[email protected]>
Co-authored-by: Aram Drevekenin <[email protected]>
* initial chrome
* mobile state
* feat(mobile-web): implement browser→server actions (fit toggle, single-pane fullscreen, pane/tab focus) with fullscreen-truth reconciliation
* panning
* remove mobile plugin
* fix first load race
* improve web handshake
* rustfmt
* cleanups
* moar cleanups
* add bundle asset check to ci
* fix(mobile-web): tab-scope co-presence, yield single-pane to desktop clients, fix render-mode desync
* make mobile use no-ui fullscreen
* client side welcome screen for mobile
* attach web clients to first tab on tiles surface
* fix: opening new pane in mobile single mode no longer exits mobile single mode
* mobile chrome light theme support
* fix server races and flaky tests
* rustfmt
* fix flakes
* add pr