Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export async function select({
preview(true);
}
}
}, 100);
}, 50);
} else {
setTimeout(() => {
// When going into a directory, position at first line
Expand All @@ -194,7 +194,7 @@ export async function select({
if (getPreviewState().previewEnabled) {
preview(true);
}
}, 100);
}, 50);
}

// Mark the file as modified if there are pending changes
Expand Down
28 changes: 14 additions & 14 deletions src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ suite("oil.code", () => {
await saveFile();

await vscode.commands.executeCommand("oil-code.open");
await sleep(100);

// Move cursor to the file name
const position = new vscode.Position(2, 0);
Expand Down Expand Up @@ -418,24 +419,27 @@ suite("oil.code", () => {
await saveFile();

await vscode.commands.executeCommand("oil-code.open");
await sleep(100);

const editor2 = vscode.window.activeTextEditor;
assert.ok(editor2, "No active editor2");
// Move cursor to the file name
const position = new vscode.Position(2, 0);
editor.selection = new vscode.Selection(position, position);
editor2.selection = new vscode.Selection(position, position);

await vscode.commands.executeCommand("editor.action.deleteLines");
await sleep(100);

// Move cursor to the new directory
const position3 = new vscode.Position(1, 0);
editor.selection = new vscode.Selection(position3, position3);
editor2.selection = new vscode.Selection(position3, position3);

await vscode.commands.executeCommand("oil-code.select");
await sleep(200);

const editor2 = vscode.window.activeTextEditor;
assert.ok(editor2, "No active editor");
editor2.edit((editBuilder) => {
const editor3 = vscode.window.activeTextEditor;
assert.ok(editor3, "No active editor3");
editor3.edit((editBuilder) => {
editBuilder.insert(new vscode.Position(0, 8), newline);
editBuilder.insert(new vscode.Position(1, 0), `/002 oil-file-rename.md`);
});
Expand Down Expand Up @@ -523,16 +527,10 @@ suite("oil.code", () => {
"/002 oil-dir-parent/",
]);

editor.selection = new vscode.Selection(
new vscode.Position(1, 0),
new vscode.Position(1, 0)
);
editor.selection = new vscode.Selection(1, 5, 1, 5);
await vscode.commands.executeCommand("editor.action.deleteLines");
await sleep(100);
editor.selection = new vscode.Selection(
new vscode.Position(1, 0),
new vscode.Position(1, 0)
);
await sleep(200);
editor.selection = new vscode.Selection(1, 5, 1, 5);
await vscode.commands.executeCommand("oil-code.select");
await sleep(200);

Expand All @@ -547,6 +545,8 @@ suite("oil.code", () => {

await saveFile();

await sleep(100);

await waitForDocumentText(["/000 ../", "/003 oil-dir-child-renamed/"]);
await assertProjectFileStructure([
"oil-dir-parent/",
Expand Down
Loading