Skip to content

Commit

Permalink
Catalog screen freeze on MacOS (#2978)
Browse files Browse the repository at this point in the history
* Testing custom build

* Add handling of quit message

* Cleanup

* imports update
  • Loading branch information
denis256 committed Mar 2, 2024
1 parent 1e3a537 commit 7978845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cli/commands/catalog/tui/models/list/model.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package list

import (
"os"

"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
Expand Down Expand Up @@ -65,6 +67,11 @@ func (model Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
h, v := lipgloss.NewStyle().Padding(topPadding, rightPadding).GetFrameSize()
model.SetSize(msg.Width-h, msg.Height-v)

case tea.QuitMsg:
// handle quit message
os.Exit(0)
return model, tea.Quit

case tea.KeyMsg:
// Don't match any of the keys below if we're actively filtering.
if model.FilterState() == list.Filtering {
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/catalog/tui/models/page/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,5 @@ func clearScreen() tea.Msg {
// https://www.unix.com/os-x-apple-/279401-means-clearing-scroll-buffer-osx-terminal.html
fmt.Print("\033[H\033[2J\033[3J")
}
return tea.ClearScreen()
return tea.Quit()
}

0 comments on commit 7978845

Please sign in to comment.