mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-25 00:44:48 +01:00
fix: remove cursors from inactive files
This commit is contained in:
parent
e6b86d3cff
commit
14144ec152
1 changed files with 16 additions and 2 deletions
|
@ -79,19 +79,33 @@ export async function join(selected: vscode.TreeItem | undefined) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let once = true;
|
||||||
vscode.window.onDidChangeTextEditorSelection(async (event: vscode.TextEditorSelectionChangeEvent) => {
|
vscode.window.onDidChangeTextEditorSelection(async (event: vscode.TextEditorSelectionChangeEvent) => {
|
||||||
if (event.kind == vscode.TextEditorSelectionChangeKind.Command) return; // TODO commands might move cursor too
|
if (event.kind == vscode.TextEditorSelectionChangeKind.Command) return; // TODO commands might move cursor too
|
||||||
let buf = event.textEditor.document.uri;
|
let buf = event.textEditor.document.uri;
|
||||||
let selection: vscode.Selection = event.selections[0]
|
let selection: vscode.Selection = event.selections[0]
|
||||||
let buffer = mapping.bufferMapper.by_editor(buf)
|
let buffer = mapping.bufferMapper.by_editor(buf)
|
||||||
if (buffer === undefined) return;
|
if (buffer === undefined) {
|
||||||
let cursor: codemp.Cursor = {
|
if (once) {
|
||||||
|
await controller.send({
|
||||||
|
startRow: 0,
|
||||||
|
startCol: 0,
|
||||||
|
endRow: 0,
|
||||||
|
endCol: 0,
|
||||||
|
buffer: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
once = false;
|
||||||
|
} else {
|
||||||
|
await controller.send({
|
||||||
startRow: selection.anchor.line,
|
startRow: selection.anchor.line,
|
||||||
startCol: selection.anchor.character,
|
startCol: selection.anchor.character,
|
||||||
endRow: selection.active.line,
|
endRow: selection.active.line,
|
||||||
endCol: selection.active.character,
|
endCol: selection.active.character,
|
||||||
buffer: buffer,
|
buffer: buffer,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
|
});
|
||||||
|
once = true;
|
||||||
}
|
}
|
||||||
await controller.send(cursor);
|
await controller.send(cursor);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue