#147 Hyperlinks. Step 1. Set/unset

This commit is contained in:
Roman Shevchenko 2019-03-06 18:03:07 +03:00
parent a68b693bfd
commit 70b95a71ef
4 changed files with 18 additions and 3 deletions

View File

@ -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 {

5
buffer/hyperlink.go Normal file
View File

@ -0,0 +1,5 @@
package buffer
type Hyperlink struct {
Uri string
}

View File

@ -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

View File

@ -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] == "?" {