Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Cursor is sometimes not going back to the start of the line #334

Closed
PierreBtz opened this issue Feb 12, 2021 · 3 comments
Closed

Cursor is sometimes not going back to the start of the line #334

PierreBtz opened this issue Feb 12, 2021 · 3 comments
Labels

Comments

@PierreBtz
Copy link
Contributor

What operating system and terminal are you using?

macOS Big Sur 11.0.1 with iterm2

An example that showcases the bug.

package main

import (
	"fmt"
	"github.com/AlecAivazis/survey/v2"
)

func main() {
	prompt := &survey.Password{
		Message: "password",
	}
	var pass string
	_ = survey.AskOne(prompt, &pass)

	fmt.Print("hello")
}

When running this sample, one can see that after the prompt the cursor stays aligned with the previous prompt text:

Screenshot 2021-02-12 at 16 10 10

What did you expect to see?

The cursor is going back to the beginning of the line.

I tracked the issue to PR #309. I re-ran the previous test by adding a call to c.HorizontalAbsolute(0) (like it's done for Windows) and confirmed this was fixing my issue.

@davidji99
Copy link

I'm experiencing the same sort of issue where multiple outputs creates a staircase effect as mentioned by the OP.

@AlecAivazis
Copy link
Owner

@PierreBtz - do you mind opening a PR with your fix? I would like to give it a shot but I dont have a lot of time at the moment

@PierreBtz
Copy link
Contributor Author

@AlecAivazis I opened #335

PierreBtz added a commit to PierreBtz/survey that referenced this issue Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants