mitranim / mitranim/gow

Cannot backspace during interactive stdin

Open
#33 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
906
Forks
29
PR merge metrics
No merged PRs in 30d

Description

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:

https://github.com/mitranim/gow/assets/438911/56bcdbfb-a14f-44f0-82be-bbaa9b79cfdd

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)
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided Go program run through gow, using a terminal where backspace works normally. Then trace how gow forwards interactive stdin and terminal input. Done means backspace visibly removes characters and the resulting line contains no whitespace for deleted characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.