Add filename to browser title bar
This commit is contained in:
parent
e83f065faa
commit
82c105e8c3
@ -17,6 +17,8 @@ var databaseFiles []string
|
|||||||
var db *bolt.DB
|
var db *bolt.DB
|
||||||
var memBolt *BoltDB
|
var memBolt *BoltDB
|
||||||
|
|
||||||
|
var currentFilename string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ func main() {
|
|||||||
|
|
||||||
databaseFiles := os.Args[1:]
|
databaseFiles := os.Args[1:]
|
||||||
for _, databaseFile := range databaseFiles {
|
for _, databaseFile := range databaseFiles {
|
||||||
|
currentFilename = databaseFile
|
||||||
db, err = bolt.Open(databaseFile, 0600, nil)
|
db, err = bolt.Open(databaseFile, 0600, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error reading file: %q\n", err.Error())
|
fmt.Printf("Error reading file: %q\n", err.Error())
|
||||||
|
@ -476,8 +476,9 @@ func (screen *BrowserScreen) drawScreen(style Style) {
|
|||||||
|
|
||||||
func (screen *BrowserScreen) drawHeader(style Style) {
|
func (screen *BrowserScreen) drawHeader(style Style) {
|
||||||
width, _ := termbox.Size()
|
width, _ := termbox.Size()
|
||||||
spaces := strings.Repeat(" ", (width / 2))
|
headerString := ProgramName + ": " + currentFilename
|
||||||
termboxUtil.DrawStringAtPoint(fmt.Sprintf("%s%s%s", spaces, ProgramName, spaces), 0, 0, style.titleFg, style.titleBg)
|
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) {
|
func (screen *BrowserScreen) drawFooter(style Style) {
|
||||||
if screen.messageTimeout > 0 && time.Since(screen.messageTime) > screen.messageTimeout {
|
if screen.messageTimeout > 0 && time.Since(screen.messageTime) > screen.messageTimeout {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user