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

@ -33,12 +33,14 @@ 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
@ -99,6 +105,8 @@ func CreateMenu(options ...SimpleMenuOption) *Menu {
return &Menu{ return &Menu{
Title: conf.Title, Title: conf.Title,
BackKey: conf.BackKey, BackKey: conf.BackKey,
usingEscapeCodes: conf.UsingEscapeCodes,
lineCounter: 0,
counterForIDs: 1, counterForIDs: 1,
cmdTree: createCommandTree(), cmdTree: createCommandTree(),
} }