mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 13:57:07 +09:00
@@ -740,7 +740,7 @@ func (v *View) SaveAs(usePlugin bool) bool {
|
||||
// the filename might or might not be quoted, so unquote first then join the strings.
|
||||
filename = strings.Join(SplitCommandArgs(filename), " ")
|
||||
v.Buf.Path = filename
|
||||
v.Buf.Name = filename
|
||||
v.Buf.name = filename
|
||||
|
||||
v.Save(true)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type Buffer struct {
|
||||
// Absolute path to the file on disk
|
||||
AbsPath string
|
||||
// Name of the buffer on the status line
|
||||
Name string
|
||||
name string
|
||||
|
||||
// Whether or not the buffer has been modified since it was opened
|
||||
IsModified bool
|
||||
@@ -164,6 +164,13 @@ func NewBuffer(txt []byte, path string) *Buffer {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *Buffer) GetName() string {
|
||||
if b.name == "" {
|
||||
return b.Path
|
||||
}
|
||||
return b.name
|
||||
}
|
||||
|
||||
// UpdateRules updates the syntax rules and filetype for this buffer
|
||||
// This is called when the colorscheme changes
|
||||
func (b *Buffer) UpdateRules() {
|
||||
|
||||
@@ -79,7 +79,7 @@ func (m *Messenger) AddLog(msg string) {
|
||||
func (m *Messenger) getBuffer() *Buffer {
|
||||
if m.log == nil {
|
||||
m.log = NewBuffer([]byte{}, "")
|
||||
m.log.Name = "Log"
|
||||
m.log.name = "Log"
|
||||
}
|
||||
return m.log
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ func (s *SplitTree) ResizeSplits() {
|
||||
}
|
||||
|
||||
func (l *LeafNode) String() string {
|
||||
return l.view.Buf.Name
|
||||
return l.view.Buf.GetName()
|
||||
}
|
||||
|
||||
func search(haystack []Node, needle Node) int {
|
||||
|
||||
@@ -17,10 +17,7 @@ func (sline *Statusline) Display() {
|
||||
// We'll draw the line at the lowest line in the view
|
||||
y := sline.view.height + sline.view.y
|
||||
|
||||
file := sline.view.Buf.Name
|
||||
if file == "" {
|
||||
file = sline.view.Buf.Path
|
||||
}
|
||||
file := sline.view.Buf.GetName()
|
||||
|
||||
// If the buffer is dirty (has been modified) write a little '+'
|
||||
if sline.view.Buf.IsModified {
|
||||
|
||||
@@ -85,7 +85,7 @@ func TabbarString() (string, map[int]int) {
|
||||
} else {
|
||||
str += " "
|
||||
}
|
||||
str += t.views[t.curView].Buf.Name
|
||||
str += t.views[t.curView].Buf.GetName()
|
||||
if i == curTab {
|
||||
str += "]"
|
||||
} else {
|
||||
|
||||
@@ -200,7 +200,7 @@ func (v *View) CanClose() bool {
|
||||
if v.Buf.Settings["autosave"].(bool) {
|
||||
char = 'y'
|
||||
} else {
|
||||
char, canceled = messenger.LetterPrompt("Save changes to "+v.Buf.Name+" before closing? (y,n,esc) ", 'y', 'n')
|
||||
char, canceled = messenger.LetterPrompt("Save changes to "+v.Buf.GetName()+" before closing? (y,n,esc) ", 'y', 'n')
|
||||
}
|
||||
if !canceled {
|
||||
if char == 'y' {
|
||||
@@ -617,7 +617,7 @@ func (v *View) openHelp(helpPage string) {
|
||||
TermMessage("Unable to load help text", helpPage, "\n", err)
|
||||
} else {
|
||||
helpBuffer := NewBuffer(data, helpPage+".md")
|
||||
helpBuffer.Name = "Help"
|
||||
helpBuffer.name = "Help"
|
||||
|
||||
if v.Type == vtHelp {
|
||||
v.OpenBuffer(helpBuffer)
|
||||
|
||||
Reference in New Issue
Block a user