From 6201774a15c9cc787c3fdb46926281fd3db70f5d Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 8 Jan 2026 21:46:19 -0500 Subject: [PATCH] Do not automatically prepend new line to input function prompts --- front/input.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/front/input.go b/front/input.go index b1dc1c3..5e07ecf 100644 --- a/front/input.go +++ b/front/input.go @@ -11,7 +11,7 @@ import ( // Input prompts the user for input and returns the input as a string. func Input(prompt string) string { - fmt.Print("\n" + prompt + " ") + fmt.Print(prompt + " ") reader := bufio.NewReader(os.Stdin) userInput, _ := reader.ReadString('\n') return strings.TrimRight(userInput, "\n\r ") // remove trailing newlines, carriage returns, and spaces @@ -19,7 +19,7 @@ func Input(prompt string) string { // InputHidden prompts the user for input and returns the input as a byte array, hiding the input from the terminal. func InputHidden(prompt string) []byte { - fmt.Print("\n" + prompt + " ") + fmt.Print(prompt + " ") byteInput, _ := term.ReadPassword(int(os.Stdin.Fd())) fmt.Println() return byteInput @@ -28,7 +28,7 @@ func InputHidden(prompt string) []byte { // InputBinary prompts the user with a yes/no question and returns the response as a boolean. func InputBinary(prompt string) bool { reader := bufio.NewReader(os.Stdin) - fmt.Print("\n" + prompt + " (y/N) ") + fmt.Print(prompt + " (y/N) ") char, _, _ := reader.ReadRune() if char == 'y' || char == 'Y' { return true @@ -40,7 +40,7 @@ func InputBinary(prompt string) bool { // A negative min/max value will disable the respective limit. func InputInt(prompt string, min, max int) int { for { - fmt.Print("\n" + prompt + " ") + fmt.Print(prompt + " ") var userInput int _, err := fmt.Scanln(&userInput) if err == nil && (userInput >= min || min < 0) && (userInput <= max || max < 0) {