Skip to content
Merged
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
22 changes: 4 additions & 18 deletions core/keyboard_nav/line_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {BlockSvg} from '../block_svg.js';
import {Field} from '../field.js';
import {getFocusManager} from '../focus_manager.js';
import type {IFocusableNode} from '../interfaces/i_focusable_node.js';
import {isFocusableNode} from '../interfaces/i_focusable_node.js';
import * as registry from '../registry.js';
import {WorkspaceSvg} from '../workspace_svg.js';
import {Marker} from './marker.js';
Expand Down Expand Up @@ -374,17 +373,8 @@ export class LineCursor extends Marker {
*
* @returns The current field, connection, or block the cursor is on.
*/
override getCurNode(): IFocusableNode | null {
// Ensure the current node matches what's currently focused.
const focused = getFocusManager().getFocusedNode();
const block = this.getSourceBlockFromNode(focused);
if (block && block.workspace === this.workspace) {
// If the current focused node corresponds to a block then ensure that it
// belongs to the correct workspace for this cursor.
this.setCurNode(focused);
}

return super.getCurNode();
getCurNode(): IFocusableNode | null {
return getFocusManager().getFocusedNode();
}

/**
Expand All @@ -395,12 +385,8 @@ export class LineCursor extends Marker {
*
* @param newNode The new location of the cursor.
*/
override setCurNode(newNode: IFocusableNode | null) {
super.setCurNode(newNode);

if (isFocusableNode(newNode)) {
getFocusManager().focusNode(newNode);
}
setCurNode(newNode: IFocusableNode) {
getFocusManager().focusNode(newNode);

// Try to scroll cursor into view.
if (newNode instanceof BlockSvg) {
Expand Down