Skip to content

Commit

Permalink
Use our own default label params with ASCII ellipsis.
Browse files Browse the repository at this point in the history
Well, frankly '~' is not the best replacement for '...'. But it's the only
thing that comes to mind (used in Far Manager and Midnight Commander).
  • Loading branch information
nsf committed May 28, 2015
1 parent 51c0dc2 commit b75e46d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion autocomplete.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (ac *autocompl) draw_onto(buf *tulib.Buffer, x, y int) {
dst = find_place_for_rect(buf.Rect, tulib.Rect{x, y + 1, w, h})

slider_i, slider_r := ac.slider_pos_and_rune(dst.Height)
lp := tulib.DefaultLabelParams
lp := default_label_params

r := dst
r.Width--
Expand Down
2 changes: 1 addition & 1 deletion godit.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (g *godit) draw() {
}

func (g *godit) draw_status() {
lp := tulib.DefaultLabelParams
lp := default_label_params
r := g.uibuf.Rect
r.Y = r.Height - 1
r.Height = 1
Expand Down
2 changes: 1 addition & 1 deletion line_edit_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (l *line_edit_mode) draw() {
Bg: termbox.ColorDefault,
Ch: ' ',
})
lp := tulib.DefaultLabelParams
lp := default_label_params
lp.Fg = termbox.ColorCyan
ui.DrawLabel(prompt_r, &lp, l.prompt)

Expand Down
8 changes: 8 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ var invisible_rune_table = []rune{
'_', // 31
}

func make_godit_default_label_params() tulib.LabelParams {
lp := tulib.DefaultLabelParams
lp.Ellipsis = '~'
return lp
}

var default_label_params = make_godit_default_label_params()

// somewhat close to what wcwidth does, except rune_width doesn't return 0 or
// -1, it's always 1 or 2
func rune_width(r rune) int {
Expand Down
2 changes: 1 addition & 1 deletion view.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (v *view) draw_status() {
}

// fill background with '-'
lp := tulib.DefaultLabelParams
lp := default_label_params
lp.Bg = termbox.AttrReverse
lp.Fg = termbox.AttrReverse | termbox.AttrBold
v.uibuf.Fill(tulib.Rect{0, v.height(), v.uibuf.Width, 1}, termbox.Cell{
Expand Down
3 changes: 1 addition & 2 deletions view_op_mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"github.com/nsf/termbox-go"
"github.com/nsf/tulib"
)

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -34,7 +33,7 @@ func (v view_op_mode) draw() {
Bg: termbox.ColorDefault,
Ch: ' ',
})
lp := tulib.DefaultLabelParams
lp := default_label_params
lp.Fg = termbox.ColorYellow
g.uibuf.DrawLabel(r, &lp, view_op_mode_name)

Expand Down

0 comments on commit b75e46d

Please sign in to comment.