From 8cfa1a3c94d6fda151a09d11a6de2e3cd25f6dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= Date: Wed, 27 Sep 2023 17:45:53 +0200 Subject: [PATCH] Run gofmt --- runtime/ui/viewmodel/layer_set_state.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/runtime/ui/viewmodel/layer_set_state.go b/runtime/ui/viewmodel/layer_set_state.go index 82bd184c..2fb80897 100644 --- a/runtime/ui/viewmodel/layer_set_state.go +++ b/runtime/ui/viewmodel/layer_set_state.go @@ -17,16 +17,16 @@ type LayerSetState struct { CompareStartIndex int constrainedRealEstate bool - viewStartIndex int - viewHeight int + viewStartIndex int + viewHeight int Buffer bytes.Buffer } func NewLayerSetState(layers []*image.Layer, compareMode LayerCompareMode) *LayerSetState { return &LayerSetState{ - Layers: layers, - CompareMode: compareMode, + Layers: layers, + CompareMode: compareMode, LayerIndex: 0, viewStartIndex: 0, } @@ -54,7 +54,6 @@ func (vm *LayerSetState) ResetCursor() { vm.viewStartIndex = 0 } - // PageUp moves to previous page putting the cursor on top func (vm *LayerSetState) PageUp() bool { prevPageEndIndex := vm.viewStartIndex @@ -86,7 +85,7 @@ func (vm *LayerSetState) PageDown() bool { nextPageEndIndex = len(vm.Layers) - 1 vm.LayerIndex = nextPageEndIndex nextPageStartIndex = nextPageEndIndex - vm.viewHeight + 1 - if (nextPageStartIndex < 0) { + if nextPageStartIndex < 0 { return false } } @@ -96,7 +95,7 @@ func (vm *LayerSetState) PageDown() bool { if vm.LayerIndex < nextPageStartIndex { vm.LayerIndex = nextPageStartIndex } - + return true } @@ -114,11 +113,11 @@ func (vm *LayerSetState) CursorUp() bool { // doCursorDown performs the internal view's adjustments on cursor down. Note: this is independent of the gocui buffer. func (vm *LayerSetState) CursorDown() bool { - if vm.LayerIndex >= len(vm.Layers) - 1 { + if vm.LayerIndex >= len(vm.Layers)-1 { return false } vm.LayerIndex++ - if vm.LayerIndex >= vm.viewStartIndex + vm.viewHeight { + if vm.LayerIndex >= vm.viewStartIndex+vm.viewHeight { vm.viewStartIndex++ } return true @@ -157,7 +156,7 @@ func (vm *LayerSetState) Render() error { if idx < vm.viewStartIndex { continue } - if idx > vm.viewStartIndex + vm.viewHeight { + if idx > vm.viewStartIndex+vm.viewHeight { break } var layerStr string