mirror of https://github.com/liamg/aminal.git
#147 Hyperlinks. Step 1. Set/unset
This commit is contained in:
parent
a68b693bfd
commit
70b95a71ef
|
@ -5,9 +5,10 @@ import (
|
|||
)
|
||||
|
||||
type Cell struct {
|
||||
r rune
|
||||
attr CellAttributes
|
||||
image *image.RGBA
|
||||
r rune
|
||||
attr CellAttributes
|
||||
image *image.RGBA
|
||||
hyperlink *Hyperlink
|
||||
}
|
||||
|
||||
type CellAttributes struct {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package buffer
|
||||
|
||||
type Hyperlink struct {
|
||||
Uri string
|
||||
}
|
|
@ -18,6 +18,7 @@ type TerminalState struct {
|
|||
tabStops map[uint16]struct{}
|
||||
Charsets []*map[rune]rune // array of 2 charsets, nil means ASCII (no conversion)
|
||||
CurrentCharset int // active charset index in Charsets array, valid values are 0 or 1
|
||||
CurrentHyperlink *Hyperlink
|
||||
}
|
||||
|
||||
// NewTerminalMode creates a new terminal state
|
||||
|
|
|
@ -3,6 +3,8 @@ package terminal
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/liamg/aminal/buffer"
|
||||
)
|
||||
|
||||
func oscHandler(pty chan rune, terminal *Terminal) error {
|
||||
|
@ -39,6 +41,12 @@ func oscHandler(pty chan rune, terminal *Terminal) error {
|
|||
switch pS[0] {
|
||||
case "0", "2":
|
||||
terminal.SetTitle(pT)
|
||||
case "8": // hyperlink
|
||||
if len(pS) > 2 {
|
||||
terminal.terminalState.CurrentHyperlink = &buffer.Hyperlink{Uri: pS[2]}
|
||||
} else {
|
||||
terminal.terminalState.CurrentHyperlink = nil
|
||||
}
|
||||
case "10": // get/set foreground colour
|
||||
if len(pS) > 1 {
|
||||
if pS[1] == "?" {
|
||||
|
|
Loading…
Reference in New Issue