@@ -18,6 +18,8 @@ import { ScrollType } from 'vs/editor/common/editorCommon';
1818import { EditorContextKeys } from 'vs/editor/common/editorContextKeys' ;
1919import { ITextModel } from 'vs/editor/common/model' ;
2020import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
21+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility' ;
22+ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
2123
2224export interface MoveWordOptions extends ICommandOptions {
2325 inSelectionMode : boolean ;
@@ -170,6 +172,49 @@ export class CursorWordLeftSelect extends WordLeftCommand {
170172 }
171173}
172174
175+ const CHROME_SEPARATORS = '`~!@#$%^&*()-=+[{]}\\|;",.<>/?' ;
176+ export class CursorWordAccessibilityLeft extends WordLeftCommand {
177+ constructor ( ) {
178+ super ( {
179+ inSelectionMode : false ,
180+ wordNavigationType : WordNavigationType . WordAcessibility ,
181+ id : 'cursorWordAccessibilityLeft' ,
182+ precondition : undefined ,
183+ kbOpts : {
184+ kbExpr : ContextKeyExpr . and ( EditorContextKeys . textInputFocus , CONTEXT_ACCESSIBILITY_MODE_ENABLED ) ,
185+ primary : KeyMod . CtrlCmd | KeyCode . LeftArrow ,
186+ mac : { primary : KeyMod . Alt | KeyCode . LeftArrow } ,
187+ weight : KeybindingWeight . EditorContrib + 1
188+ }
189+ } ) ;
190+ }
191+
192+ protected _move ( _ : WordCharacterClassifier , model : ITextModel , position : Position , wordNavigationType : WordNavigationType ) : Position {
193+ return super . _move ( getMapForWordSeparators ( CHROME_SEPARATORS ) , model , position , wordNavigationType ) ;
194+ }
195+ }
196+
197+ export class CursorWordAccessibilityLeftSelect extends WordLeftCommand {
198+ constructor ( ) {
199+ super ( {
200+ inSelectionMode : true ,
201+ wordNavigationType : WordNavigationType . WordAcessibility ,
202+ id : 'cursorWordAccessibilitLeftSelecty' ,
203+ precondition : undefined ,
204+ kbOpts : {
205+ kbExpr : ContextKeyExpr . and ( EditorContextKeys . textInputFocus , CONTEXT_ACCESSIBILITY_MODE_ENABLED ) ,
206+ primary : KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . LeftArrow ,
207+ mac : { primary : KeyMod . Alt | KeyMod . Shift | KeyCode . LeftArrow } ,
208+ weight : KeybindingWeight . EditorContrib + 1
209+ }
210+ } ) ;
211+ }
212+
213+ protected _move ( _ : WordCharacterClassifier , model : ITextModel , position : Position , wordNavigationType : WordNavigationType ) : Position {
214+ return super . _move ( getMapForWordSeparators ( CHROME_SEPARATORS ) , model , position , wordNavigationType ) ;
215+ }
216+ }
217+
173218export class CursorWordStartRight extends WordRightCommand {
174219 constructor ( ) {
175220 super ( {
@@ -248,6 +293,48 @@ export class CursorWordRightSelect extends WordRightCommand {
248293 }
249294}
250295
296+ export class CursorWordAccessibilityRight extends WordRightCommand {
297+ constructor ( ) {
298+ super ( {
299+ inSelectionMode : false ,
300+ wordNavigationType : WordNavigationType . WordAcessibility ,
301+ id : 'cursorWordAccessibilityRight' ,
302+ precondition : undefined ,
303+ kbOpts : {
304+ kbExpr : ContextKeyExpr . and ( EditorContextKeys . textInputFocus , CONTEXT_ACCESSIBILITY_MODE_ENABLED ) ,
305+ primary : KeyMod . CtrlCmd | KeyCode . RightArrow ,
306+ mac : { primary : KeyMod . Alt | KeyCode . RightArrow } ,
307+ weight : KeybindingWeight . EditorContrib + 1
308+ }
309+ } ) ;
310+ }
311+
312+ protected _move ( _ : WordCharacterClassifier , model : ITextModel , position : Position , wordNavigationType : WordNavigationType ) : Position {
313+ return super . _move ( getMapForWordSeparators ( CHROME_SEPARATORS ) , model , position , wordNavigationType ) ;
314+ }
315+ }
316+
317+ export class CursorWordAccessibilityRightSelect extends WordRightCommand {
318+ constructor ( ) {
319+ super ( {
320+ inSelectionMode : true ,
321+ wordNavigationType : WordNavigationType . WordAcessibility ,
322+ id : 'cursorWordAccessibilityRightSelect' ,
323+ precondition : undefined ,
324+ kbOpts : {
325+ kbExpr : ContextKeyExpr . and ( EditorContextKeys . textInputFocus , CONTEXT_ACCESSIBILITY_MODE_ENABLED ) ,
326+ primary : KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . RightArrow ,
327+ mac : { primary : KeyMod . Alt | KeyMod . Shift | KeyCode . RightArrow } ,
328+ weight : KeybindingWeight . EditorContrib + 1
329+ }
330+ } ) ;
331+ }
332+
333+ protected _move ( _ : WordCharacterClassifier , model : ITextModel , position : Position , wordNavigationType : WordNavigationType ) : Position {
334+ return super . _move ( getMapForWordSeparators ( CHROME_SEPARATORS ) , model , position , wordNavigationType ) ;
335+ }
336+ }
337+
251338export interface DeleteWordOptions extends ICommandOptions {
252339 whitespaceHeuristics : boolean ;
253340 wordNavigationType : WordNavigationType ;
@@ -397,6 +484,10 @@ registerEditorCommand(new CursorWordRight());
397484registerEditorCommand ( new CursorWordStartRightSelect ( ) ) ;
398485registerEditorCommand ( new CursorWordEndRightSelect ( ) ) ;
399486registerEditorCommand ( new CursorWordRightSelect ( ) ) ;
487+ registerEditorCommand ( new CursorWordAccessibilityLeft ( ) ) ;
488+ registerEditorCommand ( new CursorWordAccessibilityLeftSelect ( ) ) ;
489+ registerEditorCommand ( new CursorWordAccessibilityRight ( ) ) ;
490+ registerEditorCommand ( new CursorWordAccessibilityRightSelect ( ) ) ;
400491registerEditorCommand ( new DeleteWordStartLeft ( ) ) ;
401492registerEditorCommand ( new DeleteWordEndLeft ( ) ) ;
402493registerEditorCommand ( new DeleteWordLeft ( ) ) ;
0 commit comments