mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
terminal/kitty: parse relative placement fields
This commit is contained in:
@ -462,6 +462,10 @@ pub const Display = struct {
|
|||||||
rows: u32 = 0, // r
|
rows: u32 = 0, // r
|
||||||
cursor_movement: CursorMovement = .after, // C
|
cursor_movement: CursorMovement = .after, // C
|
||||||
virtual_placement: bool = false, // U
|
virtual_placement: bool = false, // U
|
||||||
|
parent_id: u32 = 0, // P
|
||||||
|
parent_placement_id: u32 = 0, // Q
|
||||||
|
horizontal_offset: u32 = 0, // H
|
||||||
|
vertical_offset: u32 = 0, // V
|
||||||
z: i32 = 0, // z
|
z: i32 = 0, // z
|
||||||
|
|
||||||
pub const CursorMovement = enum {
|
pub const CursorMovement = enum {
|
||||||
@ -537,6 +541,22 @@ pub const Display = struct {
|
|||||||
result.z = @bitCast(v);
|
result.z = @bitCast(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kv.get('P')) |v| {
|
||||||
|
result.parent_id = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kv.get('Q')) |v| {
|
||||||
|
result.parent_placement_id = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kv.get('H')) |v| {
|
||||||
|
result.horizontal_offset = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kv.get('V')) |v| {
|
||||||
|
result.vertical_offset = v;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -187,7 +187,14 @@ fn display(
|
|||||||
// Location where the placement will go.
|
// Location where the placement will go.
|
||||||
const location: ImageStorage.Placement.Location = location: {
|
const location: ImageStorage.Placement.Location = location: {
|
||||||
// Virtual placements are not tracked
|
// Virtual placements are not tracked
|
||||||
if (d.virtual_placement) break :location .{ .virtual = {} };
|
if (d.virtual_placement) {
|
||||||
|
if (d.parent_id > 0) {
|
||||||
|
result.message = "EINVAL: virtual placement cannot refer to a parent";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
break :location .{ .virtual = {} };
|
||||||
|
}
|
||||||
|
|
||||||
// Track a new pin for our cursor. The cursor is always tracked but we
|
// Track a new pin for our cursor. The cursor is always tracked but we
|
||||||
// don't want this one to move with the cursor.
|
// don't want this one to move with the cursor.
|
||||||
|
Reference in New Issue
Block a user