示例#1
0
文件: input.go 项目: Charlesetc/pat
func Reset() {
	currentLine = []rune{}
	currentScroll = 0
	cursor = 0
	updateCursor()
	display.ShowLine(visibleLine())
	display.DrawLine()
}
示例#2
0
文件: input.go 项目: Charlesetc/pat
func CursorLeft() {
	if cursor != 0 {
		cursor--
	}
	if cursor < currentScroll {
		currentScroll--
		display.ShowLine(visibleLine())
	}
	updateCursor()
}
示例#3
0
文件: input.go 项目: Charlesetc/pat
func CursorAtEnd() {
	width := display.LineWidth()
	cursor = len(currentLine)
	if len(currentLine) < width {
		currentScroll = 0
	} else {
		currentScroll = len(currentLine) - width
	}
	display.ShowLine(visibleLine())
	updateCursor()
}
示例#4
0
文件: input.go 项目: Charlesetc/pat
func CursorRight() {
	width := display.LineWidth()
	if cursor < len(currentLine) {
		cursor++
	}
	if cursor > width+currentScroll {
		// LogS(fmt.Sprintf("-- %d", cursor))
		currentScroll++
		display.ShowLine(visibleLine())
	}
	updateCursor()
}
示例#5
0
文件: input.go 项目: Charlesetc/pat
func Draw() {
	display.ShowLine(visibleLine())
	display.SetCursor(cursor - currentScroll)
	display.DrawLine()
	display.Flush()
}
示例#6
0
文件: input.go 项目: Charlesetc/pat
func CursorAtBeginning() {
	cursor = 0
	currentScroll = 0
	display.ShowLine(visibleLine())
	updateCursor()
}