MCPcopy Create free account
hub / github.com/babycommando/nightride-cli / Update

Method Update

zuse.go:219–311  ·  view source on GitHub ↗

* UPDATE */

(msg tea.Msg)

Source from the content-addressed store, hash-verified

217/* UPDATE */
218
219func (m *ircModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
220 switch msg := msg.(type) {
221
222 case tea.WindowSizeMsg:
223 m.width, m.height = msg.Width, msg.Height
224
225 leftInnerW := m.leftWidth - 2
226 rightInnerW := (m.width - m.leftWidth) - 2
227 innerH := m.height - 2
228
229 for i := range m.formInputs {
230 m.formInputs[i].Width = rightInnerW - 4
231 }
232
233 listH := m.calcListHeight(innerH - 4)
234 m.serverList.SetSize(leftInnerW-2, listH)
235
236 m.headerLines = 2
237 chatReserved := m.headerLines + 1 + 1
238
239 m.chatVP.Width = rightInnerW - 2
240 m.chatVP.Height = innerH - chatReserved - 1
241 m.chatInput.Width = m.chatVP.Width
242
243 m.ready = true
244 for _, s := range m.servers {
245 for _, q := range s.queued {
246 m.applyChanLine(q)
247 }
248 s.queued = nil
249 }
250 if m.mode == modeChat && m.activeID != 0 {
251 m.refreshChat()
252 }
253 return m, nil
254
255 case tea.KeyMsg:
256 switch msg.String() {
257 case "ctrl+c", "esc":
258 return m, tea.Quit
259 case "left":
260 m.focus = paneServers
261 m.blurRight()
262 return m, nil
263 case "right":
264 m.focus = paneRight
265 m.focusRight()
266 return m, nil
267 }
268 if m.focus == paneServers {
269 return m.updateServersPane(msg)
270 }
271 return m.updateRightPane(msg)
272
273 case ircChanLineMsg:
274 m.applyChanLine(msg)
275 return m, nil
276

Callers 4

updateServersPaneMethod · 0.45
updateFormMethod · 0.45
updateChatMethod · 0.45
UpdateMethod · 0.45

Calls 11

calcListHeightMethod · 0.95
applyChanLineMethod · 0.95
refreshChatMethod · 0.95
blurRightMethod · 0.95
focusRightMethod · 0.95
updateServersPaneMethod · 0.95
updateRightPaneMethod · 0.95
pushSysLineMethod · 0.95
addListItemMethod · 0.95
resizeListMethod · 0.95
serverIDTypeAlias · 0.85

Tested by

no test coverage detected