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