phi/buff/close_buffer.go
Felix Angell 8687f612d4 command palette is now has a hand written lexer
this means that we can 'type check' command palette arguments, e.g. if something should be a string or not, etc.
it uses the same lexer which is used for the syntax highlighting ... let's see how long that lasts.
2019-03-02 20:54:01 +00:00

36 lines
610 B
Go

package buff
import (
"fmt"
"github.com/felixangell/phi/lex"
)
func CloseBuffer(v *BufferView, commands []*lex.Token) bool {
b := v.getCurrentBuff()
if b == nil {
return false
}
// TODO eventually we should have our own
// little dialog IO message thingies.
if b.modified {
// TODO basename?
text := fmt.Sprintf("Do you want to save the changes you made to %s?", b.filePath)
// TODO
panic(text)
// dontSave := dialog.Message("%s", text).YesNo()
// if !dontSave {
// return false
// }
// save the buffer!
// Save(v, []string{})
}
v.removeBuffer(b.index)
return false
}