Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSC8 Hyperlink Support #1928

Merged
merged 58 commits into from
Jul 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
58173c9
terminal: parse osc 8 hyperlink_start
mitchellh Jun 9, 2024
f8e74a5
terminal: parse osc8 end
mitchellh Jun 9, 2024
6c7b784
terminal: additional parse test cases
mitchellh Jun 9, 2024
25d1e86
terminal: page memory layout for uri/hyperlink data
mitchellh Jun 9, 2024
75e1655
terminal: change default hyperlink count to zero
mitchellh Jun 9, 2024
69705cb
terminal: remove the hyperlink stuff i'm starting over
mitchellh Jul 3, 2024
a71b487
terminal: add strings table to page
mitchellh Jul 3, 2024
2a7755c
terminal: hyperlink data structures beginning, alloc into page
mitchellh Jul 3, 2024
cb1caff
terminal: refcountedset passes base memory to all context funcs
mitchellh Jul 3, 2024
2e41afc
terminal: RefCountedSet has Context variant methods
mitchellh Jul 4, 2024
51c05ae
terminal: RefCountedSet doesn't need to pass base anymore
mitchellh Jul 4, 2024
d1f41e2
terminal: hyperlink start/end on screen
mitchellh Jul 4, 2024
548850e
terminal: RefCountedSet should call deleted on upsert
mitchellh Jul 4, 2024
c880bb6
terminal: test hyperlink reuse shares ID
mitchellh Jul 4, 2024
6fc9e92
terminal: hyperlink deleted callback frees string memory
mitchellh Jul 4, 2024
a3a445a
terminal: print sets hyperlink state, tests
mitchellh Jul 4, 2024
e2133cb
terminal: row needs hyperlink state, test clearing hyperlink
mitchellh Jul 4, 2024
57c5522
terminal: handle moving/swapping/clearing cells with hyperlinks
mitchellh Jul 4, 2024
96ff17a
terminal: save/restore cursor doesn't modify hyperlink state
mitchellh Jul 4, 2024
bac1307
terminal: index hyperlink tests
mitchellh Jul 4, 2024
84edaed
terminal: scrollDown with hyperlinks
mitchellh Jul 4, 2024
d9e654d
terminal: scrollUp hyperlink tests
mitchellh Jul 4, 2024
f920068
terminal: full reset clears OSC8 state
mitchellh Jul 4, 2024
245314b
termio: hook up OSC8
mitchellh Jul 4, 2024
365567b
terminal: increase std cap for now until we implement resize
mitchellh Jul 4, 2024
d7e089e
terminal: simplify hyperlink capacity
mitchellh Jul 4, 2024
961a4b6
terminal: support page oom with hyperlinks
mitchellh Jul 4, 2024
f8fe044
core: clicking OSC8 links work
mitchellh Jul 4, 2024
f777e42
terminal: page clone needs to clone strings
mitchellh Jul 4, 2024
041c779
renderer: matchSet matches OSC8
mitchellh Jul 5, 2024
925ad5b
renderer: match multiple lines for osc8
mitchellh Jul 5, 2024
8b02d34
terminal: copy hyperlinks on reflow
mitchellh Jul 5, 2024
ff9ab70
terminal: end hyperlink state when switching screens
mitchellh Jul 5, 2024
e8a8b18
core: when over a link we must set the whole screen dirty on move
mitchellh Jul 5, 2024
b0f9930
terminal: pause integrity checks in clone row until done
mitchellh Jul 5, 2024
c51682a
renderer: match no-ID OSC8 in contiguous chunks
mitchellh Jul 5, 2024
eed9c23
terminal: RefCountedSet checks for existence prior to cap check
mitchellh Jul 5, 2024
cdb838e
terminal: pause integrity checks on resize for hyperlink set
mitchellh Jul 5, 2024
4f099af
terminal: set hyperlink state on clone
mitchellh Jul 5, 2024
a6051b9
terminal: disable zombie styles integrity check
mitchellh Jul 5, 2024
251ec0c
terminal: on print, adjust page size if we need to grow for hyperlinks
mitchellh Jul 6, 2024
d79bbaa
terminal: adjustCapacity handles hyperlink state
mitchellh Jul 6, 2024
4a861a8
terminal: hyperlink capacity adjustment needs to call safe variant
mitchellh Jul 6, 2024
d5a23e7
macos: some disabled swiftui code that makes link tooltips show
mitchellh Jul 6, 2024
cb790b8
macos: show URL on OSC8 hover
mitchellh Jul 6, 2024
8ecc84b
core: helper to get osc8 URI
mitchellh Jul 6, 2024
36648ae
apprt: stubs for mouseOverLink
mitchellh Jul 6, 2024
9344676
macos: fix iOS build
mitchellh Jul 6, 2024
8858c2b
apprt/gtk: convert surface to overlay so we can support the url overlay
mitchellh Jul 6, 2024
ecdb0a7
apprt/gtk: style the overlay
mitchellh Jul 6, 2024
571182f
macos: move OSC8 URL view to right if mouse is over it
mitchellh Jul 7, 2024
c9accc5
core: show URL even for non-OSC8 hyperlnks
mitchellh Jul 7, 2024
f9e5d9c
apprt/gtk: move url hover bar when its under the mouse
mitchellh Jul 7, 2024
10a3214
apprt/gtk: forgot to remove debug code to hide overlay
mitchellh Jul 7, 2024
45d0653
apprt/gtk: add deinit for url widget
mitchellh Jul 7, 2024
b7699b9
apprt/gtk: add all event handlers to the overlay so both receive
mitchellh Jul 7, 2024
f1561a4
apprt/gtk: committed the forever status bar again
mitchellh Jul 7, 2024
a32007b
core: when mouse reporting, clear link state
mitchellh Jul 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
terminal: refcountedset passes base memory to all context funcs
This enables these funcs to access memory offsets that may be present in
set items, which is possible since the set itself is in an offset-based
structure.
mitchellh committed Jul 6, 2024
commit cb1caff0181d5e07349b41d273b854967023e1ec
12 changes: 6 additions & 6 deletions src/terminal/ref_counted_set.zig
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@ pub fn RefCountedSet(
self.living += 1;

return if (added_id == id) null else added_id;
} else if (self.context.eql(value, items[id].value)) {
} else if (self.context.eql(base, value, items[id].value)) {
items[id].meta.ref += 1;

return null;
@@ -390,7 +390,7 @@ pub fn RefCountedSet(
if (comptime @hasDecl(Context, "deleted")) {
// Inform the context struct that we're
// deleting the dead item's value for good.
self.context.deleted(item.value);
self.context.deleted(base, item.value);
}

self.psl_stats[item.meta.psl] -= 1;
@@ -423,7 +423,7 @@ pub fn RefCountedSet(
const table = self.table.ptr(base);
const items = self.items.ptr(base);

const hash: u64 = self.context.hash(value);
const hash: u64 = self.context.hash(base, value);

for (0..self.max_psl + 1) |i| {
const p: usize = @intCast((hash + i) & self.layout.table_mask);
@@ -455,7 +455,7 @@ pub fn RefCountedSet(
// If the item is a part of the same probe sequence,
// we check if it matches the value we're looking for.
if (item.meta.psl == i and
self.context.eql(value, item.value))
self.context.eql(base, value, item.value))
{
return id;
}
@@ -481,7 +481,7 @@ pub fn RefCountedSet(
.meta = .{ .psl = 0, .ref = 0 },
};

const hash: u64 = self.context.hash(value);
const hash: u64 = self.context.hash(base, value);

var held_id: Id = new_id;
var held_item: *Item = &new_item;
@@ -510,7 +510,7 @@ pub fn RefCountedSet(
if (comptime @hasDecl(Context, "deleted")) {
// Inform the context struct that we're
// deleting the dead item's value for good.
self.context.deleted(item.value);
self.context.deleted(base, item.value);
}

chosen_id = id;
6 changes: 4 additions & 2 deletions src/terminal/style.zig
Original file line number Diff line number Diff line change
@@ -247,13 +247,15 @@ pub const Set = RefCountedSet(
Id,
size.CellCountInt,
struct {
pub fn hash(self: *const @This(), style: Style) u64 {
pub fn hash(self: *const @This(), base: anytype, style: Style) u64 {
_ = self;
_ = base;
return style.hash();
}

pub fn eql(self: *const @This(), a: Style, b: Style) bool {
pub fn eql(self: *const @This(), base: anytype, a: Style, b: Style) bool {
_ = self;
_ = base;
return a.eql(b);
}
},