mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-04 14:48:39 +00:00
input: extract mouse encoding to a pure, testable file
Move mouse event encoding logic from Surface.zig into a new input/mouse_encode.zig file. The new file encapsulates event filtering (shouldReport), button code computation, viewport bounds checking, motion deduplication, and all five wire formats (X10, UTF-8, SGR, urxvt, SGR-pixels). This makes the encoding independently testable and adds unit tests covering each format and edge case. Additionally, Surface `mouseReport` can no longer fail, since the only failure mode is no buffer space which should be impossible. Updated the signature to remove the error set.
This commit is contained in:
@@ -12,6 +12,7 @@ pub const function_keys = @import("input/function_keys.zig");
|
||||
pub const keycodes = @import("input/keycodes.zig");
|
||||
pub const key_encode = @import("input/key_encode.zig");
|
||||
pub const kitty = @import("input/kitty.zig");
|
||||
pub const mouse_encode = @import("input/mouse_encode.zig");
|
||||
pub const paste = @import("input/paste.zig");
|
||||
|
||||
pub const ctrlOrSuper = key.ctrlOrSuper;
|
||||
@@ -25,6 +26,7 @@ pub const KeyEvent = key.KeyEvent;
|
||||
pub const KeyRemapSet = key_mods.RemapSet;
|
||||
pub const InspectorMode = Binding.Action.InspectorMode;
|
||||
pub const Mods = key_mods.Mods;
|
||||
pub const MouseAction = mouse.Action;
|
||||
pub const MouseButton = mouse.Button;
|
||||
pub const MouseButtonState = mouse.ButtonState;
|
||||
pub const MousePressureStage = mouse.PressureStage;
|
||||
|
||||
Reference in New Issue
Block a user