Handle nav resizes (#2218)
* Handle nav resizes * Update `CHANGELOG.md`
This commit is contained in:
1 parent
7b6b6da100
commit
a7f7e84e81
5 files changed
+26
-18
No files matched your search
@@ -470,6 +470,7 @@ type nav struct {
|
||||
tags map[string]string
|
||||
selectionInd int
|
||||
height int
|
||||
previewWidth int
|
||||
find string
|
||||
findBack bool
|
||||
search string
|
||||
@@ -582,7 +583,7 @@ func (nav *nav) getDirs(wd string) {
|
||||
nav.dirs = dirs
|
||||
}
|
||||
|
||||
func newNav(height int) *nav {
|
||||
func newNav(ui *ui) *nav {
|
||||
nav := &nav{
|
||||
copyJobsChan: make(chan int, 1024),
|
||||
copyBytesChan: make(chan int64, 1024),
|
||||
@@ -602,12 +603,12 @@ func newNav(height int) *nav {
|
||||
selections: make(map[string]int),
|
||||
tags: make(map[string]string),
|
||||
selectionInd: 0,
|
||||
height: height,
|
||||
previewTimer: time.NewTimer(0),
|
||||
jumpList: make([]string, 0),
|
||||
jumpListInd: -1,
|
||||
}
|
||||
|
||||
nav.resize(ui)
|
||||
return nav
|
||||
}
|
||||
|
||||
@@ -670,6 +671,22 @@ func (nav *nav) reload() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nav *nav) resize(ui *ui) {
|
||||
previewWin := ui.wins[len(ui.wins)-1]
|
||||
if previewWin.h == nav.height && previewWin.w == nav.previewWidth {
|
||||
return
|
||||
}
|
||||
|
||||
nav.height = previewWin.h
|
||||
nav.previewWidth = previewWin.w
|
||||
|
||||
for _, dir := range nav.dirs {
|
||||
dir.boundPos(nav.height)
|
||||
}
|
||||
|
||||
clear(nav.regCache)
|
||||
}
|
||||
|
||||
func (nav *nav) position() {
|
||||
if !nav.init {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user