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