Fix current line display, automatic formatting fixes
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good
This commit is contained in:
parent
818b8cf6bf
commit
1a4f6809fb
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
type document struct {
|
type document struct {
|
||||||
filename string
|
filename string
|
||||||
rows []*row
|
rows []*row
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDocument() *document {
|
func newDocument() *document {
|
||||||
|
@ -126,7 +126,7 @@ func (e *editor) drawStatusBar(ab *buffer) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rightStatus := fmt.Sprintf("%d/%d", e.cursor.y, e.document.rowCount())
|
rightStatus := fmt.Sprintf("%d/%d", e.cursor.y+1, e.document.rowCount())
|
||||||
rlength := len(rightStatus)
|
rlength := len(rightStatus)
|
||||||
statusLength := length + rlength
|
statusLength := length + rlength
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@ type statusMsg struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type editor struct {
|
type editor struct {
|
||||||
screen *terminal.Screen
|
screen *terminal.Screen
|
||||||
cursor *point
|
cursor *point
|
||||||
offset *point
|
offset *point
|
||||||
document *document
|
document *document
|
||||||
status *statusMsg
|
status *statusMsg
|
||||||
renderX int
|
renderX int
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *editor {
|
func New() *editor {
|
||||||
|
@ -5,13 +5,13 @@ package editor
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
const (
|
const (
|
||||||
keyUp = "ARROW_UP"
|
keyUp = "ARROW_UP"
|
||||||
keyDown = "ARROW_DOWN"
|
keyDown = "ARROW_DOWN"
|
||||||
keyLeft = "ARROW_LEFT"
|
keyLeft = "ARROW_LEFT"
|
||||||
keyRight = "ARROW_RIGHT"
|
keyRight = "ARROW_RIGHT"
|
||||||
keyPageUp = "PAGE_UP"
|
keyPageUp = "PAGE_UP"
|
||||||
keyPageDown = "PAGE_DOWN"
|
keyPageDown = "PAGE_DOWN"
|
||||||
keyHome = "HOME"
|
keyHome = "HOME"
|
||||||
keyEnd = "END"
|
keyEnd = "END"
|
||||||
keyDelete = "DELETE"
|
keyDelete = "DELETE"
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type row struct {
|
type row struct {
|
||||||
chars []rune
|
chars []rune
|
||||||
render []rune
|
render []rune
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ func TestRenderSize(t *testing.T) {
|
|||||||
|
|
||||||
type insertRune struct {
|
type insertRune struct {
|
||||||
initial string
|
initial string
|
||||||
ch rune
|
ch rune
|
||||||
at int
|
at int
|
||||||
}
|
}
|
||||||
|
|
||||||
var insertRuneTests = []insertRune{
|
var insertRuneTests = []insertRune{
|
||||||
|
@ -3,7 +3,7 @@ package key
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
type isRune struct {
|
type isRune struct {
|
||||||
arg1 rune
|
arg1 rune
|
||||||
expected bool
|
expected bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ const (
|
|||||||
// Color sequences
|
// Color sequences
|
||||||
const (
|
const (
|
||||||
InvertColor = EscPrefix + "7m"
|
InvertColor = EscPrefix + "7m"
|
||||||
ResetColor = EscPrefix + "m"
|
ResetColor = EscPrefix + "m"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user