MCPcopy Create free account
hub / github.com/B33pBeeps/redthread / handleKey

Method handleKey

internal/app/model.go:258–289  ·  view source on GitHub ↗

--- key handlers ------------------------------------------------------

(msg tea.KeyMsg)

Source from the content-addressed store, hash-verified

256// --- key handlers ------------------------------------------------------
257
258func (m model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
259 key := msg.String()
260
261 if key == "ctrl+c" {
262 _ = m.saver.Flush()
263 return m, tea.Quit
264 }
265 if m.transition != nil {
266 return m, nil
267 }
268 if m.renaming {
269 return m.handleRenameKey(msg, key)
270 }
271 if m.fontMenu != nil {
272 return m.handleFontMenuKey(key)
273 }
274 if m.bgMenu != nil {
275 return m.handleBgMenuKey(msg, key)
276 }
277 if m.pull.Active {
278 if mdl, cmd, handled := m.handlePullKey(key); handled {
279 return mdl, cmd
280 }
281 }
282 switch m.mode {
283 case ModeBoard:
284 return m.handleBoardKey(key)
285 case ModeEdit:
286 return m.handleEditKey(msg, key)
287 }
288 return m, nil
289}
290
291// handlePullKey lets the keyboard drive the in-progress string pull —
292// arrows nudge the virtual endpoint, tab/S-tab snap to other notes,

Callers 1

UpdateMethod · 0.95

Calls 7

handleRenameKeyMethod · 0.95
handleFontMenuKeyMethod · 0.95
handleBgMenuKeyMethod · 0.95
handlePullKeyMethod · 0.95
handleBoardKeyMethod · 0.95
handleEditKeyMethod · 0.95
FlushMethod · 0.80

Tested by

no test coverage detected