Add parts screen with per-part view and save
Adds a `stateParts` screen (v from message view) listing all MIME leaf parts in a table with content-type, name, and size. Navigation with ↑↓/j/k, Enter to render text/* parts in a scrollable viewport (statePartView), s to save any part to the current directory with a prompted filename defaulting to the part's name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
97a8f7fbcd
commit
5afabd0255
3 changed files with 270 additions and 7 deletions
12
msgs.go
12
msgs.go
|
|
@ -19,6 +19,8 @@ type messageLoadedMsg struct {
|
|||
type messageErrMsg struct{ err error }
|
||||
type savedMsg struct{ path string }
|
||||
type saveErrMsg struct{ err error }
|
||||
type partSavedMsg struct{ path string }
|
||||
type partSaveErrMsg struct{ err error }
|
||||
|
||||
// ── Tea commands ──────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -61,3 +63,13 @@ func saveCmd(id, content string) tea.Cmd {
|
|||
return savedMsg{path}
|
||||
}
|
||||
}
|
||||
|
||||
func savePartCmd(data []byte, name string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
path, err := savePart(data, name)
|
||||
if err != nil {
|
||||
return partSaveErrMsg{err}
|
||||
}
|
||||
return partSavedMsg{path}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue