Skip to content
Closed
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ if (Get-Command zgod -ErrorAction SilentlyContinue) { Invoke-Expression (& zgod
| `alt+p` | Preview multiline command (popup mode only) |
| `?` | Help overlay |

Mouse is also supported in compatible terminals: wheel scrolls the result list,
hovering a result highlights it, left-clicking a result accepts it, footer
shortcuts can be clicked, and clicking in the input moves the cursor.

## Configuration

Default paths:
Expand Down
1 change: 1 addition & 0 deletions internal/cli/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func doSearch(cmd *cobra.Command) (int, error) {
ctx.model,
tea.WithInput(ctx.ttyIn),
tea.WithOutput(ctx.ttyOut),
tea.WithMouseAllMotion(),
)

finalModel, err := p.Run()
Expand Down
17 changes: 6 additions & 11 deletions internal/tui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Model struct {
width int
height int
maxHeight int
terminalHeight int
selected string
mode match.Mode
enabledModes []match.Mode
Expand Down Expand Up @@ -224,7 +225,11 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.KeyMsg:
return m.handleKey(msg)
case tea.MouseMsg:
return m.handleMouse(msg)
case tea.WindowSizeMsg:
m.terminalHeight = msg.Height

innerWidth := max(msg.Width-panelBorderW-(panelPaddingX*2), 1)
m.width = innerWidth

Expand Down Expand Up @@ -746,17 +751,7 @@ func (m *Model) handlePreview(msg tea.KeyMsg) bool {
return false
}

if m.cfg.Display.MultilinePreview != "popup" {
return true
}

cmd, ok := m.currentResultCommand()
if !ok || !strings.Contains(cmd, "\n") {
return true
}

m.showPreview = true
m.previewCommand = cmd
m.showCurrentPreview()

return true
}
Expand Down
Loading
Loading