Skip to content

Commit d291e6b

Browse files
committed
terminal tooltips
1 parent d39235f commit d291e6b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/console/console.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export default class InkTerminal extends PaneItem {
103103
if (!this.shouldOpenLink(ev)) return false
104104
openExternal(uri)
105105
}, {
106-
willLinkActivate: ev => this.shouldOpenLink(ev)
106+
willLinkActivate: ev => this.shouldOpenLink(ev),
107+
tooltipCallback: (ev, uri, location) => this.tooltipCallback(ev, uri, location),
108+
leaveCallback: () => this.closeTooltip()
107109
})
108110
this.terminal.loadAddon(webLinksAddon)
109111

@@ -154,10 +156,23 @@ export default class InkTerminal extends PaneItem {
154156
return true
155157
}
156158

159+
tooltipCallback (ev, uri, location) {
160+
return false
161+
}
162+
163+
closeTooltip () {
164+
return false
165+
}
166+
157167
onDidOpenLink (f) {
158168
this.shouldOpenLink = f
159169
}
160170

171+
registerTooltipHandler (open, close) {
172+
this.tooltipCallback = (ev, uri, location) => open(ev, uri, location, this.terminal)
173+
this.closeTooltip = close
174+
}
175+
161176
cursorPosition () {
162177
this.write('\x1b[0m')
163178
return [this.terminal._core.buffer.x, this.terminal._core.buffer.y]

0 commit comments

Comments
 (0)