Add filename to browser title bar

This commit is contained in:
Brian Buller 2017-04-04 16:41:15 -05:00
parent e83f065faa
commit 82c105e8c3
2 changed files with 6 additions and 2 deletions

View File

@ -17,6 +17,8 @@ var databaseFiles []string
var db *bolt.DB
var memBolt *BoltDB
var currentFilename string
func main() {
var err error
@ -36,6 +38,7 @@ func main() {
databaseFiles := os.Args[1:]
for _, databaseFile := range databaseFiles {
currentFilename = databaseFile
db, err = bolt.Open(databaseFile, 0600, nil)
if err != nil {
fmt.Printf("Error reading file: %q\n", err.Error())

View File

@ -476,8 +476,9 @@ func (screen *BrowserScreen) drawScreen(style Style) {
func (screen *BrowserScreen) drawHeader(style Style) {
width, _ := termbox.Size()
spaces := strings.Repeat(" ", (width / 2))
termboxUtil.DrawStringAtPoint(fmt.Sprintf("%s%s%s", spaces, ProgramName, spaces), 0, 0, style.titleFg, style.titleBg)
headerString := ProgramName + ": " + currentFilename
spaces := strings.Repeat(" ", ((width-len(headerString))/2)+1)
termboxUtil.DrawStringAtPoint(fmt.Sprintf("%s%s%s", spaces, headerString, spaces), 0, 0, style.titleFg, style.titleBg)
}
func (screen *BrowserScreen) drawFooter(style Style) {
if screen.messageTimeout > 0 && time.Since(screen.messageTime) > screen.messageTimeout {