prevent infinite render loop (fixes #184)
This commit is contained in:
parent
e7bf771e7c
commit
fa48fc1f81
12
README.md
12
README.md
@ -74,14 +74,14 @@ Analyze and image and get a pass/fail result based on the image efficiency and w
|
|||||||
|
|
||||||
**Ubuntu/Debian**
|
**Ubuntu/Debian**
|
||||||
```bash
|
```bash
|
||||||
wget https://github.com/wagoodman/dive/releases/download/v0.7.0/dive_0.7.0_linux_amd64.deb
|
wget https://github.com/wagoodman/dive/releases/download/v0.7.1/dive_0.7.1_linux_amd64.deb
|
||||||
sudo apt install ./dive_0.7.0_linux_amd64.deb
|
sudo apt install ./dive_0.7.1_linux_amd64.deb
|
||||||
```
|
```
|
||||||
|
|
||||||
**RHEL/Centos**
|
**RHEL/Centos**
|
||||||
```bash
|
```bash
|
||||||
curl -OL https://github.com/wagoodman/dive/releases/download/v0.7.0/dive_0.7.0_linux_amd64.rpm
|
curl -OL https://github.com/wagoodman/dive/releases/download/v0.7.1/dive_0.7.1_linux_amd64.rpm
|
||||||
rpm -i dive_0.7.0_linux_amd64.rpm
|
rpm -i dive_0.7.1_linux_amd64.rpm
|
||||||
```
|
```
|
||||||
|
|
||||||
**Arch Linux**
|
**Arch Linux**
|
||||||
@ -100,11 +100,11 @@ The above example assumes [`yay`](https://aur.archlinux.org/packages/yay/) as th
|
|||||||
brew tap wagoodman/dive
|
brew tap wagoodman/dive
|
||||||
brew install dive
|
brew install dive
|
||||||
```
|
```
|
||||||
or download the latest Darwin build from the [releases page](https://github.com/wagoodman/dive/releases/download/v0.7.0/dive_0.7.0_darwin_amd64.tar.gz).
|
or download the latest Darwin build from the [releases page](https://github.com/wagoodman/dive/releases/download/v0.7.1/dive_0.7.1_darwin_amd64.tar.gz).
|
||||||
|
|
||||||
**Windows**
|
**Windows**
|
||||||
|
|
||||||
Download the [latest release](https://github.com/wagoodman/dive/releases/download/v0.7.0/dive_0.7.0_windows_amd64.zip).
|
Download the [latest release](https://github.com/wagoodman/dive/releases/download/v0.7.1/dive_0.7.1_windows_amd64.zip).
|
||||||
|
|
||||||
**Go tools**
|
**Go tools**
|
||||||
Requires Go version 1.9 or higher.
|
Requires Go version 1.9 or higher.
|
||||||
|
@ -331,9 +331,12 @@ func filterRegex() *regexp.Regexp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// onLayoutChange is called by the UI framework to inform the view-model of the new screen dimensions
|
// onLayoutChange is called by the UI framework to inform the view-model of the new screen dimensions
|
||||||
func (controller *FileTreeController) onLayoutChange() error {
|
func (controller *FileTreeController) onLayoutChange(resized bool) error {
|
||||||
controller.Update()
|
controller.Update()
|
||||||
return controller.Render()
|
if resized {
|
||||||
|
return controller.Render()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update refreshes the state objects for future rendering.
|
// Update refreshes the state objects for future rendering.
|
||||||
|
12
ui/ui.go
12
ui/ui.go
@ -59,6 +59,8 @@ var GlobalKeybindings struct {
|
|||||||
filterView []keybinding.Key
|
filterView []keybinding.Key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastX, lastY int
|
||||||
|
|
||||||
// View defines the a renderable terminal screen pane.
|
// View defines the a renderable terminal screen pane.
|
||||||
type View interface {
|
type View interface {
|
||||||
Setup(*gocui.View, *gocui.View) error
|
Setup(*gocui.View, *gocui.View) error
|
||||||
@ -187,6 +189,14 @@ func layout(g *gocui.Gui) error {
|
|||||||
// TODO: this logic should be refactored into an abstraction that takes care of the math for us
|
// TODO: this logic should be refactored into an abstraction that takes care of the math for us
|
||||||
|
|
||||||
maxX, maxY := g.Size()
|
maxX, maxY := g.Size()
|
||||||
|
var resized bool
|
||||||
|
if maxX != lastX {
|
||||||
|
resized = true
|
||||||
|
}
|
||||||
|
if maxY != lastY {
|
||||||
|
resized = true
|
||||||
|
}
|
||||||
|
lastX, lastY = maxX, maxY
|
||||||
fileTreeSplitRatio := viper.GetFloat64("filetree.pane-width")
|
fileTreeSplitRatio := viper.GetFloat64("filetree.pane-width")
|
||||||
if fileTreeSplitRatio >= 1 || fileTreeSplitRatio <= 0 {
|
if fileTreeSplitRatio >= 1 || fileTreeSplitRatio <= 0 {
|
||||||
logrus.Errorf("invalid config value: 'filetree.pane-width' should be 0 < value < 1, given '%v'", fileTreeSplitRatio)
|
logrus.Errorf("invalid config value: 'filetree.pane-width' should be 0 < value < 1, given '%v'", fileTreeSplitRatio)
|
||||||
@ -260,7 +270,7 @@ func layout(g *gocui.Gui) error {
|
|||||||
if isNewView(viewErr, headerErr) {
|
if isNewView(viewErr, headerErr) {
|
||||||
Controllers.Tree.Setup(view, header)
|
Controllers.Tree.Setup(view, header)
|
||||||
}
|
}
|
||||||
Controllers.Tree.onLayoutChange()
|
Controllers.Tree.onLayoutChange(resized)
|
||||||
|
|
||||||
// Status Bar
|
// Status Bar
|
||||||
view, viewErr = g.SetView(Controllers.Status.Name, -1, maxY-statusBarHeight-statusBarIndex, maxX, maxY-(statusBarIndex-1))
|
view, viewErr = g.SetView(Controllers.Status.Name, -1, maxY-statusBarHeight-statusBarIndex, maxX, maxY-(statusBarIndex-1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user