File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ import {
1515import { moveAfterParent } from '../editor-model/commands-move' ;
1616import { range } from '../editor-model/selection-utils' ;
1717
18- import { removeSuggestion , updateAutocomplete } from './autocomplete' ;
18+ import {
19+ acceptCommandSuggestion ,
20+ removeSuggestion ,
21+ updateAutocomplete ,
22+ } from './autocomplete' ;
1923import { requestUpdate } from './render' ;
2024import type { _Mathfield } from './mathfield-private' ;
2125import { removeIsolatedSpace , smartMode } from './smartmode' ;
@@ -250,6 +254,18 @@ export function onKeystroke(
250254 // (the bias is reset when the selection changes)
251255 mathfield . styleBias = 'none' ;
252256
257+ // Check if there's an active autocomplete suggestion and accept it
258+ if ( acceptCommandSuggestion ( model ) ) {
259+ mathfield . snapshot ( 'accept-suggestion' ) ;
260+ mathfield . dirty = true ;
261+ mathfield . scrollIntoView ( ) ;
262+ if ( evt . preventDefault ) {
263+ evt . preventDefault ( ) ;
264+ evt . stopPropagation ( ) ;
265+ }
266+ return false ;
267+ }
268+
253269 // The space bar can be used to separate inline shortcuts
254270 mathfield . flushInlineShortcutBuffer ( ) ;
255271
You can’t perform that action at this time.
0 commit comments