Detailed changes
@@ -151,7 +151,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.SetSize(msg.Width, msg.Height)
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, m.common.KeyMap.Back) && m.error != nil:
m.error = nil
@@ -179,37 +179,34 @@ func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
}
}
- case tea.KeyMsg, tea.MouseMsg:
- switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
+ switch {
+ case key.Matches(msg, ui.common.KeyMap.Back) && ui.error != nil:
+ ui.error = nil
+ ui.state = readyState
+ // Always show the footer on error.
+ ui.showFooter = ui.footer.ShowAll()
+ case key.Matches(msg, ui.common.KeyMap.Help):
+ cmds = append(cmds, footer.ToggleFooterCmd)
+ case key.Matches(msg, ui.common.KeyMap.Quit):
+ if !ui.IsFiltering() {
+ // Stop bubblezone background workers.
+ ui.common.Zone.Close()
+ return ui, tea.Quit
+ }
+ case ui.activePage == repoPage &&
+ ui.pages[ui.activePage].(*repo.Repo).Path() == "" &&
+ key.Matches(msg, ui.common.KeyMap.Back):
+ ui.activePage = selectionPage
+ // Always show the footer on selection page.
+ ui.showFooter = true
+ }
+ case tea.MouseClickMsg:
+ switch msg.Mouse().Button {
+ case tea.MouseLeft:
switch {
- case key.Matches(msg, ui.common.KeyMap.Back) && ui.error != nil:
- ui.error = nil
- ui.state = readyState
- // Always show the footer on error.
- ui.showFooter = ui.footer.ShowAll()
- case key.Matches(msg, ui.common.KeyMap.Help):
+ case ui.common.Zone.Get("footer").InBounds(msg):
cmds = append(cmds, footer.ToggleFooterCmd)
- case key.Matches(msg, ui.common.KeyMap.Quit):
- if !ui.IsFiltering() {
- // Stop bubblezone background workers.
- ui.common.Zone.Close()
- return ui, tea.Quit
- }
- case ui.activePage == repoPage &&
- ui.pages[ui.activePage].(*repo.Repo).Path() == "" &&
- key.Matches(msg, ui.common.KeyMap.Back):
- ui.activePage = selectionPage
- // Always show the footer on selection page.
- ui.showFooter = true
- }
- case tea.MouseClickMsg:
- switch msg.Mouse().Button {
- case tea.MouseLeft:
- switch {
- case ui.common.Zone.Get("footer").InBounds(msg):
- cmds = append(cmds, footer.ToggleFooterCmd)
- }
}
}
case footer.ToggleFooterMsg:
@@ -252,7 +252,7 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
}
}
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
filterState := s.FilterState()
switch {
case key.Matches(msg, s.common.KeyMap.Help):
@@ -54,7 +54,7 @@ func (t *Tabs) Init() tea.Cmd {
func (t *Tabs) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds := make([]tea.Cmd, 0)
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch msg.String() {
case "tab":
t.activeTab = (t.activeTab + 1) % len(t.tabs)
@@ -40,7 +40,7 @@ func (v *Viewport) Init() tea.Cmd {
// Update implements tea.Model.
func (v *Viewport) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, v.common.KeyMap.GotoTop):
v.GotoTop()
@@ -264,7 +264,7 @@ func (f *Files) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case filesViewFiles, filesViewContent:
cmds = append(cmds, f.deselectItemCmd())
}
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch f.activeView {
case filesViewFiles:
switch {
@@ -82,7 +82,7 @@ func (d FileItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
return nil
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, d.common.KeyMap.Copy):
return copyCmd(item.entry.Name(), fmt.Sprintf("File name %q copied to clipboard", item.entry.Name()))
@@ -221,11 +221,11 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if i != nil {
l.activeCommit = i.(LogItem).Commit
}
- case tea.KeyMsg, tea.MouseMsg:
+ case tea.KeyPressMsg, tea.MouseClickMsg:
switch l.activeView {
case logViewCommits:
switch kmsg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(kmsg, l.common.KeyMap.SelectItem):
cmds = append(cmds, l.selector.SelectItemCmd)
@@ -248,7 +248,7 @@ func (l *Log) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
case logViewDiff:
switch kmsg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(kmsg, l.common.KeyMap.BackItem):
l.goBack()
@@ -62,7 +62,7 @@ func (d LogItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
return nil
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, d.common.KeyMap.Copy):
return copyCmd(item.Hash(), "Commit hash copied to clipboard")
@@ -152,7 +152,7 @@ func (r *Refs) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switchTabCmd(&Files{}),
)
}
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, r.common.KeyMap.SelectItem):
cmds = append(cmds, r.selector.SelectItemCmd)
@@ -83,7 +83,7 @@ func (d RefItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
return nil
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, d.common.KeyMap.Copy):
return copyCmd(item.ID(), fmt.Sprintf("Reference %q copied to clipboard", item.ID()))
@@ -171,7 +171,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
case tabs.ActiveTabMsg:
r.activeTab = int(msg)
- case tea.KeyMsg, tea.MouseMsg:
+ case tea.KeyPressMsg, tea.MouseClickMsg:
t, cmd := r.tabs.Update(msg)
r.tabs = t.(*tabs.Tabs)
if cmd != nil {
@@ -200,7 +200,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, r.common.KeyMap.Back):
cmds = append(cmds, goBackCmd)
@@ -271,7 +271,7 @@ func (r *Repo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Update the status bar on these events
// Must come after we've updated the active tab
switch msg.(type) {
- case RepoMsg, RefMsg, tabs.ActiveTabMsg, tea.KeyMsg, tea.MouseMsg,
+ case RepoMsg, RefMsg, tabs.ActiveTabMsg, tea.KeyPressMsg, tea.MouseClickMsg,
FileItemsMsg, FileContentMsg, FileBlameMsg, selector.ActiveMsg,
LogItemsMsg, GoBackMsg, LogDiffMsg, EmptyRepoMsg,
StashListMsg, StashPatchMsg:
@@ -165,7 +165,7 @@ func (s *Stash) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
}
}
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch s.state {
case stashStateList:
switch {
@@ -65,7 +65,7 @@ func (d StashItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, d.common.KeyMap.Copy):
return copyCmd(item.Title(), fmt.Sprintf("Stash message %q copied to clipboard", item.Title()))
@@ -135,7 +135,7 @@ func (d *ItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
return nil
}
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, d.common.KeyMap.Copy):
d.copiedIdx = idx
@@ -250,9 +250,9 @@ func (s *Selection) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if cmd != nil {
cmds = append(cmds, cmd)
}
- case tea.KeyMsg, tea.MouseMsg:
+ case tea.KeyPressMsg, tea.MouseMsg:
switch msg := msg.(type) {
- case tea.KeyMsg:
+ case tea.KeyPressMsg:
switch {
case key.Matches(msg, s.common.KeyMap.Back):
cmds = append(cmds, s.selector.Init())