mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
terminal: failing tracked pin test on fullReset
This commit is contained in:
@ -2356,7 +2356,11 @@ pub fn countTrackedPins(self: *const PageList) usize {
|
|||||||
/// Checks if a pin is valid for this pagelist. This is a very slow and
|
/// Checks if a pin is valid for this pagelist. This is a very slow and
|
||||||
/// expensive operation since we traverse the entire linked list in the
|
/// expensive operation since we traverse the entire linked list in the
|
||||||
/// worst case. Only for runtime safety/debug.
|
/// worst case. Only for runtime safety/debug.
|
||||||
fn pinIsValid(self: *const PageList, p: Pin) bool {
|
pub fn pinIsValid(self: *const PageList, p: Pin) bool {
|
||||||
|
// This is very slow so we want to ensure we only ever
|
||||||
|
// call this during slow runtime safety builds.
|
||||||
|
comptime assert(build_config.slow_runtime_safety);
|
||||||
|
|
||||||
var it = self.pages.first;
|
var it = self.pages.first;
|
||||||
while (it) |node| : (it = node.next) {
|
while (it) |node| : (it = node.next) {
|
||||||
if (node != p.node) continue;
|
if (node != p.node) continue;
|
||||||
|
@ -10575,6 +10575,16 @@ test "Terminal: fullReset default modes" {
|
|||||||
try testing.expect(t.modes.get(.grapheme_cluster));
|
try testing.expect(t.modes.get(.grapheme_cluster));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "Terminal: fullReset tracked pins" {
|
||||||
|
var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 });
|
||||||
|
defer t.deinit(testing.allocator);
|
||||||
|
|
||||||
|
// Create a tracked pin
|
||||||
|
const p = try t.screen.pages.trackPin(t.screen.cursor.page_pin.*);
|
||||||
|
t.fullReset();
|
||||||
|
try testing.expect(t.screen.pages.pinIsValid(p.*));
|
||||||
|
}
|
||||||
|
|
||||||
// https://github.com/mitchellh/ghostty/issues/272
|
// https://github.com/mitchellh/ghostty/issues/272
|
||||||
// This is also tested in depth in screen resize tests but I want to keep
|
// This is also tested in depth in screen resize tests but I want to keep
|
||||||
// this test around to ensure we don't regress at multiple layers.
|
// this test around to ensure we don't regress at multiple layers.
|
||||||
|
Reference in New Issue
Block a user