Commit Graph
49 Commits
Author SHA1 Message Date
Aram Drevekenin 3239d37b40 Native web mobile UI (#5441)
* 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
2026-08-05 15:32:53 +02:00
Aram Drevekenin 34e7491548 fix: allow building without bundled plugin assets (#5433)
* fix: allow building without bundled plugin assets

* add pr
2026-08-03 13:54:55 +02:00
Aram Drevekenin 0ed2edea0c fix(build): remove manpage, honor CARGO_TARGET_DIR, add cargo argument passthrough, remove clippy (#5426)
* fix(build): remove manpage, honor CARGO_TARGET_DIR, add cargo argument passthrough, remove clippy

* add pr
2026-07-30 16:50:12 +02:00
Aram Drevekenin cab75c58fe More dependency upgrades for debian (#5421)
* upgrade insta, rand, sha2, strum, thiserror, tokio-tungstenite, toml, which; drop unused semver and typetag

* upgrade sysinfo to 0.39.5, bump toolchain (msrv) to 1.95.0

* remote legacy yaml config converter and thus drop serde_yaml

* upgrade unicode-width to 0.2.2

* fix(tests): run ipc roundtrip test on a larger stack
2026-07-29 17:08:08 +02:00
Aram Drevekenin 9969ed10b2 Dep upgrades for debian (#5420)
* chore(deps): upgrade base64 0.22, colored 3.1, crossterm 0.29, dialoguer 0.11, directories 6.0, highway 1.2, prost 0.12.6, strip-ansi-escapes 0.2.1, suggest 0.5.1

* chore(deps): upgrade miette 7.6, nix 0.30, notify 8.2, notify-debouncer-full 0.5

* vte 0.15

* clap 4.6

* workspaceify plugin deps

* don't send empty fs watch events
2026-07-28 12:05:38 +02:00
Aram Drevekenin ea07e2d5b6 Nested session handling (#5417)
* fix: theme query and updated pixel dimensions

* add no-ui-fullscreen key/action/capability

* protocol core

* integration test harness

* fix integration tests

* fix flaky tests

* nested ui (dimming) and directional focus initial implementation

* integration tests for nested ui dimming and directional focus

* initial full screen nesteed implementation

* fix: keep hidden floating panes hidden across nested no-ui fullscreen

* fix integration tests

* no ui fullscreen integration tests

* hardening behavior/tests

* fix(nested): re-derive descend/dim on host tab switch and new-tab so clicking dimmed chrome ascends

* initial modal implementation

* initial ui improvements

* fix integration tests

* improve nested selection ui

* nested session modal refactoring and tests

* improve integration test speed somewhat

* some ui adjustments

* simplify full/auto nested session handling

* hints in compact-bar

* guest stdin leak fix

* allow floating panes to be fullscreen

* make nested session handling configurable

* protocol reannounce

* refactor: naming confusion

* improve ux somewhat

* rustfmt

* merge fixes

* improve integration test rate limiting (fix ci)

* add pr
2026-07-27 18:24:37 +02:00
Aram Drevekenin 0dd324bdef Reduce compilation time (#5321)
* perf: speed up dev builds

* rustfmt

* fix flake
2026-06-30 21:18:58 +02:00
ZykinoandZykino ba152f53fc Fish completion delete session (#5317)
* Add session completion for "delete-session"

Close #5316

* Force default value for CARGO_TARGET_DIR

Since we did not approved and maintain #2611

* Move `xtask run`'s specific output to stderr

That way command output can be redirected without garbage e.g.:
`cargo xtask run -- setup --generate-completion fish > ~/.config/fish/completions/zellij.fish`

---------

Co-authored-by: Zykino <3809938+Zykino@users.noreply.github.com>
2026-06-30 12:35:30 +02:00
Aram Drevekenin 245f5141c9 Title frames (#5318)
* initial implementation

* improve single line title design

* hint text plugin infra

* add proto regen task

* display alt text in status bar

* don't display text with full frames

* style alt hover text

* fix + style control own pane hover

* make multiplayer indications responsive

* update snapshots

* plugin api

* single pane as tab

* better scroll styling

* fix tests

* tab-bar plus hover

* plugin surface tests

* integration tests

* adjust all integration tests

* reduce hover noise

* add pane id to in place

* more integration tests

* style: rustfmt

* update plugin assets

* update assets and snapshots

* add pr
2026-06-29 18:10:59 +02:00
Aram Drevekenin 8c7e41c9aa chore: new test infra (#5269)
* initial implementation

* refactoring and cleanups

* port basic e2e tests

* fix tab rotation

* migrate client and mouse tests

* migrate the rest of the tests

* remove old e2e tests

* rustfmt

* add e2e note

* fix stale test

* fix: cross platform locking/cleanup

* fix: change mode race discovered by tests

* rustfmt

* fix: attach/detach race in tests

* fix plugin test assertion

* add pr
2026-06-16 15:44:22 +02:00
Aram Drevekenin b6a5ad0e5a Mobile layout (#5241)
* phase 2+3

* initial mobile plugin (phases 4 + 5 + 6)

* some bugfixes

* implement stage 7

* mobile interface improvements

* improve mobile pane/tab picker

* more ui improvements and fixes

* various mobile fixes

* some mobile fixes

* mobile keyboard triggering fix

* some cleanups

* initial plugin keyboard implementation

* improve keyboard hit zones

* improve keyboard

* pinch resize

* pinching fixes

* implement scrolling + panning

* initial keyboard resizing

* fix: mobile first render issues

* keyboard responsiveness

* fix some issues with the keyboard

* implement fit

* fix mobile scrolling

* add tilde cell to compact

* improve mobile keyboard

* fix starting mobile terminal font to natural keyboard size

* fix mobile resize blank screen flash

* shadow focus for mobile

* more keyboard fixes

* improve mobile status bar

* fix: render plugins to mobile clients

* allow opening new panes/tabs from the mobile plugin

* allow configuring

* fix dot slash

* improve mobile native soft keyboard interaction

* switch to native keyboard - initial implementation

* dirty hacks, but phone keyboard works now

* adjust keyboard help strip

* fix cursor in mobile

* fix keyboard and help line

* rename keyboard to modifier bar

* allow starting new session

* make clicking session name bring us to new session menu

* allow switching to desktop from the mobile ui

* mobile welcome screen initial implementation

* mobile welcome screen fixes

* various welcome screen fixes

* more mobile fixes

* moar mobile fixes

* mobile ui redesign

* fix: swallowed backspace bug

* switch session screen improvement

* touch up some interfaces

* refactor: move mobile state to own struct

* refactor: move fit resizing to the server

* remove dead flash code

* some cleanups

* refactor: clear fit on close

* refactor: improve fit api

* refactor: pane sync functions

* refactor: mouse

* refactor: break into modules

* some cleanups for the sessions screen

* fix scrolling and other stuff

* refactor: sessions screen

* refactor: panes screen

* refactor: new session screen

* refactor: menu screen

* refactor: render

* cleanups

* refactor: plugin structure

* remove unused welcome screen path

* Rename api

* refactor input.js

* cleanup useless comments

* fit/mobile refactoring

* take out the garbage

* remove more comments

* remove mobile flash on startup/attach

* fix: various mobile startup issues

* fix space bugs

* cleanup

* rustfmt

* fix windows build

* adjust modifier bar ui

* add pr
2026-06-10 16:50:55 +02:00
Aram Drevekenin 8a0594f8eb fix: when publishing, publish current branch rather than hardcoded main (#5127)
* fix: when publishing, publish current branch rather than hardcoded main

* add pr
2026-05-04 09:55:15 +02:00
Thomas Linford 6542afabd8 fix(e2e): stabilize tests and support Apple Silicon local dev (#4952)
- cross-compile musl binary on macOS via cargo-zigbuild, with
arch-independent symlink so snapshots are stable across x86_64 and aarch64

- kill_running_sessions() now calls stop_zellij() instead of
start_zellij(), eliminating 3s startup per test

- prevent steps from firing prematurely by tightening completion conditions
and adding re-send logic for garbled keys
2026-04-01 12:41:07 +02:00
Aram Drevekenin 903cdf5d32 Click file paths to open in editor, allow plugins to change styles and hover of viewport (#4802)
* initial implementation

* implement hover

* add styles and foreground/background emphases, fix upsert hover collisions

* initial implementation of link plugin

* suppress highlighting + clicks on unfocused and mouse mode panes

* also make italic

* fix env var and ~ expansions

* fix regex issues and add defensive validations

* fix tests and add plugin assets

* add tests

* refactor all the things

* add pr
2026-03-05 21:13:02 +01:00
Thomas Linford a431e52b3d build: make test mirror build command for plugins (#4801)
* build: make test mirror build command for plugins

* update changelog
2026-03-05 17:38:17 +01:00
Thomas Linford 0e55b270d4 build: fix redundant proto codegen, plugin batch building, and profile mismatch between build and run (#4799)
* refactor: extract protobuf codegen from loop

* refactor: build all default plugins at the same time

* refactor: use dev-opt for run

* fix formatting

* update changelog
2026-03-05 13:47:08 +01:00
f77cdec298 feat: add per-pane default foreground/background color support (#4737)
* feat: add per-pane default foreground/background color support

Add per-pane default foreground and background colors, configurable
through four surfaces:

- OSC 10/11 escape sequences (set/query) and OSC 110/111 (reset)
- CLI action: zellij action set-pane-color --pane-id <id> --fg/--bg
- Layout config: default_fg/default_bg properties on pane nodes
- Plugin API: set_pane_color() SDK function and PaneInfo read-side

Colors are applied at render time as a fallback when cells have no
explicit foreground/background, without mutating stored grid data.

Closes #4712

* refactor: address review feedback for pane color support

- Extract adjust_styles_for_custom_bg_fg in output/mod.rs
- Move color parsing (xparse_color) from tab into Grid
- Move color serialization (ansi_code_to_color_string) into Grid
- Pane trait now uses Option<String> for color getters/setters
- Add colors to session serialization (dump-layout)
- Add default_fg/default_bg to protobuf IPC schema to fix
  layout-in-session color loss
- Update example layout with tab-bar and status-bar

* fix stack overflow and ordering

* rustfmt

* update e2e snapshots

---------

Co-authored-by: Karl Bunch <karl@karlbunch.com>
Co-authored-by: Aram Drevekenin <aram@poor.dev>
2026-03-04 14:26:26 +01:00
divensanddivens f6bf1af1ce [Windows port PR8] feature: add Windows support (#4768)
* feat: add Windows signal and process implementations

- AsyncSignalListener: polls crossterm size at 100ms, tokio ctrl_c/break/close
- BlockingSignalIterator: SetConsoleCtrlHandler + AtomicBool, polls size at 50ms
- signal_process: GenerateConsoleCtrlEvent for Interrupt, TerminateProcess for Kill
- Add windows-sys workspace dependency

* feat: add Windows IPC support with named pipes and marker files

- ipc_connect/ipc_bind/ipc_bind_async helpers with cfg gates for named pipes
- Dual-pipe architecture on Windows: main pipe + reply pipe per connection to
  prevent IPC deadlock (half-duplex named pipe limitation)
- is_ipc_socket returns is_file() on non-Unix for marker file discovery
- ipc_bind creates empty marker file after binding named pipe on Windows
- assert_socket split: cfg(unix) probes with ConnStatus, cfg(not(unix)) returns
  true to avoid deadlocking the server accept loop
- Replace tokio UnixListener/UnixStream with interprocess tokio Listener/Stream
  in web server IPC for cross-platform support
- Add interprocess tokio feature to workspace deps

* feat: add Windows client support for input, server spawn, and stack size

- Two-mode Windows input: crossterm event reader for native console,
  termwiz byte parser for terminal emulators (VT input mode)
- cast_crossterm_key: convert crossterm KeyEvent to KeyWithModifier
- ENABLE_VIRTUAL_TERMINAL_INPUT on Windows stdin for raw VT byte reading
- Skip ANSI terminal query on Windows to unblock startup
- spawn_server: CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP on Windows
- 8MB stack trampoline in main() for Windows (default 1MB overflows)
- 8MB stack for server worker threads (WASM compilation needs it)
- Enable crossterm events and bracketed-paste features

* test: make tests cross-platform for Windows

- Socket tests: cross-platform IpcGuard/IpcName helpers with GenericNamespaced
  on Windows vs GenericFilePath/TempDir on Unix
- Layout tests: normalize_layout_debug() replaces backslash separators in Debug
  output on Windows; gate env_var_expansion test with cfg(unix)
- Setup tests: use PathBuf::join + display() instead of hardcoded / separators
- Server OS tests: cross-platform command helpers (long_running_cmd, echo_cmd,
  stdin_reader_cmd) with CREATE_NO_WINDOW on Windows
- zellij_exports: replace GenericFilePath with ipc_connect() helper

* ci: add Windows build and test jobs with debug logging

- Add build-windows job: cargo check --no-default-features on windows-latest
- Add test-windows job: cargo test --no-default-features for utils/server/client
- Enable manual workflow_dispatch trigger
- Add debug log::info! calls in server startup, plugin loading, PTY spawning,
  and screen layout application for troubleshooting

* feat: implement Windows stubs for shell, command hooks, and process listing

Replace unimplemented!() stubs with working Windows implementations:
- get_default_shell: reads $COMSPEC, falls back to cmd.exe
- run_command_hook: uses cmd /C with RESURRECT_COMMAND env var
- get_all_cmds_by_ppid: uses sysinfo to enumerate processes by parent PID

* feat: implement Windows daemonize_web_server with detached process spawning

Replace the `unimplemented!()` stub with a proper background process
spawner that mirrors the existing `spawn_server` pattern: launch a
foreground `zellij web --start` child with CREATE_NO_WINDOW |
CREATE_NEW_PROCESS_GROUP, poll the TCP port to confirm it's listening,
then exit the parent process.

* feat: implement native ConPTY backend for Windows PTY

Replace all WindowsPtyBackend stubs with a full ConPTY implementation:

- CreatePseudoConsole with overlapped named pipes for IOCP-based async
  I/O (zero extra threads on the read path per pane)
- CreateProcessW with PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE and proper
  UTF-16 command line quoting / environment block construction
- ConPtyAsyncReader with lazy promotion from OwnedHandle to tokio
  NamedPipeServer (reactor not available at spawn time)
- Per-terminal exit monitoring thread using WaitForSingleObject
- ResizePseudoConsole for terminal resize, WriteFile for stdin,
  TerminateProcess / GenerateConsoleCtrlEvent for signals

Note: for PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, the HPCON value must be
passed directly as lpValue (not a pointer to it), matching the C
convention where HPCON is void*. In Rust (windows-sys) HPCON is isize,
requiring an explicit cast. See microsoft/terminal#6705.

* chore: remove debug logging from ConPTY backend

* fix: resolve Windows plugin directory and WASI mount errors

Two Windows-specific fixes for the plugin system:

1. Replace colons with underscores in URL-derived plugin directory names
   (e.g. "zellij:tab-bar" -> "zellij_tab-bar"). Colons are illegal in
   Windows path components, causing OS error 123 on plugin dir creation.

2. Use FILE_FLAG_BACKUP_SEMANTICS when opening directories for WASI
   pre-opened mounts. Windows requires this flag to open directory
   handles, otherwise File::open() returns OS error 5 (access denied).

Both fixes are behind #[cfg(windows)] — Unix behavior is unchanged.

* fix: enable mouse support on Windows native console path

Mouse events were silently dropped in the crossterm event loop, and
enable_mouse() wrote VT escape sequences that don't set the required
ENABLE_MOUSE_INPUT console mode flag. Add from_crossterm_mouse()
converter, InputInstruction::MouseEvent variant, and use crossterm's
EnableMouseCapture/DisableMouseCapture on Windows.

* fix: Windows get_default_shell() now checks $SHELL before $COMSPEC

* fix: resolve bare command names via PATH and PATHEXT on Windows

CreateProcessW doesn't reliably resolve bare command names (e.g.
"pwsh") through PATH the way Unix execvp does. Additionally, the
existing command_exists() check didn't consider Windows PATHEXT
extensions (.exe, .cmd, .bat, etc.).

Add find_executable() and resolve_command() which search PATH with
PATHEXT support on Windows, and use the resolved absolute path when
spawning via CreateProcessW.

* chore: run cargo fmt --all

* fix: canonicalize expected paths in setup tests for Windows \\?\ prefix

* fix: Windows CI test failures in spawn_and_read_output and snapshot test

Use cmd /K instead of /C in spawn test so ConPTY has time to flush
output before the pipe closes. Normalize backslashes in snapshot test
to handle Windows path separators.

* fix: strip redundant Shift and AltGr modifiers from Windows key events

On the Windows native console path, crossterm reports physical modifier
flags alongside the already-translated character. For example on French
AZERTY, Shift+ù produces Char('%') with SHIFT, and AltGr+_ produces
Char('\') with CTRL+ALT. These extra modifiers cause keybinding
mismatches and prevent modified characters from being typed in plugin
text inputs.

Strip Shift for all Char events and Ctrl+Alt (AltGr) when the character
is printable, matching Unix terminal behavior where only the resulting
character is reported. Also fix raw byte synthesis for AltGr characters
to emit plain UTF-8 instead of ESC-prefixed sequences.

* fix: detect and clean up stale Windows sessions via PID-based liveness check

Write server PID to marker files instead of creating empty files.
assert_socket() on Windows now reads the PID and checks process liveness
via OpenProcess, cleaning up stale marker files for dead sessions.

* fix: connect reply pipe on Windows for kill-session and delete-session

On Windows the server blocks on reply_listener.accept() after accepting
the main pipe connection. Without a reply pipe connection, the route
thread is never spawned and the KillSession message is never processed.

* fix: wait for server Exit response in kill/delete session on Windows

The previous fire-and-forget approach was unreliable: the client would
disconnect before the server's route thread had time to read and process
the KillSession message. Now we wait for the Exit response on the reply
pipe, ensuring the server has fully processed the kill before we return.

* fix: resolve Windows console mode race between VT input and mouse setup

Two threads race over SetConsoleMode on the stdin console handle:
- stdin_handler calls enable_vt_input() (read-modify-write)
- input_handler calls enable_mouse() via crossterm's EnableMouseCapture
  (full SetConsoleMode overwrite to 0x0098)

Depending on ordering, crossterm could clobber ENABLE_VIRTUAL_TERMINAL_INPUT
(breaking the VT byte reader), or enable_vt_input could preserve
ENABLE_QUICK_EDIT_MODE (intercepting mouse events at the console level).

Fix enable_vt_input() to explicitly set the exact console mode needed
(0x0298) instead of read-modify-write, clearing QUICK_EDIT_MODE and other
line-editing flags.

Fix enable_mouse()/disable_mouse() on the VT path (TERM is set) to use
ANSI escape sequences instead of crossterm's Console API, avoiding the
competing SetConsoleMode call entirely. Enable ENABLE_VIRTUAL_TERMINAL_PROCESSING
on stdout first so ConPTY forwards the DEC private mode sequences to the
terminal emulator.

* fix: session-manager plugin kill session on Windows dual-pipe IPC

The plugin's kill_sessions() only connected the main pipe and sent
KillSession, but on Windows the server blocks on reply_listener.accept()
before spawning the route thread. Without connecting the reply pipe the
message was never processed.

Add the same dual-pipe handling as the CLI kill_session(): connect the
reply pipe first, send the message, then wait for the Exit response.

* fix(windows): replace resize polling with event forwarding from stdin thread

Forward crossterm Event::Resize from the stdin thread to the signal
handler thread via an mpsc channel, replacing the 50ms polling loop.
This makes terminal resizing much more responsive during mouse-driven
resizes and eliminates wasteful polling when idle.

When the VT reader path is active (terminal emulators with TERM set),
the sender is dropped, causing the signal handler to automatically
fall back to size-polling — preserving existing behavior for that path.

Unix is unaffected: handle_signals receives None for the receiver and
BlockingSignalIterator continues using signal_hook as before.

* fix(windows): enable ANSI terminal queries on the VT reader path

The startup ANSI query mechanism (pixel dimensions, colors, sync output)
was blanket-skipped on Windows. The actual limitation is specific to the
native console path, where crossterm's event::read() uses
ReadConsoleInput (INPUT_RECORDs) and never reaches the byte-reader loop
that parses ANSI responses.

On the VT reader path (terminal emulators like Alacritty with TERM set),
fill_buf() reads raw VT bytes via ReadFile — same as Unix — so ANSI
query responses work normally. Move the use_vt_reader decision earlier
and use it to gate the query, enabling it for the VT reader path while
still skipping it on native console.

* fix: handle early TerminalResize before client is fully registered

On Windows, enable_mouse()'s SetConsoleMode call can generate a
WINDOW_BUFFER_SIZE_EVENT that arrives as a resize before the server
finishes processing the initial client connection. At that point
set_client_data() hasn't been called yet, so set_client_size() silently
no-ops on the None entry and min_client_terminal_size() returns None.

Instead of panicking, skip the resize when the minimum size can't be
determined — the server will query the terminal size once setup
completes.

* fix: remove unnecessary custom stack size

Early versions of zelilj windows port crashed with stack overflow.
Increasing stack size allowed proper startup and moving further with the
porting effort. Current implementation no longer suffers from stack
issues, so we can revert back to default stack size.

* fix(windows): re-enable Ctrl+C handling inherited by ConPTY children

The server is spawned with CREATE_NEW_PROCESS_GROUP, which disables
Ctrl+C for the process.  Children inherit this disabled state, so
ConPTY child processes (shells, ping, etc.) silently ignore
CTRL_C_EVENT signals generated by the pseudo-console.

Call SetConsoleCtrlHandler(NULL, FALSE) early in start_server() to
clear the inherited ignore flag before any ConPTY children are created.

* refactor(windows): move inline cfg(windows) blocks to platform files

Break out inline #[cfg(windows)] blocks from shared client code into
the existing _unix.rs / _windows.rs platform files, per upstream
feedback.

- Split spawn_server into two #[cfg]-gated function definitions
- Extract setup_ipc, enable_mouse_support, disable_mouse_support into
  os_input_output_unix.rs and os_input_output_windows.rs
- Unify BlockingSignalIterator::new() signature across platforms
- Extract native console stdin loop into stdin_handler_windows.rs

* fix: remove sporadic info log statements

* ci(windows): add Windows x64 release builds and upgrade CI

- Add Windows x64 target to release.yml for both normal and no-web
  release matrices, with NASM, static CRT, .zip packaging, and
  PowerShell checksum steps
- Upgrade build-windows in rust.yml from cargo check to cargo xtask
  build, add wasm32-wasip1 target and NASM
- Add build_release() function and platform-aware e2e_build() to
  xtask/src/ci.rs
- Add BuildRelease command definition to xtask/src/flags.rs

* refactor(client): make resize channel unconditional across platforms

Create the resize mpsc channel on all platforms instead of gating it
behind #[cfg(windows)], avoiding conditionally-existing variables that
are hard to follow. On Unix the sender is immediately dropped and the
receiver is passed as None-equivalent to handle_signals.

* refactor(windows): restructure signal iterator with if/else for channel vs poll

Consolidate the quit check at the top of a single loop and use if/else
for channel mode (native console) vs poll mode (VT reader). On channel
disconnect, set resize_receiver to None and continue into the else
branch instead of falling through.

* docs(server): clarify comment about early resize before client init

Explain why min_client_terminal_size() can return None even after
set_client_size(): new_client() inserts None, and set_client_size()
is a no-op on None entries since it uses as_mut().map().

* feat(web): add --server-startup-timeout flag for web server

Make the hardcoded 10-second TCP-poll timeout in the non-Unix
daemonize_web_server configurable via a CLI flag, defaulting to 10s.

* fix(windows): use unique pipe names for ConPTY output on re-spawn

When a held pane re-runs a command or drops to shell, do_spawn tried
to create a named pipe with the same name as the previous spawn.  The
old ConPtyAsyncReader still held the read handle, so CreateNamedPipeW
failed (FILE_FLAG_FIRST_PIPE_INSTANCE, max instances = 1) and the
error was silently swallowed, leaving the pane blank.

Add a monotonic AtomicU64 counter to the pipe name so each spawn gets
a globally unique pipe, regardless of whether the previous one has
been cleaned up yet.

* ci(windows): enable static CRT for regular Windows release build

The no-web Windows build already had RUSTFLAGS="-C target-feature=+crt-static"
but the regular build was missing it, resulting in a dynamic CRT dependency.

* docs(web): clarify --server-startup-timeout is Windows-only

---------

Co-authored-by: divens <divens.dev@gmail.com>
2026-03-04 07:29:16 +01:00
Aram Drevekenin 8cd6286c3f remove sequence plugin (#4761) 2026-02-24 13:10:40 +01:00
Aram Drevekenin 4a27ceea0d Layout manager (#4601)
* ad plugin override_layout command

* watch available layouts and report to plugin thread

* Event::AvailableLayoutInfo

* save layout command

* refactor save_layout

* fix api and permissions

* delete_layout API command

* edit layout in place API

* edit layout response through api

* propagate layout parsing errors

* generate random name plugin api

* dump stringified layout API

* synchronicity dump_session_layout and include LayoutMetadata in sync response

* parse_layout plugin api

* fix: default to default layout dir in plugin api

* rename_layout plugin command API

* initial implementation of multi-tab override

* apply to multiple tabs

* allow applying to only the active tab

* add tab/pane names to layout parsing metadata

* indicate is_builtin_plugin in PaneMetadata

* get_layout_dir plugin API command

* consolidate (and fix) is_builtin_plugin logic

* fix bad ret

* allow dumping the layout for just a specific tab in the session

* get focused pane and tab sync api

* color last substring variants

* add plugin

* update assets

* fix tests

* add e2e tests for new plugin apis

* update ui with new shortcut

* rustfmt

* docs(changelog): add PR
2026-01-13 11:27:07 +01:00
Aram Drevekenin 693fa082de Command Sequences, Blocking CLI Commands, New Plugin APIs (#4546)
* fix deadlocks

* initial logging to plugin implementation

* only log actions, include keys as Action::Write

* send actions to plugins as a new Event::UserAction

* add Action::Write metadata to plugin API

* run_action plugin command and permission

* block-until-exit/success/failure in the cli

* fix tests

* add NewBlockingPane to the plugin API

* run actions in a different thread so as not to block plugin execution

* add custom context to run_action flow

* fixes for floating pane z_index sorting and unknown protobuf events not crashing plugins

* always render the frame of pinned panes

* macros module

* add macros to config

* KDL macro parsing

* thread macros to the plugin thread

* get/update/delete macros from plugins

* add macros updated event

* add ability to rename macros

* fix deadlock

* fix z_indices with pinned unselectable panes bug

* allow plugins to opt-in to show_cursor

* change show_cursor(bool) to show_cursor(Option<coordinates>)

* test

* upgrade strum to allow proper enum iteration and case insensitive fromstr implementation for Actions

* better cwd tracking for exited command panes

* add initial panes to NewTab Action (no-op for now)

* add initial panes to cli newtab action

* make initial panes work

* add close_on_exit and start_suspended to the cli

* properly convert newtab action (potentially breaking for plugins)

* allow first pane in tab to block

* make distinction between opening panes with the last active client and the current pane in the cli

* improve some apis

* fix fixed size closing pane bug

* fix plugin cursor coordinates

* fix issues with launch-or-focus-plugin having to do with in-place and suppressed panes

* fix: set affected pane in replace pane

* allow setting a pane in place when it is suppressed and being focused (tests failing)

* fix tests

* some fixes for unsuppression of panes

* some fixes for completion_tx in new tab action

* allow replace/suppressed rather than replace/close only

* fixes for inserting suppressed panes without conflicts

* pane focus history and explicit unsuppress plugin api

* fix: prefer explicitly provided pane id in placement in actions that provide it

* fix floating pane coordinate change and z_index

* fix plugin cache dir to persist between sessions

* fix some stack focusing issues when adding panes without a client id

* make sure pinned panes are always above non-pinned floating panes

* allow plugins to copy to clipboard

* initial text styling additions implementations - buggy

* fix dimming issues

* remove extras, stay with just dim and unbold

* unbold and dim as indices

* allow ui components to render success/error colors

* allow plugins to send sigint/sigkill to processes, as well as receive their pid

* ui component fixes and send originating plugin context with run_action

* originating plugin for new tab too

* make plugn show pane command also expand stacked panes

* add sequence plugin

* remove macros

* remove snapshots

* add shortcut for sequence plugin

* fix plugin tests

* plugin tests for new apis

* update snapshots for sequence shortcut

* cleanups and formatting

* Event::CwdChanged

* moar cleanups

* remove some warnings

* remove mroe warnings

* remove dead code

* remove more dead code

* fix minor bugs in sequence plugin

* update sequence help and format codebase

* fix conditional blocking cli commands

* fix initial-command new-tab cli flag

* add client_ids to CwdChanged Event

* last fixes

* add pr
2025-12-11 14:25:42 +01:00
Aram Drevekenin 889bd06f44 Migrate from wasmtime to wasmi (#4449)
* initial implementation

* fix stdio and host folder mounting

* some memory usage optimizations

* fix plugin tests

* remove unused plugin cache

* fix docker-compose for e2e tests when running locally

* rustfmt

* initial pinned executor implementation

* EXPERIMENT: add jemalloc

* initial dynamic pinned threadpool

* cleanups and experiments

* keep state on execution threads

* reintroduce memory cache

* add wasmi engine to executor threads

* load plugins for new clients on the relevant executor thread

* only show loading indication of loading for more than 0.4 secs

* fix anonymous plugin loading without client id

* refactor lots of stuff

* update snapshots

* tests for pinned executor

* remove jemalloc

* fix stderr from plugins

* cleanups

* rustfmt

* cleanups

* fix endless loading for additinal attachments

* more cleanups

* remove singlepass feature

* fix displaying plugin permission message

* render optimizations

* always render for tests

* rustfmt

* optimize release build for wasmi

* fixes for multiple client plugin loading

* fix frame rendering for multiple clients

* rustfmt

* fix loading background plugins and e2e event ordering change

* rustfmt

* account for races in the pin_floating_panes e2e test

* docs(changelog): add PR
2025-10-21 14:36:30 +02:00
har7an 80de7f462c build(cargo): Update Rust toolchain to 1.90.0 (#4457)
* build(cargo): Define shared manifest properties workspace-wide

in order to allow workspace members to easily copy their values, rather
than copying the actual values manually between files. Prepare for a
future update of the Rust edition this way by defining the edition in
one central location.

* build(cargo): Share the license between all workspace members

and don't copy the actual license value manually between crates.

* build(cargo): Share the rust edition between workspace members

rather than manually defining the value per crate. There is no
apparent advantage in having different parts of the code use different
rust editions. It only makes the code inconsistent, which is not a goal
worth striving for.

* build(cargo): Share the crate version between workspace members

at least for those workspace members that are versioned in lockstep.

* refactor(session-manager): Migrate to Rust edition 2021

from edition 2018 in order to use a single unified Rust edition across
the entire workspace. Apparently the migration does not involve changes
to the actual code.

* refactor(plugin-manager): Migrate to Rust edition 2021

from edition 2018 in order to use a single unified Rust edition across
the entire workspace. Apparently the migration does not involve changes
to the actual code.

* build(zellij-utils): Remove the obsolete build script

which has contained nothing but comments for two years now. The initial
"workaround" has by now become the proper solution and the original
issue (see <https://github.com/zellij-org/zellij/pull/2711>) has never
been heard of since.

The real motivation for this change is the simple fact that this version
of prost-build pulled in a pretty old version of the `which` crate which
doesn't appear to build with Rust 1.89 (latest stable as of now).

* build(cargo): Update Rust toolchain to 1.89

which is the latest stable toolchain as of writing this and has support
for the 2024 Rust edition, unlike the previously used 1.84.

* fixup! build(zellij-utils): Remove the obsolete build script

* refactor: Make implicitly elided lifetimes explicit

in cases where a functions return type has an actual lifetime that
depends on a non `'static` argument.

* build(cargo): Update Rust toolchain to 1.90.0

which is the latest stable toolchain as of writing this. Compared to
1.89.0 this changes the default linker and should, hence, cut down
iteration times during development significantly.

* ci: Force configured rust toolchain version in release builds

for the tagged release assets. Previously the rust version was
unconditionally overwritten to be `stable` regardless of what
`rust-toolchain.toml` configured.

* docs(changelog): Add MR #4457

to list of unreleased changes.

* build: Read package version from workspace version value

since it no longer resides directly in the `package` object.
2025-10-06 17:11:34 +00:00
Aram Drevekenin 533140831d fix(ipc): make sessions compatible between versions (#4439)
* translate ipc tuple enum variants to struct enum variants

* initial client/server contract

* tests and missing types

* migrate web server and remove rmp_serde

* change socket folder

* fix crash on unknown messages

* fix client  logout on unknown message

* fix web client logout on unknown message

* rustfmt

* add comment and change  log level

* address compilation warnings

* style(fmt): rustfmt

* fix plugin system test assertions

* add pr
2025-09-24 12:56:56 +02:00
Aram Drevekenin b7bf364c09 fix(ci): make cross compilation work with the no-web variant (#4330)
* add no_web flag to ci cross compilation

* chore(ci): refactor release to web/no-web variants

* fix ci for cross building with no-web
2025-08-01 16:17:44 +02:00
Aram DrevekeninandThomas Linford c5ac796880 Feature: web-client/server to share your sessions in the browser (#4242)
* work

* moar work

* notes

* work

* separate to terminal and control channels

* stdin working

* serve html web client initial

* serve static assets loaded with include_dir

* merge

* enable_web_server config parameter

* compile time flag to disable web server capability

* rustfmt

* add license to all xterm.js assets

* mouse working except copy/paste

* helpful comment

* web client improvements

- move script to js file
- add favicon
- add nerd font
- change title

TODO: investigate if font license embedded in otf is sufficient

* get mouse to work properly

* kitty keyboard support initial

* fix wrong type in preload link

* wip axum websocket handlers

- upgrade axum to v0.8.1, enable ws feature
- begin setup of websocket handlers
- tidy up imports

* replace control listener

* handle terminal websocket with axum

* cleanup Cargo.toml

* kitty fixes and bracketed paste

* fix(mouse): pane not found crash

* initial session switching infra

* add `web_client_font` option

* session switching, creation and resurrection working through the session manager

* move session module to zellij-utils and share logic with web-client

* some cleanups

* require restart for enable-web-server

* use session name from router

* write config to disk and watch for config changes

* rename session name to ipc path

* add basic panic handler, make render_to_client exit on channel close

* use while let instead of loop

* handle websocket close

* add mouse motions

* make clipboard work

* add weblink handling and webgl rendering

* add todo

* fix: use session name instead of patch on session switch

* use "default" layout for new sessions

* ui indication for session being shared

* share this session ui

* plugin assets

* Fix process crash on mac with notify watcher.

Use poll watcher instead of recommended as a workaround.

* make url session switching and creation work

* start welcome screen on root url

* scaffold control messages, set font from config

* set dimensions on session start

* bring back session name from url

* send bytes on terminal websocket instead of json

- create web client os input and id before websocket connection

* draft ui

* work

* refactor ui

* remove otf font, remove margins to avoid scrollbar

* version query endpoint for server status

* web session info query endpoint

* refactor: move stuff around

* add web client info to session metadata

* make tests pass

* populate real data in session list

* remove unnecessary endpoint

* add web_client node to config, add font option

* remove web_client_font

* allow disabling the web session through the config - WIP

* formalize sharing/not-sharing configuration

* fix tests

* allow shutting down web server

* display error when web clients are forbidden to attach

* only show sessions that allow web clients if this is a web client

* style(fmt): rustfmt

* fix: query web server from Zellij rather than from each plugin

* remove log spam

* handle some error paths better in the web client

* allow controlling the web server through the cli

* allow configuring the web server's ip/port

* fix tests and format code

* use direct WebServerStatus event instead of piggy-backing on SessionInfo

* plugin revamp initial

* make plugin responsive

* adjust plugin title

* refactor: share plugin

* refactor: share plugin

* add cors middleware

* some fixes for running without a compiled web server capability

* display error when starting the share plugin without web server support

* clarify config

* add pipelines to compile zellij without web support

* display error when unable to start web server

* only query web server when share plugin is running

* refactor(web-client): connection table

* give zellij_server_listener access to the control channel

* fixes and clarifications

* refactor: consolidate generate_unique_session_name

* give proper error when trying to attach to a forbidden session

* change browser URL when switching sessions

* add keyboard shortcut

* enforce https when bound to non-loopback ip

* initial authentication token implementation

* background color from theme

* initial web client theme config

* basic token generation ui

* refactor set config message creation

* also set body background

* allow editing scrollback for plugins too

* set scrollback to 0

* properly parse colors in config

* generate token from plugin

* nice login modals

* initial token management screen

* implement token authentication

* refactor(share): token management screen

* style(fmt): rustfmt

* fix(plugin): some minor bugs

* refactor(share): main screen

* refactor(share): token screen

* refactor(share): main

* refactor(share): ui components

* fix(responsiveness): properly send usage_width to the render function

* fix cli commands and add some verbosity

* add support for settings ansi and selection colors

* add cursor and cursor accent

* basic web client tests

* fix tests

* refactor: web client

* use session tokens for authentication

* improve modals

* move shutdown to ipc

* refactor: ipc logic

* serialize theme config for web client

* update tests

* refactor: move some stuff around to prepare for config hot reload

* config live reloading for the web clients

* change remember-me UI wording

* improve xterm.js link handling

* make sure terminal is focused on mousemove

* remove deprecated sharing indication from compact-bar

* gate deps and functionality behind the web_server_compatibility feature

* feat(build): add --no-web flag in all the places

* fix some other build flows

* add new assets

* update CI for no-web (untested)

* make more dependencies optional

* update axum-extra

* add web client configuration options

* gracefully close connections on server exit

* tests for graceful connection closing

* handle client-side reconnect when server is down

* fix: make sure ipc bus folder exists before starting

* add commands to manage login tokens from the cli

* style(fmt): rustfmt

* some cleanups

* fix(ux): allow alt-right-click on the web client without opening the context menu

* fix: prevent attaching to welcome screen

* fix: reload config issues

* fix long socket path on macos

* normalize config conversion and fix color gap in browser

* revoke session_token cookie if it is not valid

* fix: visual bug with multiple clients in extremely small screen sizes

* fix: only include rusqlite for the web server capability builds

* update e2e snapshots

* refactor(web): client side js

* some cleanups

* moar cleanups

* fix(tests): wait for server instead of using a fixed timeout

* debug CI

* fix(tests): use spawn_blocking for running the test web server

* fix(tests): wait for http rather than tcp port

* fix(tests): properly pass config path - hopefully this is the issue...

* success! bring back the rest of the tests

* attempt to fix the macos CI issue

* docs(changelog): add PR

---------

Co-authored-by: Thomas Linford <linford.t@gmail.com>
2025-06-23 19:19:37 +02:00
Aram Drevekenin 27c8986939 feat: multiple Select and Bulk Pane Actions (#4169)
* initial implementation with break panes to new tab

* break pane group left/right

* group embed/eject panes

* stack pane group on resize

* close pane group

* style(fmt): rustfmt

* fix tests

* group drag and ungroup with the mouse

* fix mouse hover for multiple clients

* fix for multiple clients

* multiple select plugin initial

* use real data in plugin

* adjust functionality

* fix some ux issues

* reflect group mouse group selections in plugin

* group/ungroup panes in Zellij

* highlight frames when marked by the plugin

* refactor: render function in plugin

* some ui responsiveness

* some more responsiveness and adjust hover text

* break out functionality

* stack functionality

* break panes left/right and close multiple panes

* fix(tab): only relayout the relevant layout when non-focused pane is closed

* status bar UI

* embed and float panes

* work

* fix some ui/ux issues

* refactor: move stuff around

* some responsiveness and fix search result browsing bug

* change plugin pane title

* differentiate group from focused pane

* add keyboard shortcut

* add ui to compact bar

* make boundary colors appear properly without pane frames

* get plugins to also display their frame color

* make hover shortcuts appear on command panes

* fix: do not render search string component if it's empty

* BeforeClose Event and unhighlight panes on exit

* some UI/UX fixes

* some fixes to the catppuccin-latte theme

* remove ungroup shortcut

* make some ui components opaque

* fix more opaque elements

* fix some issues with stacking pane order

* keyboard shortcuts for grouping

* config to opt out of advanced mouse actions

* make selected + focused frame color distinct

* group marking mode

* refactor: multiple-select plugin

* adjust stacking group behavior

* adjust flashing periods

* render common modifier in group controls

* add to compact bar

* adjust key hint wording

* add key to presets and default config

* some cleanups

* some refactoring

* fix tests

* fix plugin system tests

* tests: group/ungroup/hover

* test: BeforeClose plugin event

* new plugin assets

* style(fmt): rustfmt

* remove warnings

* tests: give plugin more time to load
2025-04-29 20:52:17 +02:00
har7an a2ae82259c build: Don't use default features (#4086)
* chore: Cut down dependency features

and reduce the impact of future changes to crate `default-feature`
changes. Also reduce a few transient dependencies which were previously
pulled in by crate features we aren't using.

* deps(utils): Remove `once_cell` dependency.

* deps: Remove more dependency features.

* deps: Remove remaining default features.

* docs: Update Changelog with PR #4086.

* style: Apply rustfmt.
2025-03-22 13:40:37 +00:00
har7an 25e5f551c0 chore: Introduce workspace dependencies (#4085)
* cargo: Introduce workspace dependencies

and deduplicate dependency entries across all non-plugin workspace
members. In the future this hopefully makes dependency upgrade easier
since shared dependencies need only be touched in one location.

* docs: Update CHANGELOG with PR #4085.
2025-03-22 12:57:32 +00:00
har7an 502af243e0 Fix compiler warnings (#4053)
* chore(cargo): Update dependencies

for xtask subcommand to remove warnings about unknown compiler
attributes.

* deps(xtask): Remove `lazy_static`

as dependency, since the code we need can now be expressed using rusts
`std` builtin types.

* fix(xtask): Hide deprecated args

so the compiler doesn't complain about dead code any more.

* fix(xtask): Remove needless borrow.

* fix: Remove dead code

across the codebase, as discovered by the rust compiler.

* fix(server): Log previously ignored errors.

* fix(xtask): Remove needless `format!` calls.

* fix(xtask): Remove superfluous return statement.

* fix(client): Remove unused enum variant

from `ClientInstruction` and all code attached to it.

* fix(server): Restore functions needed in tests.

* chore: Apply rustfmt.

* fix(server): Add missing code.

* fix: Remove leftover warnings.

* CHANGELOG: Add MR #4026.

* fix(xtask): Pin `xshell` to version 0.2.2

because release 0.2.3 changed the way stdin is handled, breaking
interactive command invocations (such as we use).
2025-03-10 16:50:20 +00:00
har7an 736d43b138 fix(toolchain): Unbreak client startup
This reverts commit 9f900a7325.
2025-03-03 09:26:58 +00:00
har7an 9f900a7325 Fix compiler warnings (#4026)
* chore(cargo): Update dependencies

for xtask subcommand to remove warnings about unknown compiler
attributes.

* deps(xtask): Remove `lazy_static`

as dependency, since the code we need can now be expressed using rusts
`std` builtin types.

* fix(xtask): Hide deprecated args

so the compiler doesn't complain about dead code any more.

* fix(xtask): Remove needless borrow.

* fix: Remove dead code

across the codebase, as discovered by the rust compiler.

* fix(server): Log previously ignored errors.

* fix(xtask): Remove needless `format!` calls.

* fix(xtask): Remove superfluous return statement.

* fix(client): Remove unused enum variant

from `ClientInstruction` and all code attached to it.

* fix(server): Restore functions needed in tests.

* chore: Apply rustfmt.

* fix(server): Add missing code.

* fix: Remove leftover warnings.

* CHANGELOG: Add MR #4026.
2025-02-28 14:09:35 +00:00
Aram Drevekenin 3e493f34c9 feat(ui): about plugin and release notes (#3979)
* basic about screen

* work

* finish implementing about plugin except theme spec

* show about plugin only on first version run

* some cleanups and do the right thing with open/xdg-open

* refactor: make ui framework

* refactor: remove old stuff

* refactor: about plugin

* style(fmt): rustfmt

* chore(repo): about plugin asset

* fix tests

* style(fmt): rustfmt!!
2025-02-10 16:05:48 +01:00
har7an 10df29ed11 Update rust toolchain to 1.84 (#3945)
* chore: Remove deprecated `Makefile.toml`

which really should have been deleted as part of #2012. This hasn't been
updated for more than 2 years now and I don't expect anyone to still use
this. Our build process is now managed by `cargo xtask`.

* Cargo: Update the Rust toolchain to 1.84.0

from 1.75.0 which has been deprecated for a while now. Along with this
change, the `wasm32-wasi` target is no longer available (see subsequent
commit for additional info).

* chore: Rename `wasm32-wasi` to `wasm32-wasip1`

as required by the Rust project. The `wasm32-wasi` target name has been
retired and will likely be reused at a later time, although to express
an entirely different target (i.e. implementation of the WASI standard).

For additional information, see:

  - https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html
  - https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#wasi-01-target-naming-changed

* chore: Drop `rust-analysis` component

from the `rust-toolchain.toml` definition. This was added way back in
2021 via 8688569a, and while I'm not sure what it expressed back then,
nowadays it refers to [Metadata for RLS][1], which apparently was an
early language server implementation and has long since been replaced by
*rust-analyzer*.

We don't want to propose or enforce the use of a specific toolchain and
in any case, setting this up properly is the job of a developers
IDE/Editor.

[1]:
https://github.com/rust-lang/rustup/blob/1f06e3b31d444f3649dd51225a9d38362f7313e0/doc/user-guide/src/concepts/components.md#previous-components

* chore: Adhere to type rename

from `std::panic::PanicInfo` to `std::panic::PanicHookInfo`, which was
introduced in Rust 1.81.0. For additional information, see:

- https://releases.rs/docs/1.81.0/#compatibility-notes
- https://github.com/rust-lang/rust/pull/115974/

* fix(utils/data): Adhere to expected case

in match arm patterns, since the expression being matched against has
been modified using `to_ascii_lowercase`. Hence, we cannot have upper
case ASCII chars in the expressions (these arms were previously no-ops).

* fix(utils): Derive `Hash` manually

in `input/layout` since the `PartialEq` trait is also implemented
manually. Previously the `Hash` impl wasn't consistent with the `Eq`
impl, which can have weird effects when using these types in e.g.
`HashMap`s or similar types. For additional information, see:

  - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
  - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq

* fix(utils): Derive `Hash` manually

in `pane_size` since the `PartialEq` trait is also implemented manually.
Previously the `Hash` impl wasn't consistent with the `Eq` impl, which
can have weird effects when using these types in e.g. `HashMap`s or
similar types. For additional information, see:

  - https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
  - https://doc.rust-lang.org/stable/std/hash/trait.Hash.html#hash-and-eq

* fix(server): Don't redeclare variables

with their same names. Latest rust toolchains reject this code.

* chore(actions): Use non-archived toolchain setup

for the Rust toolchain. The previously used action has been archived
over a year ago. The new one should also support reading our
`rust-toolchain.toml`, so we no longer have to keep track of the
toolchain in multiple places.

* chore(actions): Add some space to YAML files

to make them better visually parsable.

* ci: Remove toolchain update Job

since as far as I can tell, this isn't used any more.

* ci: Fix invalid actions specification

and only request an action without running other code.

* CHANGELOG: Add PR #3945.
2025-01-25 17:43:49 +00:00
Aram Drevekenin 9f1e38f9fa feat(ui): built-in plugin manager (#3633)
* add plugin list to session info

* feat(plugins): new_plugin and reload_plugin API commands

* feat(plugins): built-in plugin manager

* style(fmt): rustfmt

* update plugins
2024-09-30 18:04:40 +02:00
Aram Drevekenin 84ff29dd02 feat(ui): configuration screen + configure non-colliding keys at runtime (#3502)
* rebind => reconfigure

* persist keybinds and mode info to new tabs

* add configuration plugin

* make tests pass

* remove warnings

* style(fmt): rustfmt
2024-07-17 16:08:31 +02:00
8fd7a67898 fix(terminal): improve reflow performance and general memory usage by reducing size of TerminalCharacter (#3043)
* refactor: Simplify transfer_rows_from_viewport_to_lines_above

next_lines is always consolidated to a single Row, which immediately
gets removed - we can remove some dead code as a result

* perf: Batch remove rows from the viewport for performance

Given a 1MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~9s to ~3s

* perf: Optimize Row::drain_until by splitting chars in one step

Given a 10MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~23s to ~20s

* refactor: Simplify `if let` into a `.map`

* refactor: There are only new saved coordinates when there were old ones

* refactor: Unify viewport transfer: use common variable names

* fix: Use same saved cursor logic in height resize as width

See #2182 for original introduction that only added it in one branch,
this fixes an issue where the saved cursor was incorrectly reset when
the real cursor was

* fix: Correct saved+real cursor calculations when reflowing long lines

* fix: Don't create canonical lines if cursor ends on EOL after resize

Previously if a 20 character line were split into two 10 character
lines, the cursor would be placed on the line after the two lines.
New characters would then be treated as a new canonical line. This
commit fixes this by biasing cursors to the end of the previous line.

* fix: for cursor index calculation in lines that are already wrapped

* chore: test for real/saved cursor position being handled separately

* chore: Apply cargo format

* refactor: Unify viewport transfer: transfer + cursor update together

* perf: Reduce size of TerminalCharacter from 72 to 60 bytes

With a 10MB single line catted into a fresh terminal, VmRSS goes from
964092 kB to 874020 kB (as reported by /proc/<pid>/status) before/after
this patch

Given a 10MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~15s to ~12.5s

* fix(build): Don't unconditionally rebuild zellij-utils

* refactor: Remove Copy impl on TerminalCharacter

* perf: Rc styles to reduce TerminalCharacter from 60 to 24 bytes

With a 10MB single line catted into a fresh terminal, VmRSS goes from
845156 kB to 478396 kB (as reported by /proc/<pid>/status) before/after
this patch

Given a 10MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~12.5s to ~7s

* perf: Remove RcCharacterStyles::Default, allow enum niche optimisation

This reduces TerminalCharacter from 24 to 16 bytes

With a 10MB single line catted into a fresh terminal, VmRSS goes from
478396 kB to 398108 kB (as reported by /proc/<pid>/status) before/after
this patch

Given a 10MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~7s to ~4.75s

* docs: link anchor omission from reset_all is deliberate

reset_all is only used from ansi params, and ansi params don't control
link anchor

* fix: Remove no-op on variable that gets immediately dropped

* refactor: Simplify replace_character_at logic

The original condition checked absolute_x_index was in bounds, then
used the index to manipulate it. This is equivalent to getting a
ref to the character at that position and manipulating directly

* chore: Run xtask format

* chore(repo): update issue templates

* Bump rust version to 1.75.0 (#3039)

* rust-toolchain: Bump toolchain version to 1.69.0

which, compared to the previous 1.67.0, has the following impacts on
`zellij`:

- [Turn off debuginfo for build deps][2]: Increases build time (on my
  machine) from ~230 s in 1.67.0 to ~250 s now, *which is unexpected*

This version also changes [handling of the `default-features` flag][3]
when specifying dependencies in `Cargo.toml`. If a dependent crate
requires `default-features = true` on a crate that is required as
`default-features = false` further up the dependency tree, the `true`
setting "wins". We only specify `default-features = false` for three
crates total:

- `names`: This is used only by us
- `surf`: This is used only by us
- `vte`: This is also required by `strip-ansi-escapes`, but that has
  `default-features = false` as well

How this affects our transitive dependencies is unknown at this point.

[2]: https://github.com/rust-lang/cargo/pull/11252/
[3]: https://github.com/rust-lang/cargo/pull/11409/

* rust-toolchain: Bump toolchain version to 1.70.0

which, compared to the previous 1.69.0, as the following impacts on
`zellij`:

1. [Enable sparse registry checkout for crates.io by default][1]

This drastically increases the time to first build on a fresh rust
installation/a rust installation with a clean cargo registry cache.
Previously it took about 75s to populate the deps/cache (with `cargo
fetch --locked` and ~100 MBit/s network), whereas now the same process
takes ~10 s.

2. [The `OnceCell` type is now part of std][2]

In theory, this would allow us to cut a dependency from `zellij-utils`,
but the `once_cell` crate is pulled in by another 16 deps, so there's no
point in attempting it right now.

Build times and binary sizes are unaffected by this change compared to
the previous 1.69.0 toolchain.

[1]: https://github.com/rust-lang/cargo/pull/11791/
[2]: https://doc.rust-lang.org/stable/std/cell/struct.OnceCell.html

* rust-toolchain: Bump toolchain version to 1.75.0

which, compared to the previous 1.70.0, has the following impacts on
`zellij`:

1. [cross-crate inlining][8]

This should increase application performance, as functions can now be
inlined across crates.

2. [`async fn` in traits][9]

This would allow us to drop the `async_trait` dependency, but it is
currently still required by 3 other dependencies.

Build time in debug mode (on my own PC) is cut down from 256s to 189s
(for a clean build). Build time in release mode is cut down from 473s to
391s (for a clean build). Binary sizes only change minimally (825 MB ->
807 MB in debug, 29 MB -> 30 MB in release).

[8]: https://github.com/rust-lang/rust/pull/116505
[9]: https://github.com/rust-lang/rust/pull/115822/

* chore: Apply rustfmt.

* CHANGELOG: Add PR #3039.

* feat(plugins): introduce 'pipes', allowing users to pipe data to and control plugins from the command line (#3066)

* prototype - working with message from the cli

* prototype - pipe from the CLI to plugins

* prototype - pipe from the CLI to plugins and back again

* prototype - working with better cli interface

* prototype - working after removing unused stuff

* prototype - working with launching plugin if it is not launched, also fixed event ordering

* refactor: change message to cli-message

* prototype - allow plugins to send messages to each other

* fix: allow cli messages to send plugin parameters (and implement backpressure)

* fix: use input_pipe_id to identify cli pipes instead of their message name

* fix: come cleanups and add skip_cache parameter

* fix: pipe/client-server communication robustness

* fix: leaking messages between plugins while loading

* feat: allow plugins to specify how a new plugin instance is launched when sending messages

* fix: add permissions

* refactor: adjust cli api

* fix: improve cli plugin loading error messages

* docs: cli pipe

* fix: take plugin configuration into account when messaging between plugins

* refactor: pipe message protobuf interface

* refactor: update(event) -> pipe

* refactor - rename CliMessage to CliPipe

* fix: add is_private to pipes and change some naming

* refactor - cli client

* refactor: various cleanups

* style(fmt): rustfmt

* fix(pipes): backpressure across multiple plugins

* style: some cleanups

* style(fmt): rustfmt

* style: fix merge conflict mistake

* style(wording): clarify pipe permission

* docs(changelog): introduce pipes

* xtask: Disable pusing during publish (#3040)

* xtask: Add `--no-push` flag to `publish`

which can be used when simulating releases to work without a writable
git fork of the zellij code.

* xtask: Fix borrow issues

* xtask/pipe: Require lockfile in publish

to avoid errors from invalid dependency versions.

* CHANGELOG: Add PR #3040.

* fix(terminal): some real/saved cursor bugs during resize (#3032)

* refactor: Simplify transfer_rows_from_viewport_to_lines_above

next_lines is always consolidated to a single Row, which immediately
gets removed - we can remove some dead code as a result

* perf: Batch remove rows from the viewport for performance

Given a 1MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~9s to ~3s

* perf: Optimize Row::drain_until by splitting chars in one step

Given a 10MB line catted into the terminal, a toggle-fullscreen +
toggle-fullscreen + close-pane + `run true` goes from ~23s to ~20s

* refactor: Simplify `if let` into a `.map`

* refactor: There are only new saved coordinates when there were old ones

* refactor: Unify viewport transfer: use common variable names

* fix: Use same saved cursor logic in height resize as width

See #2182 for original introduction that only added it in one branch,
this fixes an issue where the saved cursor was incorrectly reset when
the real cursor was

* fix: Correct saved+real cursor calculations when reflowing long lines

* fix: Don't create canonical lines if cursor ends on EOL after resize

Previously if a 20 character line were split into two 10 character
lines, the cursor would be placed on the line after the two lines.
New characters would then be treated as a new canonical line. This
commit fixes this by biasing cursors to the end of the previous line.

* fix: for cursor index calculation in lines that are already wrapped

* chore: test for real/saved cursor position being handled separately

* chore: Apply cargo format

* chore(repo): update issue templates

* Bump rust version to 1.75.0 (#3039)

* rust-toolchain: Bump toolchain version to 1.69.0

which, compared to the previous 1.67.0, has the following impacts on
`zellij`:

- [Turn off debuginfo for build deps][2]: Increases build time (on my
  machine) from ~230 s in 1.67.0 to ~250 s now, *which is unexpected*

This version also changes [handling of the `default-features` flag][3]
when specifying dependencies in `Cargo.toml`. If a dependent crate
requires `default-features = true` on a crate that is required as
`default-features = false` further up the dependency tree, the `true`
setting "wins". We only specify `default-features = false` for three
crates total:

- `names`: This is used only by us
- `surf`: This is used only by us
- `vte`: This is also required by `strip-ansi-escapes`, but that has
  `default-features = false` as well

How this affects our transitive dependencies is unknown at this point.

[2]: https://github.com/rust-lang/cargo/pull/11252/
[3]: https://github.com/rust-lang/cargo/pull/11409/

* rust-toolchain: Bump toolchain version to 1.70.0

which, compared to the previous 1.69.0, as the following impacts on
`zellij`:

1. [Enable sparse registry checkout for crates.io by default][1]

This drastically increases the time to first build on a fresh rust
installation/a rust installation with a clean cargo registry cache.
Previously it took about 75s to populate the deps/cache (with `cargo
fetch --locked` and ~100 MBit/s network), whereas now the same process
takes ~10 s.

2. [The `OnceCell` type is now part of std][2]

In theory, this would allow us to cut a dependency from `zellij-utils`,
but the `once_cell` crate is pulled in by another 16 deps, so there's no
point in attempting it right now.

Build times and binary sizes are unaffected by this change compared to
the previous 1.69.0 toolchain.

[1]: https://github.com/rust-lang/cargo/pull/11791/
[2]: https://doc.rust-lang.org/stable/std/cell/struct.OnceCell.html

* rust-toolchain: Bump toolchain version to 1.75.0

which, compared to the previous 1.70.0, has the following impacts on
`zellij`:

1. [cross-crate inlining][8]

This should increase application performance, as functions can now be
inlined across crates.

2. [`async fn` in traits][9]

This would allow us to drop the `async_trait` dependency, but it is
currently still required by 3 other dependencies.

Build time in debug mode (on my own PC) is cut down from 256s to 189s
(for a clean build). Build time in release mode is cut down from 473s to
391s (for a clean build). Binary sizes only change minimally (825 MB ->
807 MB in debug, 29 MB -> 30 MB in release).

[8]: https://github.com/rust-lang/rust/pull/116505
[9]: https://github.com/rust-lang/rust/pull/115822/

* chore: Apply rustfmt.

* CHANGELOG: Add PR #3039.

* feat(plugins): introduce 'pipes', allowing users to pipe data to and control plugins from the command line (#3066)

* prototype - working with message from the cli

* prototype - pipe from the CLI to plugins

* prototype - pipe from the CLI to plugins and back again

* prototype - working with better cli interface

* prototype - working after removing unused stuff

* prototype - working with launching plugin if it is not launched, also fixed event ordering

* refactor: change message to cli-message

* prototype - allow plugins to send messages to each other

* fix: allow cli messages to send plugin parameters (and implement backpressure)

* fix: use input_pipe_id to identify cli pipes instead of their message name

* fix: come cleanups and add skip_cache parameter

* fix: pipe/client-server communication robustness

* fix: leaking messages between plugins while loading

* feat: allow plugins to specify how a new plugin instance is launched when sending messages

* fix: add permissions

* refactor: adjust cli api

* fix: improve cli plugin loading error messages

* docs: cli pipe

* fix: take plugin configuration into account when messaging between plugins

* refactor: pipe message protobuf interface

* refactor: update(event) -> pipe

* refactor - rename CliMessage to CliPipe

* fix: add is_private to pipes and change some naming

* refactor - cli client

* refactor: various cleanups

* style(fmt): rustfmt

* fix(pipes): backpressure across multiple plugins

* style: some cleanups

* style(fmt): rustfmt

* style: fix merge conflict mistake

* style(wording): clarify pipe permission

* docs(changelog): introduce pipes

* fix: add some robustness and future proofing

* fix e2e tests

---------

Co-authored-by: Aram Drevekenin <aram@poor.dev>
Co-authored-by: har7an <99636919+har7an@users.noreply.github.com>

* fix integer overflow again (oops)

---------

Co-authored-by: Aram Drevekenin <aram@poor.dev>
Co-authored-by: har7an <99636919+har7an@users.noreply.github.com>
2024-01-22 15:28:57 +01:00
har7an 592cabeda8 xtask: Disable pusing during publish (#3040)
* xtask: Add `--no-push` flag to `publish`

which can be used when simulating releases to work without a writable
git fork of the zellij code.

* xtask: Fix borrow issues

* xtask/pipe: Require lockfile in publish

to avoid errors from invalid dependency versions.

* CHANGELOG: Add PR #3040.
2024-01-20 12:47:21 +00:00
har7an 8031d6bf64 xtask/pipeline: Fix publish task (#2711)
* xtask/pipeline: Fix publish task

which was previously stuck in an infinite loop after successfully
publishing a crate. The error originated in the code only checking for
error conditions but not breaking out of the inner infinite loop in case
of success.

* xtask: Improve publish failure UX

by offering the user more actions to choose from when an error occured.

* utils/assets: Add generated prost files to assets

to make sure they're available at build time and are picked up by all
components. It seems we hit some strange bug with the build script
where, when running `cargo publish --dry-run` the build script **is
not** run before regularly compiling zellij-utils. This shouldn't happen
according to the docs, but I cannot explain what's causing it. So we're
using this as a workaround for now to make a smooth release.

* xtask: Prevent accidental git commit deletion

when dry-running a publish.

* utils: Add comments to protobuf-related code

to explain why these changes were performed. The comments all include a
link to an issue comment explaining the situation in greater detail.

* xtask: Build protobuf definitions

when building any part of the project, similar to how we build the
plugins when required. This should ensure that all crates built through
`cargo xtask` (which is the officially supported build method) will
receive up-to-date protobuf definitions.
2023-08-28 06:24:27 +00:00
Aram Drevekenin bc628abc12 feat(sessions): add a session manager to switch between sessions, tabs and panes and create new ones (#2721)
* write/read session metadata to disk for all sessions

* switch session client side

* fix tests

* various adjustments

* fix full screen focus bug in tiled panes

* fix tests

* fix permission sorting issue

* cleanups

* add session manager

* fix tests

* various cleanups

* style(fmt): rustfmt

* clear screen before switching sessions

* I hate you clippy

* truncate controls line to width

* version session cache

* attempt to fix plugin tests

* style(fmt): rustfmt

* another attempt to fix the tests in the ci
2023-08-24 13:36:24 +02:00
Aram Drevekenin 5fe4d60c22 feat(plugins): Plugin workers and strider (#2449)
* mvp of strider fuzzy find

* improve search ui

* various refactoringz

* moar refactoring

* even more refactoring

* tests and more refactoring

* refactor: remove unused stuff

* style(fmt): rustfmt

* debug ci

* debug ci

* correct path for plugin system tests

* fix plugin system ci tests

* remove debugging statements from test

* fix plugin worker persistence

* add test for plugin worker persistence

* style(fmt): rustfmt

* final cleanups

* remove outdated comments
2023-05-16 12:47:18 +02:00
har7an 30d0cffa42 Use rust 1.67 (#2375)
* rust: Update toolchain version to 1.67

* xtask/pipeline/publish: Drop manual "wait"

for crates.io to catch up, which is obsolete with rust 1.66 and up.
Cargo does that on its own now. See
https://github.com/rust-lang/cargo/pull/11062

* xtask: Add function to obtain asset_dir

instead of assembling it on demand throughout the codebase.

* xtask/run: Add '--quick-run' flag

as a convenient shorthand for `cargo xtask run --data-dir
$PROJECT_ROOT/zellij-utils/assets`.

* cargo: Add 'q' command alias

as a shorthand for 'cargo xtask run --quick-run'

* cargo: Update thiserror to 1.0.40

* cargo: Update anyhow to 1.0.70

and specify dependency only once inside `zellij-utils`, not inside the
zellij root crate.

* cargo: Update names to 0.14.0

* cargo: Update miette to 5.7.0

and re-export the dependency from zellij-utils, to avoid duplicate
(incompatible) includes from inside zellij-utils and the root crate.

* cargo: Update dialoguer to 0.10.4

* fix formatting

* changelog: Add PR #2375
2023-05-09 02:43:28 +00:00
Thomas Linford f598ca3738 improve build/ci times (#2396)
- avoid building all workspace crates with `cargo x build` (only plugins and main binary)
- only set the target triple in tests for plugins
- add new profile for `cargo x run` to build with optimized dependencies => FAST plugins when developing (thanks [Bevy Book](https://bevyengine.org/learn/book/getting-started/setup/#compile-with-performance-optimizations) for the idea)
- use https://github.com/Swatinem/rust-cache to avoid rebuilding dependencies every time in ci
- split `Build & Test` job into two so they run in parallel
- hopefully improve the flaky tests situation, this also makes the e2e tests run much faster (some tests produced correct snapshots but had some logic errors causing them to loop for much longer than necessary). Add some output to the tests so it is easier to see if something goes wrong.
- remove verbose build output from e2e test build
2023-05-03 21:16:38 +02:00
Aram Drevekenin 4a32547fd4 hotfix: fix assets 2023-03-07 10:11:32 +01:00
har7an 46b9bc755e Feature: simulate publishing (#2194)
* xtask: Add arguments to `publish`

that allow specifying a custom git remote to push to and a custom cargo
registry to publish packages to.

* xtask/publish: Don't release `xtask` subcrate

because it's not meant to be released at all.

* xtask/publish: Add status messages to publish

so we see what crate is currently being published, too.

* xtask/publish: Disable default features on `zellij`

because otherwise it tries to pick up the debug builds of the plugins,
which aren't part of released version of `zellij utils`.

* xtask/publish: Fix handling of custom registry

* docs: Add `RELEASE.md`

which explains how to simulate a zellij release.

* xtask: Apply rustfmt

* xtask: Remove `wasm-opt` from build steps

because recent versions cause havoc in the release process in GitHub
pipelines and it's primary goal is to only reduce binary size. Current
rust versions seem to produce very compact wasm binaries themselves,
though.

* .github: Don't install wasm-opt in workflows
2023-03-06 18:16:21 +00:00
m-lima d1b458e37b chore(build): make the singlepass compiler opt-in through flags (#2146) 2023-02-13 17:52:10 +01:00
m-lima 5b3e1ecacd chore(development): use singlepass in debug mode (#2134)
* Add new feature flags

* Use singlepass in debug mode

* Use Cow to avoid unnecessary copies

- Instead of removing and reinserting into the memory cache, use Cow to
  model both owned an borrowed data
- Log at debug-level the time to compile/load a wasm module
- A little clippy drive-by on touched files

* Satisfy the assumption from zellij-utils/src/consts.rs for target-dir

* Allow forcing cranlift in debug mode

* Remove deprecated comments

* PR comment: typo

* Remove extras
2023-02-07 17:55:37 +01:00
har7an beddfb77a8 Improve client disconnect handling (#2068)
* xtask/run: Use varargs when run with `-data-dir`

Previously any additional arguments passed on the command line were
ignored. Now they are appended to `cargo run ...` as documented.

* server/os_i_o: Improve error message when IPC dies

and display the last send/recv error to the user instead of a generic
"Buffer full" message.

* server/lib: Log error in `send_to_client!`

so we will know when an error occured while trying to send a message to
the client. The most likely cause for this is that the client buffer
filled up and hence we cannot send any new messages. While we still
disconnect the client as before, now we also write a log message that
explains the situation.

* utils/channel: Apply rustfmt

* server/lib: Detect when client responds too slow

and log a message before disconnecting it.

* server/os_i_o: Add retry queue to client senders

that is dynamically allocated on-demand and stores `ServerToClientMsg`
in case the regular IPC channel is currently full. This acts as a
dynamic buffer to hold and buffer messages for a while until the client
hopefully catches up.

Also write a message to the log to indicate when the client is
recognized to be too slow in handling server messages.

* server: apply rustfmt

* utils/ipc: Add session name to "Disconnect" error

* utils/ipc: Fix error message indent

* server/os_i_o: Undo IPC channel extension

via `Vec` and drastically increase the IPC message queue size instead.
Measurements didn't discover a drastic increase in RAM caused by this,
and it is a much easier fix for the problem at hand.

* CHANGELOG: Add PR #2068
2023-01-22 18:04:40 +00:00
har7an d1f50150f6 WIP: Use xtask as build system (#2012)
* xtask: Implement a new build system

xtask is a cargo alias that is used to extend the cargo build system
with custom commands. For an introduction to xtask, see here:
https://github.com/matklad/cargo-xtask/

The idea is that instead of writing makefiles, xtask requires no
additional dependencies except `cargo` and `rustc`, which must be
available to build the project anyway.

This commit provides a basic implementation of the `build` and `test`
subcommands.

* xtask/deps: Add 'which'

* xtask/test: Handle error when cargo not found

* xtask/flags: Add more commands

to perform different useful tasks. Includes:

- clippy
- format
- "make" (composite)
- "install" (composite)

Also add more options to `build` to selectively compile plugins or leave
them out entirely.

* xtask/main: Return error when cargo not found

* xtask/build: Add more subtasks

- `wasm_opt_plugins` and
- `manpage`

that perform other build commands. Add thorough documentation on what
each of these does and also handle the new `build` cli flags
appropriately.

* xtask/clippy: Add job to run clippy

* xtask/format: Add job to run rustfmt

* xtask/pipeline: Add composite commands

that perform multiple atomic xtask commands sequentially in a pipeline
sort of fashion.

* xtask/deps: Pin dependencies

* xtask/main: Integrate new jobs

and add documentation.

* xtask: Implement 'dist'

which performs an 'install' and copies the resulting zellij binary along
with some other assets to a `target/dist` folder.

* cargo: Update xflags version

* xtask: Measure task time, update tty title

* xtask: Update various tasks

* xtask: wasm-opt plugins in release builds

automatically.

* xtask/build: Copy debug plugins to assets folder

* xtask: Add 'run' subcommand

* xtask: Add arbitrary args to test and run

* xtask: Rearrange CLI commands in help

* xtask: Add deprecation notice

* docs: Replace `cargo make` with `xtask`

* github: Use `xtask` in workflows.

* xtask: Add support for CI commands

* xtask: Streamline error handling

* github: Use new xtask commands in CI

* xtask: Add 'publish' job

* xtask/publish: Add retry when publish fails

* xtask: Apply rustfmt

* xtask: Refine 'make' deprecation warning

* xtask: add task to build manpage

* contributing: Fix e2e commands

* xtask/run: Add missing `--`

to pass all arguments following `xtask run` directly to the zellij
binary being run.

* xtask: Stay in invocation dir

and make all tasks that need it change to the project root dir
themselves.

* xtask/run: Add `--data-dir` flag

which will allow very quick iterations when not changing the plugins
between builds.

* xtask/ci: Install dependencies without asking

* utils: Allow including plugins from target folder

* utils/assets: Reduce asset map complexity

* utils/consts: Update asset map docs

* xtask: Fix plugin includes

* xtask/test: Build plugins first

because the zellij binary needs to include the plugins.

* xtask/test: Fix formatting

* xtask: Add notice on how to disable it
2022-12-17 13:27:18 +00:00