@@ -109,6 +109,7 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
return a, tea.Batch(cmds...)
case tea.WindowSizeMsg:
+ a.wWidth, a.wHeight = msg.Width, msg.Height
a.completions.Update(msg)
return a, a.handleWindowResize(msg.Width, msg.Height)
@@ -269,7 +270,6 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// handleWindowResize processes window resize events and updates all components.
func (a *appModel) handleWindowResize(width, height int) tea.Cmd {
var cmds []tea.Cmd
- a.wWidth, a.wHeight = width, height
if a.showingFullHelp {
height -= 5
} else {
@@ -400,6 +400,26 @@ func (a *appModel) moveToPage(pageID page.PageID) tea.Cmd {
// View renders the complete application interface including pages, dialogs, and overlays.
func (a *appModel) View() tea.View {
+ var view tea.View
+ t := styles.CurrentTheme()
+ view.BackgroundColor = t.BgBase
+ if a.wWidth < 25 || a.wHeight < 15 {
+ view.Layer = lipgloss.NewCanvas(
+ lipgloss.NewLayer(
+ t.S().Base.Width(a.wWidth).Height(a.wHeight).
+ Align(lipgloss.Center, lipgloss.Center).
+ Render(
+ t.S().Base.
+ Padding(1, 2).
+ Background(t.BgSubtle).
+ Foreground(t.White).
+ Render("Too small!"),
+ ),
+ ),
+ )
+ return view
+ }
+
page := a.pages[a.currentPage]
if withHelp, ok := page.(core.KeyMapHelp); ok {
a.status.SetKeyMap(withHelp.Help())
@@ -446,10 +466,7 @@ func (a *appModel) View() tea.View {
layers...,
)
- var view tea.View
- t := styles.CurrentTheme()
view.Layer = canvas
- view.BackgroundColor = t.BgBase
view.Cursor = cursor
return view
}