bug fix (There is a small bug on inputBox again)

This commit is contained in:
2024-09-27 14:38:39 +02:00
parent 3b2ff24c1f
commit cf93b3383f
7 changed files with 83 additions and 89 deletions
+5 -5
View File
@@ -6,6 +6,7 @@ import (
"github.com/orus-dev/osui"
"github.com/orus-dev/osui/colors"
"github.com/orus-dev/osui/isKey"
)
type PaginatorStyle struct {
@@ -55,23 +56,22 @@ func (p *PaginatorComponent) Render() string {
}
func (p *PaginatorComponent) Update(key string) bool {
switch key {
case "\x1b[Z":
if key == "\x1b[Z" {
if p.ActiveComponent > 0 {
p.updateActive(p.ActiveComponent - 1)
} else {
p.updateActive(len(p.Components) - 1)
}
case osui.Key.Tab:
} else if isKey.Tab(key) {
if p.ActiveComponent < len(p.Components)-1 {
p.updateActive(p.ActiveComponent + 1)
} else {
p.updateActive(0)
}
case osui.Key.Escape:
} else if isKey.Escape(key) {
fmt.Print("\n\n")
return true
default:
} else {
if len(p.Components) > 0 {
p.Components[p.ActiveComponent].GetComponentData().IsActive = p.Data.IsActive
if p.Components[p.ActiveComponent].Update(key) {