Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/sift/sift.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,12 @@ func Run(ctx context.Context, opts SiftOptions) error {
return nil
})

return g.Wait()
err := g.Wait()
if err != nil {
return err
}

m.quitting = false
fmt.Print(m.View())
return nil
}
2 changes: 1 addition & 1 deletion internal/sift/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package sift

var Version = "v0.12.0"
var Version = "v0.12.1"
15 changes: 13 additions & 2 deletions internal/sift/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type siftModel struct {

ready bool
started bool
quitting bool
viewport viewport.Model
keyBuffer []string

Expand Down Expand Up @@ -420,8 +421,11 @@ func (m *siftModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.startTime = time.Now()
}

if m.mode == viewModeInline && !m.endTime.IsZero() {
if m.quitting {
return m, tea.Quit
} else if m.mode == viewModeInline && !m.endTime.IsZero() {
m.quitting = true
return m, nil
}

switch msg := msg.(type) {
Expand Down Expand Up @@ -577,7 +581,8 @@ func (m *siftModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.ExitAltScreen
}
if !m.endTime.IsZero() {
return m, tea.Quit
m.quitting = true
return m, nil
}
case key.Matches(msg, keys.ClearSearch):
// Clear search filter when esc is pressed and not in search mode
Expand Down Expand Up @@ -631,6 +636,12 @@ func (m *siftModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

func (m *siftModel) View() string {
// this is a hack to allow the final output of the inline view to include all lines
// the proper way to handle this would be to have a custom renderer for tea which doesn't truncate the lines based on the viewport
if m.quitting {
return ""
}

if m.mode == viewModeInline {
return m.inlineView()
}
Expand Down