added screen clear between view changes
This commit is contained in:
parent
2476af323f
commit
f362457fe1
2 changed files with 12 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.skdevstudios.com/SK-Development-Studios/go-cal-tui/internal/storage"
|
||||
|
|
@ -69,6 +70,7 @@ func (m model) updateMonthView(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
m.selectedDay = dayIndex - m.startOffset + 1
|
||||
m.hourCursor = 0
|
||||
m.mode = hourlyView
|
||||
fmt.Print("\033[H\033[2J") // Clear terminal screen
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +140,7 @@ case "x": // or "delete"
|
|||
})
|
||||
case "esc":
|
||||
m.mode = monthView
|
||||
fmt.Print("\033[H\033[2J") // Clear terminal screen
|
||||
return m, nil
|
||||
case "ctrl+c", "q":
|
||||
return m, tea.Quit
|
||||
|
|
@ -153,4 +156,3 @@ case "x": // or "delete"
|
|||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
10
tui/view.go
10
tui/view.go
|
|
@ -136,6 +136,14 @@ func (m model) viewHourly() string {
|
|||
}
|
||||
|
||||
b.WriteString("[n] to add event,[e] to edit event,[x] to delete an event, [up]/[down] keys to move, [Esc] to go back to month view, [q] to quit.")
|
||||
return b.String()
|
||||
// Center the hourly view
|
||||
view := b.String()
|
||||
|
||||
// Horizontal centering
|
||||
view = lipgloss.PlaceHorizontal(m.width, lipgloss.Center, view)
|
||||
// Vertical centering
|
||||
view = lipgloss.PlaceVertical(m.height, lipgloss.Center, view)
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue