@@ -27,6 +27,7 @@ func (l *Label) uiSetBounds(x0, y0, x1, y1 int) { | |||||
l.y0 = y0 | l.y0 = y0 | ||||
l.x1 = x1 | l.x1 = x1 | ||||
l.y1 = y1 | l.y1 = y1 | ||||
l.uiDraw() | |||||
} | } | ||||
func (l *Label) uiDraw() { | func (l *Label) uiDraw() { | ||||
@@ -25,6 +25,7 @@ func (t *Textbox) uiInitialize(ui *Ui) { | |||||
func (t *Textbox) uiSetActive(active bool) { | func (t *Textbox) uiSetActive(active bool) { | ||||
t.active = active | t.active = active | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textbox) uiSetBounds(x0, y0, x1, y1 int) { | func (t *Textbox) uiSetBounds(x0, y0, x1, y1 int) { | ||||
@@ -32,6 +33,7 @@ func (t *Textbox) uiSetBounds(x0, y0, x1, y1 int) { | |||||
t.y0 = y0 | t.y0 = y0 | ||||
t.x1 = x1 | t.x1 = x1 | ||||
t.y1 = y1 | t.y1 = y1 | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textbox) uiDraw() { | func (t *Textbox) uiDraw() { | ||||
@@ -31,18 +31,21 @@ func (t *Textview) uiSetBounds(x0, y0, x1, y1 int) { | |||||
t.x1 = x1 | t.x1 = x1 | ||||
t.y1 = y1 | t.y1 = y1 | ||||
t.updateParsedLines() | t.updateParsedLines() | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) ScrollUp() { | func (t *Textview) ScrollUp() { | ||||
if newLine := t.CurrentLine + 1; newLine < len(t.parsedLines) { | if newLine := t.CurrentLine + 1; newLine < len(t.parsedLines) { | ||||
t.CurrentLine = newLine | t.CurrentLine = newLine | ||||
} | } | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) ScrollDown() { | func (t *Textview) ScrollDown() { | ||||
if newLine := t.CurrentLine - 1; newLine >= 0 { | if newLine := t.CurrentLine - 1; newLine >= 0 { | ||||
t.CurrentLine = newLine | t.CurrentLine = newLine | ||||
} | } | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) ScrollTop() { | func (t *Textview) ScrollTop() { | ||||
@@ -51,10 +54,12 @@ func (t *Textview) ScrollTop() { | |||||
} else { | } else { | ||||
t.CurrentLine = 0 | t.CurrentLine = 0 | ||||
} | } | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) ScrollBottom() { | func (t *Textview) ScrollBottom() { | ||||
t.CurrentLine = 0 | t.CurrentLine = 0 | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) updateParsedLines() { | func (t *Textview) updateParsedLines() { | ||||
@@ -94,12 +99,14 @@ func (t *Textview) updateParsedLines() { | |||||
func (t *Textview) AddLine(line string) { | func (t *Textview) AddLine(line string) { | ||||
t.Lines = append(t.Lines, line) | t.Lines = append(t.Lines, line) | ||||
t.updateParsedLines() | t.updateParsedLines() | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) Clear() { | func (t *Textview) Clear() { | ||||
t.Lines = nil | t.Lines = nil | ||||
t.CurrentLine = 0 | t.CurrentLine = 0 | ||||
t.parsedLines = nil | t.parsedLines = nil | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Textview) uiDraw() { | func (t *Textview) uiDraw() { | ||||
@@ -50,6 +50,7 @@ func (t *Tree) uiInitialize(ui *Ui) { | |||||
func (t *Tree) uiSetActive(active bool) { | func (t *Tree) uiSetActive(active bool) { | ||||
t.active = active | t.active = active | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Tree) uiSetBounds(x0, y0, x1, y1 int) { | func (t *Tree) uiSetBounds(x0, y0, x1, y1 int) { | ||||
@@ -57,6 +58,7 @@ func (t *Tree) uiSetBounds(x0, y0, x1, y1 int) { | |||||
t.y0 = y0 | t.y0 = y0 | ||||
t.x1 = x1 | t.x1 = x1 | ||||
t.y1 = y1 | t.y1 = y1 | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Tree) Rebuild() { | func (t *Tree) Rebuild() { | ||||
@@ -74,6 +76,7 @@ func (t *Tree) Rebuild() { | |||||
} | } | ||||
t.lines = lines | t.lines = lines | ||||
t.activeLine = bounded(t.activeLine, 0, len(t.lines)-1) | t.activeLine = bounded(t.activeLine, 0, len(t.lines)-1) | ||||
t.uiDraw() | |||||
} | } | ||||
func (t *Tree) rebuild_rec(parent TreeItem, level int) []renderedTreeItem { | func (t *Tree) rebuild_rec(parent TreeItem, level int) []renderedTreeItem { | ||||
@@ -142,7 +145,7 @@ func (t *Tree) uiKeyEvent(mod Modifier, key Key) { | |||||
t.Listener(t.ui, t, t.lines[t.activeLine].Item) | t.Listener(t.ui, t, t.lines[t.activeLine].Item) | ||||
} | } | ||||
} | } | ||||
t.ui.Refresh() | |||||
t.uiDraw() | |||||
} | } | ||||
func (t *Tree) uiCharacterEvent(ch rune) { | func (t *Tree) uiCharacterEvent(ch rune) { | ||||