Skip to content

Add Esc-Esc to clear prompt when it's not empty#17131

Merged
Adib234 merged 10 commits into
mainfrom
adibakm/esc-esc-clear
Jan 21, 2026
Merged

Add Esc-Esc to clear prompt when it's not empty#17131
Adib234 merged 10 commits into
mainfrom
adibakm/esc-esc-clear

Conversation

@Adib234

@Adib234 Adib234 commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Summary

As title suggests

Details

Decision was made during UX meeting

Related Issues

How to Validate

If you write text in the prompt and press Esc-Esc it should clear it. If the prompt is empty and you run Esc-Esc then it should run the slash command /rewind

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@Adib234 Adib234 requested review from a team as code owners January 20, 2026 21:14
@Adib234 Adib234 self-assigned this Jan 20, 2026
@gemini-code-assist

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown

Size Change: +461 B (0%)

Total Size: 23.2 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.2 MB +461 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@jackwotherspoon

Copy link
Copy Markdown
Collaborator

do we want both Ctrl+C and Esc-esc to clear input?

@gemini-cli gemini-cli Bot added the priority/p1 Important and should be addressed in the near term. label Jan 20, 2026
@Adib234

Adib234 commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

do we want both Ctrl+C and Esc-esc to clear input?

yep!

@Adib234 Adib234 changed the title Replace Ctrl-C with Esc-Esc to clear prompt when it's not empty Add Esc-Esc to clear prompt when it's not empty Jan 20, 2026
// Second ESC
resetEscapeState();
onSubmit('/rewind');
if (keyMatchers[Command.ESCAPE](key) && buffer.text.length > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do we check for the escape key press for the if case but not the else case? Would think both should be the same except for the buffer.text.length check

@Adib234 Adib234 Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added check in else case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert both these checks for
keyMatchersCommand.ESCAPE
as line 453 is already checking that they key is escape so this just makes the logic confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed check

const isPromptEmpty = uiState.buffer.text.length === 0;
return (
<Text color={theme.text.secondary}>
Press Esc again to {isPromptEmpty ? 'rewind' : 'clear prompt'}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not show either message if there is no history to rewind yet.

@Adib234 Adib234 Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added check for history first

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I wasn't clear. I mean we should not show either if their is no history and the message is empty.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated check for not showing any toast when prompt is empty and there's no history

Comment thread packages/cli/src/ui/components/InputPrompt.tsx Outdated
Comment thread packages/cli/src/ui/components/StatusDisplay.test.tsx
Comment thread packages/cli/src/ui/components/InputPrompt.test.tsx Outdated

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after these comments are addressed

@Adib234 Adib234 enabled auto-merge January 20, 2026 23:50
buffer.setText('');
resetCompletionState();
} else if (keyMatchers[Command.ESCAPE](key)) {
} else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: avoid double nesting. this can just be else if (...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will address in this PR #15720

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged. Thank you for addressing this in a follow-up PR.

@jacob314 jacob314 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Adib234 Adib234 disabled auto-merge January 20, 2026 23:57
@Adib234 Adib234 added this pull request to the merge queue Jan 21, 2026
Merged via the queue into main with commit e1fd5be Jan 21, 2026
25 checks passed
@Adib234 Adib234 deleted the adibakm/esc-esc-clear branch January 21, 2026 00:44
@SandyTao520

Copy link
Copy Markdown
Contributor

/patch preview

@github-actions

Copy link
Copy Markdown

Patch workflow(s) dispatched successfully!

📋 Details:

  • Channels: preview
  • Commit: e1fd5be429a2a2e8b416c77d346e9deef6456f06
  • Workflows Created: 1

🔗 Track Progress:

github-actions Bot pushed a commit that referenced this pull request Jan 21, 2026
# Conflicts:
#	docs/cli/keyboard-shortcuts.md
#	packages/cli/src/ui/components/InputPrompt.test.tsx
#	packages/cli/src/ui/components/InputPrompt.tsx
#	packages/cli/src/ui/components/StatusDisplay.tsx
#	packages/cli/src/ui/components/__snapshots__/StatusDisplay.test.tsx.snap
@github-actions

Copy link
Copy Markdown

🚀 Patch PR Created!

📋 Patch Details:

📝 Next Steps:

  1. ⚠️ Resolve conflicts in the hotfix PR first: #17165
  2. Test your changes after resolving conflicts
  3. Once merged, the patch release will automatically trigger
  4. You'll receive updates here when the release completes

🔗 Track Progress:

Thomas-Shephard pushed a commit to Thomas-Shephard/gemini-cli that referenced this pull request Jan 21, 2026
thacio added a commit to thacio/auditaria that referenced this pull request Jan 24, 2026
kuishou68 pushed a commit to iOfficeAI/gemini-cli-pro that referenced this pull request Feb 27, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1 Important and should be addressed in the near term. size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants