nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Escape offers to "clear" an already-empty input box

Open addyCooks opened this issue 2 months ago • 2 comments

Description

Pressing Escape always shows a "Press escape again to clear" hint, even when the composer is already empty with no attachments there's nothing to clear.

Parent: #907

Steps to Reproduce

  1. Start Nanocoder with a fresh, empty composer.
  2. Press Escape once.

Expected Behavior

Nothing happens, or at least no hint about clearing appears, since there's no content to clear.

Actual Behavior

"Press escape again to clear" appears under the empty composer regardless.

Recording

Image

Root Cause

source/components/user-input.tsx:648-668, handleEscape:

const handleEscape = useCallback(() => {
	if (showCompletions) { ... return; }
	if (isFileAutocompleteMode) { ... return; }
	if (showClearMessage) {
		resetInput();
		...
	} else {
		setShowClearMessage(true);
	}
}, [...]);

No branch checks whether input (or attachments) is actually non-empty before calling setShowClearMessage(true).

Suggested Fix

Skip showing the clear-hint (and just no-op) when the input is already empty and there are no attachments.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs on the latest main

addyCooks avatar Sep 22 '26 08:09 addyCooks

hi @akramcodez, could you assign this to me?

addyCooks avatar Sep 22 '26 08:09 addyCooks

Picking this up - a fix will follow shortly.

awhite0030 avatar Sep 22 '26 09:09 awhite0030