top working

This commit is contained in:
Liam Galvin 2018-07-05 09:29:01 +01:00
parent 702811507e
commit 73fd6ba00b
3 changed files with 15 additions and 21 deletions

View File

@ -248,15 +248,13 @@ func (gui *GUI) Render() error {
case <-updateChan:
updateRequired = 2
case <-ticker.C:
ca := gui.terminal.GetCellAttributes()
text.SetString(
fmt.Sprintf(
"%dx%d@%d,%d reverse=%t",
"%dx%d@%d,%d",
gui.cols,
gui.rows,
gui.terminal.GetPosition().Col,
gui.terminal.GetPosition().Line,
ca.Reverse,
),
)
updateRequired = 2

View File

@ -1,7 +1,6 @@
package terminal
import (
"fmt"
"strconv"
"strings"
)
@ -10,13 +9,6 @@ import (
type TerminalCharSet int
const (
C0 TerminalCharSet = iota
C1
C2
C3
)
func (terminal *Terminal) processInput(buffer chan rune) {
// https://en.wikipedia.org/wiki/ANSI_escape_code
@ -411,33 +403,33 @@ func (terminal *Terminal) processInput(buffer chan rune) {
b = <-buffer
switch b {
case 'A': //uk @todo handle these?
terminal.charSet = C0
//terminal.charSet = C0
case 'B': //us
terminal.charSet = C0
//terminal.charSet = C0
}
case ')':
b = <-buffer
switch b {
case 'A': //uk @todo handle these?
terminal.charSet = C1
//terminal.charSet = C1
case 'B': //us
terminal.charSet = C1
//terminal.charSet = C1
}
case '*':
b = <-buffer
switch b {
case 'A': //uk @todo handle these?
terminal.charSet = C2
//terminal.charSet = C2
case 'B': //us
terminal.charSet = C2
//terminal.charSet = C2
}
case '+':
b = <-buffer
switch b {
case 'A': //uk @todo handle these?
terminal.charSet = C3
//terminal.charSet = C3
case 'B': //us
terminal.charSet = C3
//terminal.charSet = C3
}
case '>':
// numeric char selection @todo
@ -467,7 +459,7 @@ func (terminal *Terminal) processInput(buffer chan rune) {
}
} else {
fmt.Printf("%s", string(b))
//fmt.Printf("%s", string(b))
if b != 0x0d {
lineOverflow = false

View File

@ -24,7 +24,6 @@ type Terminal struct {
cellAttr CellAttributes
defaultCellAttr CellAttributes
cursorVisible bool
charSet TerminalCharSet
}
type Line struct {
@ -209,6 +208,11 @@ func (terminal *Terminal) writeRune(r rune) {
line.wrapped = true
terminal.lines = append(terminal.lines, line)
}
} else {
for terminal.position.Line >= h {
terminal.position.Line--
//terminal.lines = append(terminal.lines, NewLine())
}
}
terminal.setRuneAtPos(terminal.position, r, wrap)
terminal.incrementPosition()