mirror of
https://github.com/gdamore/tcell.git
synced 2025-04-26 13:48:53 +08:00
Underline colors for webassembly.
This commit is contained in:
parent
24d9487d4a
commit
81f6648f64
@ -60,7 +60,7 @@ function clearScreen(fg, bg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCell(x, y, mainc, combc, fg, bg, attrs) {
|
function drawCell(x, y, mainc, combc, fg, bg, attrs, us, uc) {
|
||||||
var combString = String.fromCharCode(mainc);
|
var combString = String.fromCharCode(mainc);
|
||||||
combc.forEach((char) => {
|
combc.forEach((char) => {
|
||||||
combString += String.fromCharCode(char);
|
combString += String.fromCharCode(char);
|
||||||
@ -91,9 +91,6 @@ function drawCell(x, y, mainc, combc, fg, bg, attrs) {
|
|||||||
if ((attrs & 1) != 0) {
|
if ((attrs & 1) != 0) {
|
||||||
span.classList.add("bold");
|
span.classList.add("bold");
|
||||||
}
|
}
|
||||||
if ((attrs & (1 << 3)) != 0) {
|
|
||||||
span.classList.add("underline");
|
|
||||||
}
|
|
||||||
if ((attrs & (1 << 4)) != 0) {
|
if ((attrs & (1 << 4)) != 0) {
|
||||||
span.classList.add("dim");
|
span.classList.add("dim");
|
||||||
}
|
}
|
||||||
@ -103,19 +100,25 @@ function drawCell(x, y, mainc, combc, fg, bg, attrs) {
|
|||||||
if ((attrs & (1 << 6)) != 0) {
|
if ((attrs & (1 << 6)) != 0) {
|
||||||
span.classList.add("strikethrough");
|
span.classList.add("strikethrough");
|
||||||
}
|
}
|
||||||
if ((attrs & (1 << 7)) != 0) {
|
}
|
||||||
|
if (us != 0) {
|
||||||
|
use = true;
|
||||||
|
if (us == 1) {
|
||||||
|
span.classList.add("underline");
|
||||||
|
} else if (us == 2) {
|
||||||
span.classList.add("double_underline");
|
span.classList.add("double_underline");
|
||||||
}
|
} else if (us == 3) {
|
||||||
if ((attrs & (1 << 8)) != 0) {
|
|
||||||
span.classList.add("curly_underline");
|
span.classList.add("curly_underline");
|
||||||
}
|
} else if (us == 4) {
|
||||||
if ((attrs & (1 << 9)) != 0) {
|
|
||||||
span.classList.add("dotted_underline");
|
span.classList.add("dotted_underline");
|
||||||
}
|
} else if (us == 5) {
|
||||||
if ((attrs & (1 << 10)) != 0) {
|
|
||||||
span.classList.add("dashed_underline");
|
span.classList.add("dashed_underline");
|
||||||
}
|
}
|
||||||
|
if (uc != -1) {
|
||||||
|
span.style.textDecorationColor = intToHex(uc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((attrs & (1 << 1)) != 0) {
|
if ((attrs & (1 << 1)) != 0) {
|
||||||
var blink = document.createElement("span");
|
var blink = document.createElement("span");
|
||||||
blink.classList.add("blink");
|
blink.classList.add("blink");
|
||||||
|
@ -66,6 +66,9 @@ func (t *wScreen) Init() error {
|
|||||||
t.Unlock()
|
t.Unlock()
|
||||||
|
|
||||||
js.Global().Set("onKeyEvent", js.FuncOf(t.onKeyEvent))
|
js.Global().Set("onKeyEvent", js.FuncOf(t.onKeyEvent))
|
||||||
|
js.Global().Set("onMouseClick", js.FuncOf(t.unset))
|
||||||
|
js.Global().Set("onMouseMove", js.FuncOf(t.unset))
|
||||||
|
js.Global().Set("onFocus", js.FuncOf(t.unset))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -133,6 +136,10 @@ func (t *wScreen) drawCell(x, y int) int {
|
|||||||
if bg == -1 {
|
if bg == -1 {
|
||||||
bg = 0x000000
|
bg = 0x000000
|
||||||
}
|
}
|
||||||
|
us, uc := style.ulStyle, paletteColor(style.ulColor)
|
||||||
|
if uc == -1 {
|
||||||
|
uc = 0x000000
|
||||||
|
}
|
||||||
|
|
||||||
var combcarr []interface{} = make([]interface{}, len(combc))
|
var combcarr []interface{} = make([]interface{}, len(combc))
|
||||||
for i, c := range combc {
|
for i, c := range combc {
|
||||||
@ -140,7 +147,7 @@ func (t *wScreen) drawCell(x, y int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.cells.SetDirty(x, y, false)
|
t.cells.SetDirty(x, y, false)
|
||||||
js.Global().Call("drawCell", x, y, mainc, combcarr, fg, bg, int(style.attrs))
|
js.Global().Call("drawCell", x, y, mainc, combcarr, fg, bg, int(style.attrs), int(us), int(uc))
|
||||||
|
|
||||||
return width
|
return width
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user