From 6dc959de770b52bc90e9254d8753b622d7d10c22 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 19 May 2026 23:06:26 +0200 Subject: [PATCH] add sendtodiff in replay Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- internal/ui/replay/model.go | 2 +- internal/ui/replay/update.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/internal/ui/replay/model.go b/internal/ui/replay/model.go index f924209..d74ad94 100644 --- a/internal/ui/replay/model.go +++ b/internal/ui/replay/model.go @@ -204,7 +204,7 @@ func (replayKeyMap) ShortHelp() []key.Binding { func (m replayKeyMap) FullHelp() [][]key.Binding { g := keys.Keys.Global - pageGlobals := []key.Binding{g.Up, g.Down, g.CycleFocus, g.ScrollUp, g.ScrollDown, g.Left, g.Right, g.Escape, g.Copy, g.CopyAs} + pageGlobals := []key.Binding{g.Up, g.Down, g.CycleFocus, g.ScrollUp, g.ScrollDown, g.Left, g.Right, g.Escape, g.Copy, g.CopyAs, g.SendToDiff} all := append(keys.Keys.Replay.Bindings(), pageGlobals...) all = append(all, g.CommonBindings()...) return keys.ChunkByWidth(all, m.width) diff --git a/internal/ui/replay/update.go b/internal/ui/replay/update.go index 626108e..41ef599 100644 --- a/internal/ui/replay/update.go +++ b/internal/ui/replay/update.go @@ -21,6 +21,7 @@ import ( "github.com/anotherhadi/spilltea/internal/keys" "github.com/anotherhadi/spilltea/internal/style" "github.com/anotherhadi/spilltea/internal/util" + diffUI "github.com/anotherhadi/spilltea/internal/ui/diff" "github.com/klauspost/compress/zstd" ) @@ -253,6 +254,24 @@ func (m Model) updateNormalMode(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { m.refreshListViewport() m.refreshBody() + case key.Matches(msg, g.SendToDiff): + if len(m.entries) > 0 { + e := m.entries[m.cursor] + var raw, label string + if m.focusedPanel == panelResponse { + raw = e.ResponseRaw + label = fmt.Sprintf("%d %s", e.StatusCode, http.StatusText(e.StatusCode)) + } else { + raw = e.RequestRaw + label = e.Method + " " + e.Host + e.Path + } + if raw != "" { + return m, func() tea.Msg { + return diffUI.SendToDiffMsg{Label: label, Raw: raw} + } + } + } + case key.Matches(msg, g.Help): m.help.ShowAll = !m.help.ShowAll m.recalcSizes()