mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
core: converting more to new screen state
This commit is contained in:
@ -2459,24 +2459,33 @@ fn linkAtPos(
|
|||||||
DerivedConfig.Link,
|
DerivedConfig.Link,
|
||||||
terminal.Selection,
|
terminal.Selection,
|
||||||
} {
|
} {
|
||||||
// TODO(paged-terminal)
|
|
||||||
if (true) return null;
|
|
||||||
|
|
||||||
// If we have no configured links we can save a lot of work
|
// If we have no configured links we can save a lot of work
|
||||||
if (self.config.links.len == 0) return null;
|
if (self.config.links.len == 0) return null;
|
||||||
|
|
||||||
// Convert our cursor position to a screen point.
|
// Convert our cursor position to a screen point.
|
||||||
const mouse_pt = mouse_pt: {
|
const screen = &self.renderer_state.terminal.screen;
|
||||||
const viewport_point = self.posToViewport(pos.x, pos.y);
|
const mouse_pin: terminal.Pin = mouse_pin: {
|
||||||
break :mouse_pt viewport_point.toScreen(&self.io.terminal.screen);
|
const point = self.posToViewport(pos.x, pos.y);
|
||||||
|
const pin = screen.pages.pin(.{ .viewport = point }) orelse {
|
||||||
|
log.warn("failed to get pin for clicked point", .{});
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
break :mouse_pin pin;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get our comparison mods
|
// Get our comparison mods
|
||||||
const mouse_mods = self.mouseModsWithCapture(self.mouse.mods);
|
const mouse_mods = self.mouseModsWithCapture(self.mouse.mods);
|
||||||
|
|
||||||
// Get the line we're hovering over.
|
// Get the line we're hovering over.
|
||||||
const line = self.io.terminal.screen.getLine(mouse_pt) orelse
|
const line = screen.selectLine(.{
|
||||||
return null;
|
.pin = mouse_pin,
|
||||||
|
.whitespace = null,
|
||||||
|
.semantic_prompt_boundary = false,
|
||||||
|
}) orelse return null;
|
||||||
|
|
||||||
|
// TODO(paged-terminal)
|
||||||
|
if (true) return null;
|
||||||
|
|
||||||
const strmap = try line.stringMap(self.alloc);
|
const strmap = try line.stringMap(self.alloc);
|
||||||
defer strmap.deinit(self.alloc);
|
defer strmap.deinit(self.alloc);
|
||||||
|
|
||||||
@ -2492,7 +2501,7 @@ fn linkAtPos(
|
|||||||
var match = (try it.next()) orelse break;
|
var match = (try it.next()) orelse break;
|
||||||
defer match.deinit();
|
defer match.deinit();
|
||||||
const sel = match.selection();
|
const sel = match.selection();
|
||||||
if (!sel.contains(mouse_pt)) continue;
|
if (!sel.contains(screen, mouse_pin)) continue;
|
||||||
return .{ link, sel };
|
return .{ link, sel };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user