HandleWindowSizeEvents does that
(m *TuiModel, msg *tea.WindowSizeMsg)
| 41 | |
| 42 | // HandleWindowSizeEvents does that |
| 43 | func HandleWindowSizeEvents(m *TuiModel, msg *tea.WindowSizeMsg) tea.Cmd { |
| 44 | verticalMargins := HeaderHeight + FooterHeight |
| 45 | |
| 46 | if !m.Ready { |
| 47 | width := msg.Width |
| 48 | height := msg.Height |
| 49 | m.Viewport = viewport.Model{ |
| 50 | Width: width, |
| 51 | Height: height - verticalMargins} |
| 52 | |
| 53 | m.ClipboardList.SetWidth(width) |
| 54 | m.ClipboardList.SetHeight(height) |
| 55 | TUIWidth = width |
| 56 | TUIHeight = height |
| 57 | m.Viewport.YPosition = HeaderHeight |
| 58 | m.Viewport.HighPerformanceRendering = true |
| 59 | m.Ready = true |
| 60 | m.MouseData.Y = HeaderHeight |
| 61 | |
| 62 | MaxInputLength = m.Viewport.Width |
| 63 | m.TextInput.Model.CharLimit = -1 |
| 64 | m.TextInput.Model.Width = MaxInputLength - lipgloss.Width(m.TextInput.Model.Prompt) |
| 65 | m.TextInput.Model.BlinkSpeed = time.Second |
| 66 | m.TextInput.Model.SetCursorMode(tuiutil.CursorBlink) |
| 67 | |
| 68 | m.TableStyle = m.GetBaseStyle() |
| 69 | m.SetViewSlices() |
| 70 | } else { |
| 71 | m.Viewport.Width = msg.Width |
| 72 | m.Viewport.Height = msg.Height - verticalMargins |
| 73 | } |
| 74 | |
| 75 | if m.Viewport.HighPerformanceRendering { |
| 76 | return viewport.Sync(m.Viewport) |
| 77 | } |
| 78 | |
| 79 | return nil |
| 80 | } |
| 81 | |
| 82 | func HandleClipboardEvents(m *TuiModel, str string, command *tea.Cmd, msg tea.Msg) { |
| 83 | state := m.ClipboardList.FilterState() |
no test coverage detected