diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index 18300e1418be3..ebf06281d3264 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -218,20 +218,22 @@ export class FilesRenderer implements ITreeRenderer 0 && !stat.isDirectory ? lastDot : value.length }); - const done = once(async (success: boolean) => { + const done = once(async (success: boolean, finishEditing: boolean) => { label.element.style.display = 'none'; const value = inputBox.value; dispose(toDispose); container.removeChild(label.element); - // Timeout: once done rendering only then re-render #70902 - setTimeout(() => editableData.onFinish(value, success), 0); + if (finishEditing) { + // Timeout: once done rendering only then re-render #70902 + setTimeout(() => editableData.onFinish(value, success), 0); + } }); let ignoreDisposeAndBlur = true; setTimeout(() => ignoreDisposeAndBlur = false, 100); const blurDisposable = DOM.addDisposableListener(inputBox.inputElement, DOM.EventType.BLUR, () => { if (!ignoreDisposeAndBlur) { - done(inputBox.isInputValid()); + done(inputBox.isInputValid(), true); } }); @@ -240,10 +242,10 @@ export class FilesRenderer implements ITreeRenderer { if (e.equals(KeyCode.Enter)) { if (inputBox.validate()) { - done(true); + done(true, true); } } else if (e.equals(KeyCode.Escape)) { - done(false); + done(false, true); } }), blurDisposable, @@ -252,10 +254,8 @@ export class FilesRenderer implements ITreeRenderer { - if (!ignoreDisposeAndBlur) { - blurDisposable.dispose(); - done(false); - } + blurDisposable.dispose(); + done(false, false); }); }