mirror of
https://github.com/charmbracelet/glow
synced 2024-11-12 23:17:16 +00:00
Fix TUI regression where stash memo contained file path
This commit is contained in:
parent
11f627a132
commit
6aca2f5fe7
3 changed files with 5 additions and 4 deletions
|
@ -297,7 +297,7 @@ func (m pagerModel) update(msg tea.Msg) (pagerModel, tea.Cmd) {
|
|||
m.state = pagerStateStashing
|
||||
cmds = append(
|
||||
cmds,
|
||||
stashDocument(m.common.cc, md),
|
||||
stashDocument(m.common.cc, m.common.cwd, md),
|
||||
m.spinner.Tick,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -852,7 +852,7 @@ func (m *stashModel) handleDocumentBrowsing(msg tea.Msg) tea.Cmd {
|
|||
m.common.filesStashing[md.stashID] = struct{}{}
|
||||
m.common.latestFileStashed = md.stashID
|
||||
cmds = append(cmds,
|
||||
stashDocument(m.common.cc, *md),
|
||||
stashDocument(m.common.cc, m.common.cwd, *md),
|
||||
m.newStatusMessage(stashingStatusMessage),
|
||||
)
|
||||
|
||||
|
|
5
ui/ui.go
5
ui/ui.go
|
@ -615,7 +615,7 @@ func saveDocumentNote(cc *client.Client, id string, note string) tea.Cmd {
|
|||
}
|
||||
}
|
||||
|
||||
func stashDocument(cc *client.Client, md markdown) tea.Cmd {
|
||||
func stashDocument(cc *client.Client, cwd string, md markdown) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
if cc == nil {
|
||||
err := errors.New("can't stash; no charm client")
|
||||
|
@ -660,7 +660,8 @@ func stashDocument(cc *client.Client, md markdown) tea.Cmd {
|
|||
}
|
||||
}
|
||||
|
||||
newMd, err := cc.StashMarkdown(md.Note, md.Body)
|
||||
memo := stripAbsolutePath(md.Note, cwd)
|
||||
newMd, err := cc.StashMarkdown(memo, md.Body)
|
||||
if err != nil {
|
||||
if debug {
|
||||
log.Println("error stashing document:", err)
|
||||
|
|
Loading…
Reference in a new issue