Skip to content

Cannot backspace during interactive stdin #33

@glacials

Description

@glacials

Hi, thanks for all your hard work on gow! It is an amazingly simple tool and it has saved me so many development hours during the time that I've used it.

I have an issue where my program has an interactive flow where it prompts the user for input at certain points, and I'm trying to run this flow using gow when doing manual testing.

Everything works perfectly, except while inputting text I cannot backspace. See video:

Screen.Recording.2023-08-15.at.13.32.38.mov

I'm on macOS 13.5 and have tried this in iTerm and Terminal.app. As seen in the video it's not just visual, the text ultimately entered has whitespace added onto it instead of characters removed from it. Is this intentional?

Thanks for any help!

EDIT: For convenience, here's the code used in the screen recording:

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	fmt.Print("Enter some text: ")
	in := bufio.NewReader(os.Stdin)
	line, err := in.ReadString('\n')
	if err != nil {
		panic(fmt.Errorf("cannot read input: %w", err))
	}
	fmt.Println("You inputted:", line)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions