()
| 362 | } |
| 363 | |
| 364 | func (m *browseModel) View() tea.View { |
| 365 | if m.height > 0 && m.height < 6 { |
| 366 | content := "terminal too small" |
| 367 | if m.width > 0 { |
| 368 | content = ansi.Truncate(content, m.width, "") |
| 369 | } |
| 370 | view := tea.NewView(content) |
| 371 | view.AltScreen = true |
| 372 | return view |
| 373 | } |
| 374 | |
| 375 | if m.page == helpPage { |
| 376 | view := tea.NewView(m.helpView()) |
| 377 | view.AltScreen = true |
| 378 | return view |
| 379 | } |
| 380 | |
| 381 | if m.page == readmePage { |
| 382 | view := tea.NewView(m.readmePaneView()) |
| 383 | view.AltScreen = true |
| 384 | return view |
| 385 | } |
| 386 | |
| 387 | var content strings.Builder |
| 388 | content.WriteString(m.headerView()) |
| 389 | content.WriteByte('\n') |
| 390 | content.WriteString(m.filterView()) |
| 391 | content.WriteByte('\n') |
| 392 | content.WriteString(m.mainContent()) |
| 393 | content.WriteByte('\n') |
| 394 | content.WriteString(m.footerView()) |
| 395 | |
| 396 | view := tea.NewView(content.String()) |
| 397 | view.AltScreen = true |
| 398 | return view |
| 399 | } |
| 400 | |
| 401 | func (m *browseModel) selectedEntry() (extEntry, bool) { |
| 402 | if m.cursor < 0 || m.cursor >= len(m.filtered) { |
nothing calls this directly
no test coverage detected