From 076bcccde4a3ca55cf44b5e9850bd117cfcdccf5 Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 24 Jan 2025 14:55:33 +0700 Subject: [PATCH 1/3] Docs: improve doc structure for action bindings with args and examples minor doc changes --- src/input/Binding.zig | 48 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 33ed80c8b..0b2ee05de 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -280,8 +280,15 @@ pub const Action = union(enum) { scroll_page_fractional: f32, scroll_page_lines: i16, - /// Adjust an existing selection in a given direction. This action - /// does nothing if there is no active selection. + /// Adjust the current selection in a given direction. Does nothing if no + /// selection exists. + /// + /// Arguments: + /// - AdjustSelection: left, right, up, down, page_up, page_down, home, end, + /// beginning_of_line, end_of_line + /// + /// Example: Extend selection to the right + /// keybind = shift+right=adjust_selection:right adjust_selection: AdjustSelection, /// Jump the viewport forward or back by prompt. Positive number is the @@ -337,25 +344,47 @@ pub const Action = union(enum) { /// This only works with libadwaita enabled currently. toggle_tab_overview: void, - /// Create a new split in the given direction. The new split will appear in - /// the direction given. For example `new_split:up`. Valid values are left, right, up, down and auto. + /// Create a new split in the given direction. + /// + /// Arguments: + /// - SplitDirection: right, down, left, up, auto (along the larger dir) + /// + /// Example: Create split on the right + /// keybind = cmd+shift+d=new_split:right new_split: SplitDirection, - /// Focus on a split in a given direction. For example `goto_split:up`. Valid values are left, right, up, down, previous and next. + /// Focus a split in a given direction. + /// + /// Arguments: + /// - SplitFocusDirection: previous, next, up, left, down, right + /// + /// Example: Focus split on the right + /// keybind = cmd+right=goto_split:right goto_split: SplitFocusDirection, /// zoom/unzoom the current split. toggle_split_zoom: void, - /// Resize the current split by moving the split divider in the given - /// direction. For example `resize_split:left,10`. The valid directions are up, down, left and right. + /// Resize the current split in a given direction. + /// + /// Arguments: + /// - SplitResizeDirection: up, down, left, right + /// - The number of pixels to resize the split by + /// + /// Example: Move divider up 10 pixels + /// keybind = cmd+shift+up=resize_split:up,10 resize_split: SplitResizeParameter, /// Equalize all splits in the current window equalize_splits: void, - /// Show, hide, or toggle the terminal inspector for the currently focused - /// terminal. + /// Control the terminal inspector visibility. + /// + /// Arguments: + /// - InspectorMode: toggle, show, hide + /// + /// Example: Toggle inspector visibility + /// keybind = cmd+i=inspector:toggle inspector: InspectorMode, /// Open the configuration file in the default OS editor. If your default OS @@ -504,7 +533,6 @@ pub const Action = union(enum) { pub const SplitFocusDirection = enum { previous, next, - up, left, down, From c4c2d065711cdb4012002bec5d94109eb4942828 Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 24 Jan 2025 14:59:46 +0700 Subject: [PATCH 2/3] fmt --- src/apprt/gtk/App.zig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 12bac989a..b36c5b96a 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -1075,9 +1075,7 @@ fn loadCustomCss(self: *App) !void { defer file.close(); log.info("loading gtk-custom-css path={s}", .{path}); - const contents = try file.reader().readAllAlloc( - self.core_app.alloc, - 5 * 1024 * 1024 // 5MB + const contents = try file.reader().readAllAlloc(self.core_app.alloc, 5 * 1024 * 1024 // 5MB ); defer self.core_app.alloc.free(contents); From 0c5ef5578c1f0aa33ed8ecc7fdc11d207024021a Mon Sep 17 00:00:00 2001 From: Erlend Lind Madsen Date: Fri, 24 Jan 2025 23:13:42 +0700 Subject: [PATCH 3/3] Docs: remove type from action arguments --- src/input/Binding.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 0b2ee05de..a655effb5 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -284,7 +284,7 @@ pub const Action = union(enum) { /// selection exists. /// /// Arguments: - /// - AdjustSelection: left, right, up, down, page_up, page_down, home, end, + /// - left, right, up, down, page_up, page_down, home, end, /// beginning_of_line, end_of_line /// /// Example: Extend selection to the right @@ -347,7 +347,7 @@ pub const Action = union(enum) { /// Create a new split in the given direction. /// /// Arguments: - /// - SplitDirection: right, down, left, up, auto (along the larger dir) + /// - right, down, left, up, auto (splits along the larger direction) /// /// Example: Create split on the right /// keybind = cmd+shift+d=new_split:right @@ -356,7 +356,7 @@ pub const Action = union(enum) { /// Focus a split in a given direction. /// /// Arguments: - /// - SplitFocusDirection: previous, next, up, left, down, right + /// - previous, next, up, left, down, right /// /// Example: Focus split on the right /// keybind = cmd+right=goto_split:right @@ -368,8 +368,8 @@ pub const Action = union(enum) { /// Resize the current split in a given direction. /// /// Arguments: - /// - SplitResizeDirection: up, down, left, right - /// - The number of pixels to resize the split by + /// - up, down, left, right + /// - the number of pixels to resize the split by /// /// Example: Move divider up 10 pixels /// keybind = cmd+shift+up=resize_split:up,10 @@ -381,7 +381,7 @@ pub const Action = union(enum) { /// Control the terminal inspector visibility. /// /// Arguments: - /// - InspectorMode: toggle, show, hide + /// - toggle, show, hide /// /// Example: Toggle inspector visibility /// keybind = cmd+i=inspector:toggle