Draw empty status bar
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
e7ba61b2aa
commit
d831bd4f83
@ -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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -30,6 +30,12 @@ const (
|
||||
ResetCursor = EscPrefix + "H"
|
||||
)
|
||||
|
||||
// Color sequences
|
||||
const (
|
||||
InvertColor = EscPrefix + "7m"
|
||||
ResetColor = EscPrefix + "m"
|
||||
)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// !Helpers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user