Skip to content

Commit

Permalink
Revert "Merge pull request microsoft#75695 from orange4glace/master"
Browse files Browse the repository at this point in the history
This reverts commit 28ab9ad, reversing
changes made to 912ad66.
  • Loading branch information
isidorn committed Jun 19, 2019
1 parent b634152 commit a05e05c
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,40 +218,33 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
const lastDot = value.lastIndexOf('.');

inputBox.value = value;
inputBox.focus();
inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length });

let isFinishableDisposeEvent = false;
setTimeout(() => {
// Check if disposed
if (!inputBox.inputElement) {
return;
}
inputBox.focus();
inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length });
isFinishableDisposeEvent = true;
}, 0);

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);
}
});

const blurDisposable = DOM.addDisposableListener(inputBox.inputElement, DOM.EventType.BLUR, () => {
done(inputBox.isInputValid());
done(inputBox.isInputValid(), true);
});

const toDispose = [
inputBox,
DOM.addStandardDisposableListener(inputBox.inputElement, DOM.EventType.KEY_DOWN, (e: IKeyboardEvent) => {
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,
Expand All @@ -260,12 +253,8 @@ export class FilesRenderer implements ITreeRenderer<ExplorerItem, FuzzyScore, IF
];

return toDisposable(() => {
if (isFinishableDisposeEvent) {
done(false);
}
else {
dispose(toDispose);
}
blurDisposable.dispose();
done(false, false);
});
}

Expand Down

0 comments on commit a05e05c

Please sign in to comment.