forked from eklairs/tlock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tlock: Rework form widget implementation
- Loading branch information
Showing
4 changed files
with
287 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package form | ||
|
||
import tea "github.com/charmbracelet/bubbletea" | ||
|
||
// Interface that every form item must implement | ||
// Form item | ||
type FormItem interface { | ||
// Handle messages | ||
Update(msg tea.Msg) tea.Cmd | ||
|
||
// View | ||
View() string | ||
|
||
// Focus | ||
Focus() | ||
|
||
// Unfocus | ||
Unfocus() | ||
|
||
// Returns the value | ||
Value() string | ||
|
||
// Sets the error message | ||
// Nil means to remove the error | ||
SetError(err *error) | ||
|
||
// Returns if the focus should go to the next item | ||
// Useful for groupping | ||
ShouldGoNext() bool | ||
|
||
// Returns if the focus should go to the next item | ||
// Useful for groupping | ||
ShouldGoPrev() bool | ||
} |
Oops, something went wrong.