Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Commit e8135f2

Browse files
Radosław Stachowiakampagent
andcommitted
Make ESC clear password field instead of canceling prompt
Change the behavior of the ESC key to clear the password input field (similar to Ctrl-U) instead of immediately canceling the authentication prompt. This provides better UX - users who accidentally start typing their password can press ESC to clear it and try again, rather than having the prompt close. Users can still cancel the prompt by waiting for the timeout, and the previous commit ensures timeout/cancellation won't count as a failed login attempt. Related to #114 Amp-Thread-ID: https://ampcode.com/threads/T-60336806-26ca-40b3-bb77-86a913f74a0c Co-authored-by: Amp <amp@ampcode.com>
1 parent 2273798 commit e8135f2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

helpers/auth_x11.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,8 +1306,14 @@ int Prompt(const char *msg, char **response, int echo) {
13061306
BumpDisplayMarker(priv.pwlen, &priv.displaymarker,
13071307
&priv.last_keystroke);
13081308
break;
1309-
case 0: // Shouldn't happen.
13101309
case '\033': // Escape.
1310+
// Clear the input line (like Ctrl-U). User can still press ESC
1311+
// again or wait for timeout to cancel the prompt entirely.
1312+
priv.pwlen = 0;
1313+
BumpDisplayMarker(priv.pwlen, &priv.displaymarker,
1314+
&priv.last_keystroke);
1315+
break;
1316+
case 0: // Shouldn't happen.
13111317
done = 1;
13121318
break;
13131319
case '\r': // Return.

0 commit comments

Comments
 (0)