MCPcopy Create free account
hub / github.com/JanSmrcka/differ / Update

Method Update

internal/ui/log.go:57–79  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

55}
56
57func (m LogModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
58 switch msg := msg.(type) {
59 case tea.WindowSizeMsg:
60 m.width = msg.Width
61 m.height = msg.Height
62 m.viewport = viewport.New(m.width-2, m.height-4)
63 m.ready = true
64 case logLoadedMsg:
65 m.commits = msg.commits
66 case logDiffLoadedMsg:
67 m.viewport.SetContent(msg.content)
68 m.viewport.GotoTop()
69 m.mode = logModeDiff
70 case tea.KeyMsg:
71 switch m.mode {
72 case logModeList:
73 return m.updateList(msg)
74 case logModeDiff:
75 return m.updateDiff(msg)
76 }
77 }
78 return m, nil
79}
80
81func (m LogModel) updateList(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
82 switch msg.String() {

Callers 1

updateDiffMethod · 0.45

Calls 2

updateListMethod · 0.95
updateDiffMethod · 0.95

Tested by

no test coverage detected