From e505fb654bf5318713e3979abd61a626ce61e5f1 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Fri, 18 Oct 2024 07:25:56 +0300 Subject: [PATCH] Add Menu.clearLines() func --- simple/menu.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simple/menu.go b/simple/menu.go index 2c0e9cf..9b9e9d0 100644 --- a/simple/menu.go +++ b/simple/menu.go @@ -158,6 +158,13 @@ func (m *Menu) AddCommand(key, name string, action CommandAction) (*commandNode, return m.cmdTree.Root.AddCommand(key, name, action), nil } +func (m *Menu) clearLines() { + for i := 0; i < int(m.lineCounter); i++ { + fmt.Printf("\033[F\033[K") + } + m.lineCounter = 0 +} + func (m *Menu) iteration() { fmt.Printf("%s\n", m.Title) path := ""