feat: add readonly surface mode

This commit is contained in:
Matthew Hrehirchuk
2025-10-10 12:30:55 -06:00
committed by Mitchell Hashimoto
parent dd06d8a13b
commit 12bb2f3f47
6 changed files with 58 additions and 1 deletions

View File

@@ -552,6 +552,16 @@ pub const Action = union(enum) {
/// reflect this by displaying an icon indicating the zoomed state.
toggle_split_zoom,
/// Toggle read-only mode for the current surface.
///
/// When a surface is in read-only mode:
/// - No input is sent to the PTY (mouse events, key encoding)
/// - Input can still be used at the terminal level to make selections,
/// copy/paste (keybinds), scroll, etc.
/// - Warn before quit is always enabled in this state even if an active
/// process is not running
toggle_readonly,
/// Resize the current split in the specified direction and amount in
/// pixels. The two arguments should be joined with a comma (`,`),
/// like in `resize_split:up,10`.
@@ -1241,6 +1251,7 @@ pub const Action = union(enum) {
.new_split,
.goto_split,
.toggle_split_zoom,
.toggle_readonly,
.resize_split,
.equalize_splits,
.inspector,

View File

@@ -485,6 +485,12 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Toggle the zoom state of the current split.",
}},
.toggle_readonly => comptime &.{.{
.action = .toggle_readonly,
.title = "Toggle Read-Only Mode",
.description = "Toggle read-only mode for the current surface.",
}},
.equalize_splits => comptime &.{.{
.action = .equalize_splits,
.title = "Equalize Splits",