mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Augment with some descriptive comments
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
		
							parent
							
								
									d6c8e08c2f
								
							
						
					
					
						commit
						23dc1c5058
					
				@ -9,6 +9,7 @@ import (
 | 
				
			|||||||
	"github.com/wtfutil/wtf/wtf"
 | 
						"github.com/wtfutil/wtf/wtf"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FocusState is a custom type that differentiates focusable scopes
 | 
				
			||||||
type FocusState int
 | 
					type FocusState int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const (
 | 
					const (
 | 
				
			||||||
@ -28,6 +29,7 @@ type FocusTracker struct {
 | 
				
			|||||||
	tviewApp *tview.Application
 | 
						tviewApp *tview.Application
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NewFocusTracker creates and returns an instance of FocusTracker
 | 
				
			||||||
func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker {
 | 
					func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker {
 | 
				
			||||||
	focusTracker := FocusTracker{
 | 
						focusTracker := FocusTracker{
 | 
				
			||||||
		tviewApp:  tviewApp,
 | 
							tviewApp:  tviewApp,
 | 
				
			||||||
@ -45,6 +47,7 @@ func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* -------------------- Exported Functions -------------------- */
 | 
					/* -------------------- Exported Functions -------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FocusOn puts the focus on the item that belongs to the focus character passed in
 | 
				
			||||||
func (tracker *FocusTracker) FocusOn(char string) bool {
 | 
					func (tracker *FocusTracker) FocusOn(char string) bool {
 | 
				
			||||||
	if !tracker.useNavShortcuts() {
 | 
						if !tracker.useNavShortcuts() {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
@ -108,6 +111,7 @@ func (tracker *FocusTracker) Prev() {
 | 
				
			|||||||
	tracker.IsFocused = true
 | 
						tracker.IsFocused = true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Refocus forces the focus back to the currently-selected item
 | 
				
			||||||
func (tracker *FocusTracker) Refocus() {
 | 
					func (tracker *FocusTracker) Refocus() {
 | 
				
			||||||
	tracker.focus(tracker.Idx)
 | 
						tracker.focus(tracker.Idx)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -9,6 +9,7 @@ import (
 | 
				
			|||||||
	"github.com/wtfutil/wtf/wtf"
 | 
						"github.com/wtfutil/wtf/wtf"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ModuleValidator is responsible for validating the state of a module's configuration
 | 
				
			||||||
type ModuleValidator struct{}
 | 
					type ModuleValidator struct{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type widgetError struct {
 | 
					type widgetError struct {
 | 
				
			||||||
@ -16,6 +17,7 @@ type widgetError struct {
 | 
				
			|||||||
	validationErrors []cfg.Validatable
 | 
						validationErrors []cfg.Validatable
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// NewModuleValidator creates and returns an instance of ModuleValidator
 | 
				
			||||||
func NewModuleValidator() *ModuleValidator {
 | 
					func NewModuleValidator() *ModuleValidator {
 | 
				
			||||||
	return &ModuleValidator{}
 | 
						return &ModuleValidator{}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user