.. | ||
erasing.go | ||
README.md | ||
vt100_debug.go | ||
window_size.go |
Internals of go-prompt
This is a short description of go-prompt implementation. go-prompt consists of three parts.
- Input parser
- Emulate user input with Buffer object.
- Render buffer object.
Input Parser
Input Parser only supports only vt100 compatible console now.
- Set raw mode.
- Read standard input.
- Parse byte array
Emulate user input
go-prompt contains Buffer class. It represents input state by handling user input key.
Buffer
object has text and cursor position.
TODO prepare the sample of buffer
package main
import "github.com/c-bata/go-prompt"
func main() {
b := prompt.NewBuffer()
... wip
}
Renderer
Renderer
object renders a buffer object.
TODO prepare the sample of brender
package main
the output is below:
TODO prepare a screen shot