Add UsingEscapeCodes to Menu and MenuConfig

This commit is contained in:
qowevisa 2024-10-18 07:22:28 +03:00
parent e07cdfdfde
commit c84bed67cf

View File

@ -31,14 +31,16 @@ func (c *Command) Print() {
} }
type MenuConfig struct { type MenuConfig struct {
Title string Title string
BackKey string BackKey string
UsingEscapeCodes bool
} }
func getDefConfig() *MenuConfig { func getDefConfig() *MenuConfig {
return &MenuConfig{ return &MenuConfig{
Title: "Default Menu Title", Title: "Default Menu Title",
BackKey: "<", BackKey: "<",
UsingEscapeCodes: false,
} }
} }
@ -84,6 +86,10 @@ func createCommandTree() *commandTree {
type Menu struct { type Menu struct {
Title string Title string
BackKey string BackKey string
// Escape Code part
//
usingEscapeCodes bool
lineCounter uint
// //
counterForIDs uint counterForIDs uint
cmdTree *commandTree cmdTree *commandTree
@ -97,10 +103,12 @@ func CreateMenu(options ...SimpleMenuOption) *Menu {
} }
return &Menu{ return &Menu{
Title: conf.Title, Title: conf.Title,
BackKey: conf.BackKey, BackKey: conf.BackKey,
counterForIDs: 1, usingEscapeCodes: conf.UsingEscapeCodes,
cmdTree: createCommandTree(), lineCounter: 0,
counterForIDs: 1,
cmdTree: createCommandTree(),
} }
} }