diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-07-22 03:21:20 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-07-22 03:21:20 +0900 |
commit | f469c25730aaa711b8327be068514c944074cce4 (patch) | |
tree | 3c386987c2bb227188b86f3e4438430262a7c6ca /src/terminal.go | |
parent | 18469b69549f1efd5294ebeb357d1773fc3a241e (diff) |
Add --header-lines option
Diffstat (limited to 'src/terminal.go')
-rw-r--r-- | src/terminal.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go index 43d2d8c0..844574a1 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -79,6 +79,7 @@ var _runeWidths = make(map[rune]int) const ( reqPrompt util.EventType = iota reqInfo + reqHeader reqList reqRefresh reqRedraw @@ -231,6 +232,22 @@ func (t *Terminal) UpdateCount(cnt int, final bool) { } } +// UpdateHeader updates the header +func (t *Terminal) UpdateHeader(header []string, lines int) { + t.mutex.Lock() + t.header = make([]string, lines) + copy(t.header, header) + if !t.reverse { + reversed := make([]string, lines) + for idx, str := range t.header { + reversed[lines-idx-1] = str + } + t.header = reversed + } + t.mutex.Unlock() + t.reqBox.Set(reqHeader, nil) +} + // UpdateProgress updates the search progress func (t *Terminal) UpdateProgress(progress float32) { t.mutex.Lock() @@ -686,6 +703,8 @@ func (t *Terminal) Loop() { t.printInfo() case reqList: t.printList() + case reqHeader: + t.printHeader() case reqRefresh: t.suppress = false case reqRedraw: |