Add start of editor row structure
This commit is contained in:
parent
b7e4463f01
commit
842ab0ef49
@ -17,13 +17,16 @@ type cursor struct {
|
||||
type editor struct {
|
||||
screen *terminal.Screen
|
||||
cursor *cursor
|
||||
rows []*row
|
||||
}
|
||||
|
||||
func New() *editor {
|
||||
screen := terminal.Size()
|
||||
cursor := &cursor { 0, 0 }
|
||||
var rows []*row
|
||||
rows = append(rows, NewRow())
|
||||
|
||||
return &editor{screen, cursor }
|
||||
return &editor{screen, cursor, rows }
|
||||
}
|
||||
|
||||
func (e *editor) ProcessKeypress() bool {
|
||||
@ -84,6 +87,7 @@ func (e *editor) moveCursor (key string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the raw ANSI escape sequences to the type of key input
|
||||
func parseEscapeSequence () string {
|
||||
var runes []rune
|
||||
|
||||
|
15
editor/row.go
Normal file
15
editor/row.go
Normal file
@ -0,0 +1,15 @@
|
||||
package editor
|
||||
|
||||
type row struct {
|
||||
chars []rune
|
||||
}
|
||||
|
||||
func NewRow() *row {
|
||||
return &row {}
|
||||
}
|
||||
|
||||
func (r *row) Size() int {
|
||||
return len(r.chars)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user