diff options
Diffstat (limited to '')
-rw-r--r-- | client/menu.go | 13 | ||||
-rw-r--r-- | client/menu_test.go | 8 |
2 files changed, 5 insertions, 16 deletions
diff --git a/client/menu.go b/client/menu.go index d20b7d0..19c8992 100644 --- a/client/menu.go +++ b/client/menu.go @@ -5,17 +5,8 @@ import "fmt" func (s *State) displayMenu() { menu := s.config.Menus[s.currentMenu] fmt.Print("\033[2J") // clear the screen - fmt.Println(menu.Banner) - output := "" - prefix := "" - for i := 0; i < menu.XOffset; i++ { - prefix += " " - } - for i := 0; i < menu.YOffset; i++ { - output += "\n" - } - fmt.Printf("%s", output) + fmt.Printf("%s\n\n", menu.Banner) for i := 0; i < len(menu.MenuEntries); i++ { - fmt.Printf("%s%s) %s\n", prefix, menu.MenuEntries[i].Key, menu.MenuEntries[i].Label) + fmt.Printf("%s) %s\n", menu.MenuEntries[i].Key, menu.MenuEntries[i].Label) } } diff --git a/client/menu_test.go b/client/menu_test.go index 224b242..aaf3d81 100644 --- a/client/menu_test.go +++ b/client/menu_test.go @@ -19,9 +19,7 @@ func TestDisplayMenu(t *testing.T) { config: &config.Config{ Menus: map[string]config.Menu{ "test": config.Menu{ - Banner: "TEST TEST TEST", - XOffset: 5, - YOffset: 3, + Banner: "TEST TEST TEST", MenuEntries: []config.MenuEntry{ config.MenuEntry{ Key: "q", @@ -37,8 +35,8 @@ func TestDisplayMenu(t *testing.T) { } want := []byte("\033[2J" + "TEST TEST TEST\n" + - "\n\n\n" + - " q) quit\n") + "\n" + + "q) quit\n") state.displayMenu() // back to normal state w.Close() |