aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJulien Dessaux2021-01-18 11:58:16 +0100
committerJulien Dessaux2021-01-18 11:58:16 +0100
commit9abea6a4ef590e55efca82570e41754d76a72cc8 (patch)
treece54788b8e94bd833dc37e25338a2a86baf49555 /client
parentRemoved extra \n after clear screen sequence (diff)
downloadshell-game-launcher-9abea6a4ef590e55efca82570e41754d76a72cc8.tar.gz
shell-game-launcher-9abea6a4ef590e55efca82570e41754d76a72cc8.tar.bz2
shell-game-launcher-9abea6a4ef590e55efca82570e41754d76a72cc8.zip
Removed needlessly complex menu display offset settings
Diffstat (limited to '')
-rw-r--r--client/menu.go13
-rw-r--r--client/menu_test.go8
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()