MCPcopy
hub / github.com/moncho/dry / SetSize

Method SetSize

appui/less_model.go:120–135  ·  view source on GitHub ↗

SetSize updates the viewport dimensions.

(w, h int)

Source from the content-addressed store, hash-verified

118
119// SetSize updates the viewport dimensions.
120func (m *LessModel) SetSize(w, h int) {
121 m.width = w
122 m.height = h
123 // Reserve 1 line for title, 1 for status/input bar
124 vpHeight := h - 2
125 if vpHeight < 1 {
126 vpHeight = 1
127 }
128 m.viewport.SetWidth(w)
129 m.viewport.SetHeight(vpHeight)
130 // Re-apply content so viewport recalculates with new dimensions
131 if m.content != "" {
132 m.viewport.SetContent(strings.Join(m.filtered, "\n"))
133 m.applySearch()
134 }
135}
136
137// Update handles key events for the less viewer.
138func (m LessModel) Update(msg tea.Msg) (LessModel, tea.Cmd) {

Callers 14

TestLessModel_SetContentFunction · 0.95
TestLessModel_EscClosesFunction · 0.95
TestLessModel_QClosesFunction · 0.95
TestLessModel_SearchModeFunction · 0.95
TestLessModel_FilterModeFunction · 0.95
UpdateMethod · 0.45
handleKeyPressMethod · 0.45
resizeContentModelsMethod · 0.45
openQuickPeekMethod · 0.45
executeMenuCommandMethod · 0.45

Calls 3

applySearchMethod · 0.95
SetWidthMethod · 0.45
SetContentMethod · 0.45

Tested by 8

TestLessModel_SetContentFunction · 0.76
TestLessModel_EscClosesFunction · 0.76
TestLessModel_QClosesFunction · 0.76
TestLessModel_SearchModeFunction · 0.76
TestLessModel_FilterModeFunction · 0.76
newTestModelFunction · 0.36