mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-24 16:11:43 +00:00
terminal: rename paste_events mode to kitty_paste_events
This commit is contained in:
@@ -332,10 +332,9 @@ const entries: []const ModeEntry = &.{
|
||||
// one-time password instead of pasting the text.
|
||||
// See https://sw.kovidgoyal.net/kitty/clipboard/
|
||||
//
|
||||
// Disabled until the apprt paste integration lands; until then the
|
||||
// mode reports as unrecognized so applications correctly detect
|
||||
// paste events as unsupported.
|
||||
.{ .name = "paste_events", .value = 5522, .disabled = true },
|
||||
// Forcibly disabled for now since the functionality isn't exposed
|
||||
// yet to libghostty or any GUI apps.
|
||||
.{ .name = "kitty_paste_events", .value = 5522, .disabled = true },
|
||||
};
|
||||
|
||||
test {
|
||||
|
||||
@@ -390,13 +390,13 @@ types:
|
||||
Each named instance exposes one bit from the little-endian integer.
|
||||
Arithmetic division is used instead of bitwise operations because the
|
||||
JavaScript target implements those operations with signed 32-bit values.
|
||||
All values remain exact because the registry occupies only 42 bits,
|
||||
All values remain exact because the registry occupies only 43 bits,
|
||||
within JavaScript's 53-bit safe integer range.
|
||||
seq:
|
||||
- id: raw
|
||||
type: u8
|
||||
valid:
|
||||
max: 4398046511103
|
||||
max: 8796093022207
|
||||
instances:
|
||||
disable_keyboard:
|
||||
value: (raw / 1) % 2 != 0
|
||||
@@ -482,6 +482,8 @@ types:
|
||||
value: (raw / 1099511627776) % 2 != 0
|
||||
in_band_size_reports:
|
||||
value: (raw / 2199023255552) % 2 != 0
|
||||
kitty_paste_events:
|
||||
value: (raw / 4398046511104) % 2 != 0
|
||||
|
||||
tab_stops:
|
||||
params:
|
||||
|
||||
@@ -206,7 +206,8 @@
|
||||
//! bit 39 report_color_scheme
|
||||
//! bit 40 report_visibility
|
||||
//! bit 41 in_band_size_reports
|
||||
//! bits 42-63 reserved, zero
|
||||
//! bit 42 kitty_paste_events
|
||||
//! bits 43-63 reserved, zero
|
||||
//! ```
|
||||
//!
|
||||
//! This is the packed field order of native `ModePacked`. Its layout is
|
||||
@@ -470,7 +471,7 @@ pub const Header = struct {
|
||||
try writer.writeByte(@intCast(@intFromEnum(self.mouse_shape)));
|
||||
try writer.writeByte(@intFromBool(self.password_input));
|
||||
|
||||
// Runtime, saved, and reset mode sets. ModePacked occupies 41 bits;
|
||||
// Runtime, saved, and reset mode sets. ModePacked occupies 43 bits;
|
||||
// its eight-byte wire slots zero-extend the native packed value.
|
||||
const mode_values = [_]terminal_modes.ModePacked{
|
||||
self.current_modes,
|
||||
@@ -1203,7 +1204,7 @@ const test_header_fixture = test_fixture.parse(
|
||||
|
||||
test "TERMINAL mode bit layout" {
|
||||
try std.testing.expectEqual(
|
||||
@as(usize, 42),
|
||||
@as(usize, 43),
|
||||
@bitSizeOf(terminal_modes.ModePacked),
|
||||
);
|
||||
|
||||
@@ -1212,8 +1213,8 @@ test "TERMINAL mode bit layout" {
|
||||
);
|
||||
first.disable_keyboard = true;
|
||||
try std.testing.expectEqual(
|
||||
@as(u42, 1) << 0,
|
||||
@as(u42, @bitCast(first)),
|
||||
@as(u43, 1) << 0,
|
||||
@as(u43, @bitCast(first)),
|
||||
);
|
||||
|
||||
var visibility: terminal_modes.ModePacked = std.mem.zeroes(
|
||||
@@ -1221,17 +1222,26 @@ test "TERMINAL mode bit layout" {
|
||||
);
|
||||
visibility.report_visibility = true;
|
||||
try std.testing.expectEqual(
|
||||
@as(u42, 1) << 40,
|
||||
@as(u42, @bitCast(visibility)),
|
||||
@as(u43, 1) << 40,
|
||||
@as(u43, @bitCast(visibility)),
|
||||
);
|
||||
|
||||
var size_reports: terminal_modes.ModePacked = std.mem.zeroes(
|
||||
terminal_modes.ModePacked,
|
||||
);
|
||||
size_reports.in_band_size_reports = true;
|
||||
try std.testing.expectEqual(
|
||||
@as(u43, 1) << 41,
|
||||
@as(u43, @bitCast(size_reports)),
|
||||
);
|
||||
|
||||
var last: terminal_modes.ModePacked = std.mem.zeroes(
|
||||
terminal_modes.ModePacked,
|
||||
);
|
||||
last.in_band_size_reports = true;
|
||||
last.kitty_paste_events = true;
|
||||
try std.testing.expectEqual(
|
||||
@as(u42, 1) << 41,
|
||||
@as(u42, @bitCast(last)),
|
||||
@as(u43, 1) << 42,
|
||||
@as(u43, @bitCast(last)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user