Skip to content

Commit

Permalink
Remove unused code and tidy some cursor commands
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 14, 2020
1 parent b72d270 commit 728ceca
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions output.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package terminal

import (
"image/color"
"time"

"fyne.io/fyne/widget"
Expand Down Expand Up @@ -60,8 +59,7 @@ func (t *Terminal) handleOutput(buf []byte) {
continue
}
t.content.SetRow(t.cursorRow, row[:len(row)-1])
t.cursorCol--
t.cursorMoved()
t.moveCursor(t.cursorRow, t.cursorCol-1)
continue
case '\n': // line feed
if t.cursorRow == int(t.config.Rows-1) {
Expand All @@ -70,13 +68,11 @@ func (t *Terminal) handleOutput(buf []byte) {
}
t.content.SetRow(i, []widget.TextGridCell{})
} else {
t.cursorRow++
t.moveCursor(t.cursorRow+1, t.cursorCol)
}

t.cursorCol = 0
continue
case '\r': // carriage return
t.cursorCol = 0
t.moveCursor(t.cursorRow, 0)
continue
case asciiBell:
go t.ringBell()
Expand Down Expand Up @@ -112,26 +108,6 @@ func (t *Terminal) handleOutput(buf []byte) {
t.Refresh()
}

func (t *Terminal) setCellStyle(row, col int, fgStyle, bgStyle color.Color) {
if row < 0 {
return
}
for len(t.content.Content) <= row {
t.content.Content = append(t.content.Content, []widget.TextGridCell{})
}

line := t.content.Row(row)
if col < 0 {
return
}

for len(line) <= col {
line = append(line, widget.TextGridCell{})
}
t.content.SetRow(row, line)
t.content.SetStyle(row, col, &widget.CustomTextGridStyle{FGColor: fgStyle, BGColor: bgStyle})
}

func (t *Terminal) ringBell() {
t.bell = true
t.Refresh()
Expand Down

0 comments on commit 728ceca

Please sign in to comment.