git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git_getpass regression?

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Jun 29, 2012, 10:06 UTC
Message-ID
<CABPQNSa4uvgijjGCSJDXDMqHC3UkqQKKujG3xDFqnQ13LNrKdQ@mail.gmail.com>

Since 9b4b894 ("Makefile: linux has /dev/tty", 2011-12-10) we're reading input from the terminal using strbuf_getline instead of getpass. But at least on my linux-box, getpass treats the backspace-key ('\b') as an actual deletion. strbuf_getline obviously shouldn't do this, as it's a utility function. But I think as a user-interface feature, it would be much more pleasant to be allowed to edit the entered text ;)

I can't find anything in POSIX that standardize this behavior, but for most text-input use-cases it's probably what the user intended.

I guess this is technically a regression, but probably not a very important one.
I think we have multiple possible solutions:
 1) Read a character at the time, and special-case '\r' to erase the
previously entered character.
 2) Post-process the strbuf to explicitly perform the erasing.
 3) Do nothing.

I'm in favor of 2) because I'm a Windows-user, and we never had the erasing-behavior to begin with. And it's a nice feature, so we could make the post-processing a function that can be reusable by the Windows-version of git_terminal_prompt. We could even use it on the plain getpass-fallback, to unify the user-experience across platforms.

We can probably also be do 1) in a reusable form by adding some kind of on_char-callback, but it's probably something that'd end up more confusing than than the alternative.

Thoughts?
Next: Jeff King
Message 1 of 10 in “git_getpass regression?”
  1. Erik Faye-LundJun 29, 2012
  2. Jeff KingJun 29, 2012
  3. Jeff KingJun 29, 2012
  4. Erik Faye-LundJun 30, 2012
  5. Jeff KingJun 30, 2012
  6. Erik Faye-LundJul 3, 2012
  7. Jeff KingJul 3, 2012
  8. Erik Faye-LundJul 3, 2012
  9. Junio C HamanoJul 18, 2012
  10. Erik Faye-LundJul 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.