mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 14:14:17 +00:00
Restore original displayed path when deleting a newly stashed item
This commit is contained in:
parent
5515460f32
commit
2f9babce80
2 changed files with 5 additions and 6 deletions
|
@ -59,6 +59,7 @@ const (
|
|||
type markdown struct {
|
||||
markdownType markdownType
|
||||
localPath string // only relevant to local files and converted files that are newly stashed
|
||||
displayPath string // what we show in the note field
|
||||
charm.Markdown
|
||||
}
|
||||
|
||||
|
@ -526,6 +527,7 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
// If document was stashed during this session, convert it
|
||||
// back to a local file.
|
||||
m.markdowns[i].markdownType = localMarkdown
|
||||
m.markdowns[i].Note = m.markdowns[i].displayPath
|
||||
} else {
|
||||
// Delete optimistically and remove the stashed item
|
||||
// before we've received a success response.
|
||||
|
|
9
ui/ui.go
9
ui/ui.go
|
@ -585,15 +585,12 @@ func localFileToMarkdown(cwd string, res gitcha.SearchResult) *markdown {
|
|||
md := &markdown{
|
||||
markdownType: localMarkdown,
|
||||
localPath: res.Path,
|
||||
displayPath: strings.Replace(res.Path, cwd+"/", "", -1), // strip absolute path
|
||||
Markdown: charm.Markdown{},
|
||||
}
|
||||
|
||||
// Strip absolute path
|
||||
md.Markdown.Note = strings.Replace(res.Path, cwd+"/", "", -1)
|
||||
|
||||
// Get last modified time
|
||||
t := res.Info.ModTime()
|
||||
md.CreatedAt = t
|
||||
md.Markdown.Note = md.displayPath
|
||||
md.CreatedAt = res.Info.ModTime() // last modified time
|
||||
|
||||
return md
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue