mirror of
https://github.com/felixangell/phi.git
synced 2024-09-11 15:55:25 +03:00
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.
36 lines
610 B
Go
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
|
|
}
|