Draw empty status bar
All checks were successful
timw4mail/gilo/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2021-04-01 09:41:16 -04:00
parent e7ba61b2aa
commit d831bd4f83
3 changed files with 22 additions and 4 deletions

View File

@ -20,6 +20,8 @@ func (e *editor) RefreshScreen() {
ab.append(terminal.ResetCursor)
e.drawRows(ab)
e.drawStatusBar(ab)
ab.append(terminal.MoveCursor(e.renderX - e.offset.x, e.cursor.y - e.offset.y))
ab.append(terminal.ShowCursor)
@ -74,10 +76,7 @@ func (e *editor) drawRows(ab *buffer) {
}
ab.append(terminal.ClearLine)
if y < (e.screen.Rows - 1) {
ab.append("\r\n")
}
ab.append("\r\n")
}
}
@ -105,6 +104,15 @@ func (e *editor) drawPlaceholderRow(y int, ab *buffer) {
}
}
func (e *editor) drawStatusBar(ab *buffer) {
ab.append(terminal.InvertColor)
str := strings.Repeat(" ", e.screen.Cols)
ab.append(str)
ab.append(terminal.ResetColor)
}
// ----------------------------------------------------------------------------
// !Output Buffer
// ----------------------------------------------------------------------------

View File

@ -26,6 +26,10 @@ type editor struct {
func New() *editor {
screen := terminal.Size()
// Subtract rows for status bar and prompt
screen.Rows -= 1
cursor := &point { 0, 0 }
offset := &point { 0, 0 }
var rows []*row

View File

@ -30,6 +30,12 @@ const (
ResetCursor = EscPrefix + "H"
)
// Color sequences
const (
InvertColor = EscPrefix + "7m"
ResetColor = EscPrefix + "m"
)
// ----------------------------------------------------------------------------
// !Helpers
// ----------------------------------------------------------------------------