fix(forge): ne plus ecraser une completion acceptee au Tab (BUG-055)
This commit is contained in:
@@ -575,7 +575,11 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
||||
body: JSON.stringify({ content: content })
|
||||
}).then(function(r) {
|
||||
if (!r.ok) throw new Error(r.status);
|
||||
isDirty = false; originalContent = content;
|
||||
originalContent = content;
|
||||
// BUG-055 — edits typed while the save was in flight are newer than the
|
||||
// disk: stay dirty (and save again) so a later SSE reload can't drop them.
|
||||
if (val() !== content) { scheduleAutoSave(); return; }
|
||||
isDirty = false;
|
||||
saveDot.className = 'save-dot ok'; saveLabel.textContent = 'Saved';
|
||||
}).catch(function(e) {
|
||||
saveDot.className = 'save-dot err'; saveLabel.textContent = 'Erreur';
|
||||
@@ -1461,6 +1465,11 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
||||
// and drop the stale local buffer that would otherwise be autosaved back
|
||||
// over the assistant's change.
|
||||
if (e.data.type === 'parent-reload') {
|
||||
// #93/BUG-055 — the SSE `index_updated` broadcast is often caused by this
|
||||
// editor's own autosave. Reloading from disk then would clobber edits made
|
||||
// after the save (e.g. a Tab completion accepted in the meantime). Only an
|
||||
// external write (AI assistant) forces the reload past unsaved changes.
|
||||
if (!e.data.force && isDirty) return;
|
||||
clearTimeout(saveTimer);
|
||||
isDirty = false;
|
||||
loadFile();
|
||||
@@ -1875,6 +1884,7 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
||||
|
||||
function acceptGhost() {
|
||||
if (!_ghostText) return;
|
||||
if (_ghostTimer) { clearTimeout(_ghostTimer); _ghostTimer = null; }
|
||||
var start = ta.selectionStart;
|
||||
var before = ta.value.slice(0, start);
|
||||
var after = ta.value.slice(start);
|
||||
|
||||
Reference in New Issue
Block a user