mirror of
https://github.com/walles/moar.git
synced 2024-11-27 01:05:23 +03:00
Retain the original file name
This commit is contained in:
parent
9818eec3dc
commit
1c5e23683a
@ -120,10 +120,8 @@ func handleEditingRequest(p *Pager) {
|
||||
}
|
||||
|
||||
var fileToEdit string
|
||||
// FIXME: p.reader.name might not be the original file name, get another
|
||||
// field explicitly for that purpose
|
||||
if p.reader.name != nil {
|
||||
fileToEdit = *p.reader.name
|
||||
if p.reader.fileName != nil {
|
||||
fileToEdit = *p.reader.fileName
|
||||
} else {
|
||||
// FIXME: If the buffer is from stdin, store it in a temp file. Consider
|
||||
// naming it based on the current language setting.
|
||||
|
@ -35,6 +35,11 @@ type Reader struct {
|
||||
|
||||
lines []*Line
|
||||
name *string
|
||||
|
||||
// If this is set, it will point out the file we are reading from. If this
|
||||
// is not set, we are not reading from a file.
|
||||
fileName *string
|
||||
|
||||
err error
|
||||
|
||||
// Have we had our contents replaced using setText()?
|
||||
@ -399,6 +404,7 @@ func NewReaderFromFilenameWithoutStyle(filename string, formatter chroma.Formatt
|
||||
|
||||
returnMe.Lock()
|
||||
returnMe.name = &filename
|
||||
returnMe.fileName = &filename
|
||||
returnMe.Unlock()
|
||||
|
||||
if lexer == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user