fix layer view curosr up/down

This commit is contained in:
chen 2023-05-02 13:56:49 +08:00 committed by Alex Goodman
parent 255e3c2ff7
commit c4b2723d97

View File

@ -2,6 +2,7 @@ package view
import (
"fmt"
"github.com/awesome-gocui/gocui"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
@ -195,8 +196,9 @@ func (v *Layer) PageUp() error {
// CursorDown moves the cursor down in the layer pane (selecting a higher layer).
func (v *Layer) CursorDown() error {
if v.vm.LayerIndex < len(v.vm.Layers) {
err := CursorDown(v.gui, v.body)
if v.vm.LayerIndex < len(v.vm.Layers)-1 {
// err := CursorDown(v.gui, v.view)
err := error(nil)
if err == nil {
return v.SetCursor(v.vm.LayerIndex + 1)
}
@ -207,7 +209,8 @@ func (v *Layer) CursorDown() error {
// CursorUp moves the cursor up in the layer pane (selecting a lower layer).
func (v *Layer) CursorUp() error {
if v.vm.LayerIndex > 0 {
err := CursorUp(v.gui, v.body)
// err := CursorUp(v.gui, v.view)
err := error(nil)
if err == nil {
return v.SetCursor(v.vm.LayerIndex - 1)
}