forked from tslocum/cview
Expand click area of presentation demo tabs
This commit is contained in:
parent
1cbf8e9f74
commit
0aa37dca06
|
@ -65,11 +65,18 @@ func main() {
|
|||
pages := cview.NewPages()
|
||||
|
||||
// The bottom row has some info on where we are.
|
||||
info := cview.NewTextView().
|
||||
info := cview.NewTextView()
|
||||
info.
|
||||
SetDynamicColors(true).
|
||||
SetRegions(true).
|
||||
SetWrap(false).
|
||||
SetHighlightedFunc(func(added, removed, remaining []string) {
|
||||
n, err := strconv.Atoi(added[0])
|
||||
if err == nil && n >= 1000 {
|
||||
info.Highlight(strconv.Itoa((n - 1) / 1000))
|
||||
return
|
||||
}
|
||||
|
||||
pages.SwitchToPage(added[0])
|
||||
})
|
||||
|
||||
|
@ -94,7 +101,7 @@ func main() {
|
|||
|
||||
title, primitive := slide(nextSlide)
|
||||
pages.AddPage(strconv.Itoa(index), primitive, true, index == 0)
|
||||
fmt.Fprintf(info, `%d ["%d"][darkcyan]%s[white][""] `, index+1, index, title)
|
||||
fmt.Fprintf(info, `["%d"]%d [""]["%d"][darkcyan]%s[white][""] `, (index+1)*1000, index+1, index, title)
|
||||
|
||||
cursor += len(title) + 4
|
||||
}
|
||||
|
|
|
@ -473,7 +473,6 @@ func (t *TextView) clear() *TextView {
|
|||
// background and foreground colors swapped.
|
||||
func (t *TextView) Highlight(regionIDs ...string) *TextView {
|
||||
t.Lock()
|
||||
defer t.Unlock()
|
||||
|
||||
// Toggle highlights.
|
||||
if t.toggleHighlights {
|
||||
|
@ -523,7 +522,10 @@ func (t *TextView) Highlight(regionIDs ...string) *TextView {
|
|||
|
||||
// Notify.
|
||||
if t.highlighted != nil && len(added) > 0 || len(removed) > 0 {
|
||||
t.Unlock()
|
||||
t.highlighted(added, removed, remaining)
|
||||
} else {
|
||||
t.Unlock()
|
||||
}
|
||||
|
||||
return t
|
||||
|
|
Loading…
Reference in New Issue