fix(files-editor): reset language dropdown on every modal open
Without this, a user who picked a manual override (e.g. "Bash") on
one open would see the stale selection on the next open while the
editor itself silently re-derived from the filename via
setEditorContent's setLanguage("auto") call. The displayed dropdown
would lie about the active language.
Additionally, the existing filename-input handler's
"if (languageSelect.value === 'auto') re-derive" check was effectively
disabled whenever the user had previously picked an override —
renaming the file wouldn't re-derive even though the active language
was already auto.
Addresses Important #1 from the Task 10 code review.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3c882e020c
commit
8e8a3aeb3e
1 changed files with 10 additions and 0 deletions
|
|
@ -349,6 +349,13 @@
|
|||
editor.folder = folder;
|
||||
editor.queuedReplacement = null;
|
||||
|
||||
// Reset the language dropdown to "auto" on every modal open so the
|
||||
// displayed value matches what setEditorContent does internally
|
||||
// (which always calls setLanguage("auto")). Without this, a user
|
||||
// who picked a manual override on a previous open would see the
|
||||
// stale selection while the editor language follows the new file.
|
||||
if (languageSelect) languageSelect.value = "auto";
|
||||
|
||||
setEditorTitle(`${folder ? folder + "/" : ""}…new file`);
|
||||
editorEls.filename.value = "";
|
||||
editorEls.filename.disabled = false;
|
||||
|
|
@ -373,6 +380,9 @@
|
|||
editor.queuedReplacement = null;
|
||||
setQueuedReplacement(null);
|
||||
|
||||
// Reset the language dropdown — see openEditorTextNew for rationale.
|
||||
if (languageSelect) languageSelect.value = "auto";
|
||||
|
||||
editorEls.filename.value = basename(path);
|
||||
editorEls.filename.disabled = false;
|
||||
editorEls.renameHint.hidden = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue