Skip to content

Commit

Permalink
message box
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Feb 26, 2023
1 parent ee657f0 commit a33af04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var (
styleWhiteBold = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorWhite).Bold(true)
styleBrown = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.Color94)
styleBrownBold = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.Color94).Bold(true)
styleGray = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorGray)
)

// TODO: check supported number of colors
Expand Down
18 changes: 16 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,22 @@ func main() {
log.Panicln(err.Error())
}

// TODO: draw message
// -m, --message=STR Attach message next to the tree
if opts.message != "" {
// upper border
sc.x = int(opts.msgX)
sc.y = int(opts.msgY)
sc.draw("+"+strings.Repeat("-", len(opts.message)+2)+"+", styleGray)
// center with message and front- and back-border
sc.x = int(opts.msgX)
sc.y = int(opts.msgY) + 1
sc.draw("| ", styleGray)
sc.draw(opts.message, styleDefault)
sc.draw(" |", styleGray)
// lower border
sc.x = int(opts.msgX)
sc.y = int(opts.msgY) + 2
sc.draw("+"+strings.Repeat("-", len(opts.message)+2)+"+", styleGray)
}

// refresh screen
evDrawn(sc)
Expand Down

0 comments on commit a33af04

Please sign in to comment.