bugs fixed
This commit is contained in:
+6
-5
@@ -8,20 +8,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
width, h := osui.GetTerminalSize()
|
w, h := osui.GetTerminalSize()
|
||||||
paginator := ui.Paginator(
|
paginator := ui.Paginator(
|
||||||
ui.Div(
|
ui.Div(
|
||||||
ui.Text("Welcome to the example! Press tab to go to the next page or press shift + tab to go to a previous page"),
|
ui.Text("Welcome to the example! Press tab to go to the next page or press shift + tab to go to a previous page"),
|
||||||
),
|
),
|
||||||
ui.Div(
|
ui.Div(
|
||||||
cutils.WithPosition((width-30)/2, (h-4)/2,
|
cutils.WithPosition(0, 0, ui.Text("This blue square is a div. A div stores multiple components into one. To navigate to each of those components you can use arrow keys ↑↓")),
|
||||||
|
cutils.WithPosition((w-30)/2, (h-4)/2,
|
||||||
cutils.WithSize(30, 4,
|
cutils.WithSize(30, 4,
|
||||||
cutils.WithStyle(&ui.DivStyle{Background: colors.Blue, Foreground: colors.Red},
|
cutils.WithStyle(&ui.DivStyle{Background: colors.Blue, Foreground: colors.Red},
|
||||||
ui.Div(cutils.WithPosition(0, 0, ui.Text("This is a test!"))),
|
ui.Div(cutils.WithPosition(0, 0, ui.Text("Hello, World!"))),
|
||||||
)))),
|
)))),
|
||||||
ui.Div(
|
ui.Div(
|
||||||
cutils.WithPosition(26, 2, ui.Text("This is a InputBox. It takes user input just like a GUI")),
|
cutils.WithPosition(0, 0, ui.Text("This is a InputBox. It takes user input just like a GUI. "+colors.Red+colors.Bold+"NOTE: This InputBox is inside a div")),
|
||||||
cutils.WithPosition(0, 1, ui.InputBox(20)),
|
cutils.WithPosition((w-32)/2, (h-3)/2, ui.InputBox(30)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
screen := osui.NewScreen(paginator)
|
screen := osui.NewScreen(paginator)
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ func (s InputBoxComponent) Render() string {
|
|||||||
" %s\n%s│%s%s\n %s",
|
" %s\n%s│%s%s\n %s",
|
||||||
colors.Reset+s.Style.Outline+strings.Repeat("_", int(s.max_size))+colors.Reset,
|
colors.Reset+s.Style.Outline+strings.Repeat("_", int(s.max_size))+colors.Reset,
|
||||||
colors.Reset+s.Style.Outline,
|
colors.Reset+s.Style.Outline,
|
||||||
colors.Combine(s.Style.Foreground, s.Style.Background)+s.InputData+osui.LogicValue(s.Data.IsActive, s.Style.Cursor+"█"+colors.Reset+colors.Reset, colors.Reset+s.Style.Outline+"|"+colors.Reset),
|
colors.Combine(s.Style.Foreground, s.Style.Background)+s.InputData+osui.LogicValue(s.Data.IsActive, s.Style.Cursor+"█"+colors.Reset, s.Style.Outline+"|"+colors.Reset),
|
||||||
colors.Reset+s.Data.DefaultColor,
|
colors.Reset+s.Data.DefaultColor,
|
||||||
colors.Reset+s.Style.Outline+strings.Repeat("‾", int(s.max_size))+colors.Reset+s.Data.DefaultColor,
|
colors.Reset+s.Style.Outline+strings.Repeat("‾", int(s.max_size))+colors.Reset+s.Data.DefaultColor,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user