Support scrollIntoView in insertAtCursor syscall

pull/1232/head
Zef Hemel 2025-02-06 08:37:34 +01:00
parent ac18443b53
commit 2e96155a05
1 changed files with 2 additions and 1 deletions

View File

@ -250,7 +250,7 @@ export function editorSyscalls(client: Client): SysCallMapping {
}); });
}, },
"editor.insertAtCursor": (_ctx, text: string) => { "editor.insertAtCursor": (_ctx, text: string, scrollIntoView = false) => {
const editorView = client.editorView; const editorView = client.editorView;
const from = editorView.state.selection.main.from; const from = editorView.state.selection.main.from;
editorView.dispatch({ editorView.dispatch({
@ -261,6 +261,7 @@ export function editorSyscalls(client: Client): SysCallMapping {
selection: { selection: {
anchor: from + text.length, anchor: from + text.length,
}, },
scrollIntoView,
}); });
}, },
"editor.dispatch": (_ctx, change: Transaction) => { "editor.dispatch": (_ctx, change: Transaction) => {