func Reset() { currentLine = []rune{} currentScroll = 0 cursor = 0 updateCursor() display.ShowLine(visibleLine()) display.DrawLine() }
func CursorLeft() { if cursor != 0 { cursor-- } if cursor < currentScroll { currentScroll-- display.ShowLine(visibleLine()) } updateCursor() }
func CursorAtEnd() { width := display.LineWidth() cursor = len(currentLine) if len(currentLine) < width { currentScroll = 0 } else { currentScroll = len(currentLine) - width } display.ShowLine(visibleLine()) updateCursor() }
func CursorRight() { width := display.LineWidth() if cursor < len(currentLine) { cursor++ } if cursor > width+currentScroll { // LogS(fmt.Sprintf("-- %d", cursor)) currentScroll++ display.ShowLine(visibleLine()) } updateCursor() }
func Draw() { display.ShowLine(visibleLine()) display.SetCursor(cursor - currentScroll) display.DrawLine() display.Flush() }
func CursorAtBeginning() { cursor = 0 currentScroll = 0 display.ShowLine(visibleLine()) updateCursor() }