MCPcopy
hub / github.com/mathaou/termdbms / HandleWindowSizeEvents

Function HandleWindowSizeEvents

viewer/events.go:43–80  ·  view source on GitHub ↗

HandleWindowSizeEvents does that

(m *TuiModel, msg *tea.WindowSizeMsg)

Source from the content-addressed store, hash-verified

41
42// HandleWindowSizeEvents does that
43func 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
82func HandleClipboardEvents(m *TuiModel, str string, command *tea.Cmd, msg tea.Msg) {
83 state := m.ClipboardList.FilterState()

Callers 1

UpdateMethod · 0.85

Calls 6

SetWidthMethod · 0.80
SetHeightMethod · 0.80
WidthMethod · 0.80
SetCursorModeMethod · 0.80
GetBaseStyleMethod · 0.80
SetViewSlicesMethod · 0.80

Tested by

no test coverage detected