go fmt ui/*
This commit is contained in:
@ -152,11 +152,11 @@ func (c *TabContainer) FocusTab(idx int) {
|
|||||||
if idx < 0 {
|
if idx < 0 {
|
||||||
idx = 0
|
idx = 0
|
||||||
} else if idx >= len(c.children) {
|
} else if idx >= len(c.children) {
|
||||||
idx = len(c.children)-1
|
idx = len(c.children) - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
c.children[c.selected].Child.SetFocused(false) // Unfocus old tab
|
c.children[c.selected].Child.SetFocused(false) // Unfocus old tab
|
||||||
c.children[idx].Child.SetFocused(true) // Focus new tab
|
c.children[idx].Child.SetFocused(true) // Focus new tab
|
||||||
c.selected = idx
|
c.selected = idx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,17 +56,17 @@ func (f *InputField) Delete(forward bool) {
|
|||||||
if f.cursorPos < len(f.Text) { // If the cursor is not at the very end (past text)...
|
if f.cursorPos < len(f.Text) { // If the cursor is not at the very end (past text)...
|
||||||
lineRunes := []rune(f.Text)
|
lineRunes := []rune(f.Text)
|
||||||
copy(lineRunes[f.cursorPos:], lineRunes[f.cursorPos+1:]) // Shift characters after cursor left
|
copy(lineRunes[f.cursorPos:], lineRunes[f.cursorPos+1:]) // Shift characters after cursor left
|
||||||
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line
|
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line
|
||||||
f.Text = string(lineRunes) // Update line with new runes
|
f.Text = string(lineRunes) // Update line with new runes
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if f.cursorPos > 0 { // If the cursor is not at the beginning...
|
if f.cursorPos > 0 { // If the cursor is not at the beginning...
|
||||||
lineRunes := []rune(f.Text)
|
lineRunes := []rune(f.Text)
|
||||||
copy(lineRunes[f.cursorPos-1:], lineRunes[f.cursorPos:]) // Shift characters at cursor left
|
copy(lineRunes[f.cursorPos-1:], lineRunes[f.cursorPos:]) // Shift characters at cursor left
|
||||||
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line length
|
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line length
|
||||||
f.Text = string(lineRunes) // Update line with new runes
|
f.Text = string(lineRunes) // Update line with new runes
|
||||||
|
|
||||||
f.SetCursorPos(f.cursorPos-1) // Move cursor back
|
f.SetCursorPos(f.cursorPos - 1) // Move cursor back
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@ type Menu struct {
|
|||||||
Visible bool // True when focused
|
Visible bool // True when focused
|
||||||
|
|
||||||
x, y int
|
x, y int
|
||||||
width, height int // Size may not be settable
|
width, height int // Size may not be settable
|
||||||
selected int // Index of selected Item
|
selected int // Index of selected Item
|
||||||
itemSelectedCallback func() // Used internally to hide menus on selection
|
itemSelectedCallback func() // Used internally to hide menus on selection
|
||||||
|
|
||||||
Theme *Theme
|
Theme *Theme
|
||||||
|
Reference in New Issue
Block a user