提交 d7a322da 编写于 作者: X Xinyu Sui

Double clicking on instruction breakpoint passes focus to disassembly view

上级 79b3eec4
......@@ -164,7 +164,8 @@ export class BreakpointsView extends ViewPane {
}
if (e.element instanceof InstructionBreakpoint) {
const disassemblyView = await this.editorService.openEditor(DisassemblyViewInput.instance);
(disassemblyView as DisassemblyView).goToAddress(e.element.instructionReference);
// Focus on double click
(disassemblyView as DisassemblyView).goToAddress(e.element.instructionReference, e.browserEvent instanceof MouseEvent && e.browserEvent.detail === 2);
}
if (e.browserEvent instanceof MouseEvent && e.browserEvent.detail === 2 && e.element instanceof FunctionBreakpoint && e.element !== this.inputBoxData?.breakpoint) {
// double click
......
......@@ -203,7 +203,7 @@ export class DisassemblyView extends EditorPane {
/**
* Go to the address provided. If no address is provided, reveal the address of the currently focused stack frame.
*/
goToAddress(address?: string): void {
goToAddress(address?: string, focus?: boolean): void {
if (!this._disassembledInstructions) {
return;
}
......@@ -222,21 +222,32 @@ export class DisassemblyView extends EditorPane {
const bottomElement = Math.floor((this._disassembledInstructions.scrollTop + this._disassembledInstructions.renderHeight) / this.fontInfo.lineHeight);
if (index > topElement && index < bottomElement) {
// Inside the viewport, don't do anything here
return;
} else if (index <= topElement && index > topElement - 5) {
// Not too far from top, review it at the top
return this._disassembledInstructions.reveal(index, 0);
this._disassembledInstructions.reveal(index, 0);
} else if (index >= bottomElement && index < bottomElement + 5) {
// Not too far from bottom, review it at the bottom
return this._disassembledInstructions.reveal(index, 1);
this._disassembledInstructions.reveal(index, 1);
} else {
// Far from the current viewport, reveal it
return this._disassembledInstructions.reveal(index, 0.5);
this._disassembledInstructions.reveal(index, 0.5);
}
if (focus) {
this._disassembledInstructions.domFocus();
this._disassembledInstructions.setFocus([index]);
}
} else if (this._debugService.state === State.Stopped) {
// Address is not provided or not in the table currently, clear the table
// and reload if we are in the state where we can load disassembly.
return this.reloadDisassembly(address);
this.reloadDisassembly(address);
if (focus) {
const newIndex = this.getIndexFromAddress(address);
if (newIndex >= 0) {
this._disassembledInstructions.domFocus();
this._disassembledInstructions.setFocus([newIndex]);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册