Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockCursor is broken on macOS #197

Open
synfinatic opened this issue Dec 16, 2021 · 3 comments
Open

BlockCursor is broken on macOS #197

synfinatic opened this issue Dec 16, 2021 · 3 comments

Comments

@synfinatic
Copy link

Tested with both iTerm2 3.4.12 and Terminal 2.10 on macOS 10.15.7 with promptui 0.9.0 and Go 1.17.5

using:

	prompt := promptui.Prompt{
		Label:    "SSO Instance Name (DefaultSSO)",
		Validate: validateSSOName,
		Default: "Default",
		Pointer:  promptui.BlockCursor,
	}

Generates the following prompt:

SSO Instance Name (DefaultSSO): \e[7mD\e[0mefault

DefaultCursor is very painful when there is a default value since it obscures the first character, so right now that only leaves PipeCursor which is very hard to see and seems very non-standard.

@lazdmx
Copy link

lazdmx commented Feb 7, 2022

I think that the solution to the problem may be to set the course for the last character of the default value. I would say that this is the most natural behavior for an input field across other UIs.

@i9
Copy link

i9 commented May 19, 2022

I ran into similar issue cursor blocking default value and found #146

set AllowEdit: true will move cursor to the end of default value

@patrikhson
Copy link

The problem is that the escape code for ESC must be \x1b and not as is done today in cursor.go.

A fixed blockCursor is:

func blockCursor(input []rune) []rune {
  return []rune(fmt.Sprintf("\x1b[7m%s\x1b[0m", string(input)))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants