diff --git a/data/fixtures/recorded/headTail/changeTail4.yml b/data/fixtures/recorded/headTail/changeTail4.yml new file mode 100644 index 0000000000..d34abbfa80 --- /dev/null +++ b/data/fixtures/recorded/headTail/changeTail4.yml @@ -0,0 +1,22 @@ +languageId: plaintext +command: + version: 7 + spokenForm: change tail + action: + name: clearAndSetSelection + target: + type: primitive + modifiers: + - {type: extendThroughEndOf} + usePrePhraseSnapshot: false +initialState: + documentContents: (a) b + selections: + - anchor: {line: 0, character: 3} + active: {line: 0, character: 3} + marks: {} +finalState: + documentContents: (a) + selections: + - anchor: {line: 0, character: 3} + active: {line: 0, character: 3} diff --git a/packages/common/src/types/command/PartialTargetDescriptor.types.ts b/packages/common/src/types/command/PartialTargetDescriptor.types.ts index 425ab13d9a..cbb68b08a9 100644 --- a/packages/common/src/types/command/PartialTargetDescriptor.types.ts +++ b/packages/common/src/types/command/PartialTargetDescriptor.types.ts @@ -240,6 +240,9 @@ export interface InteriorScopeType { // The user has specified a scope type. eg "inside element". explicitScopeType?: boolean; + + // Gets passed to surrounding pair scope handler + requireStrongContainment?: boolean; } export type SurroundingPairDirection = "left" | "right"; diff --git a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts index 641dc43b71..964314cee8 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/HeadTailStage.ts @@ -101,6 +101,7 @@ class BoundedLineStage implements ModifierStage { try { return this.getContaining(target, options, { type: "interior", + requireStrongContainment: true, }); } catch (error) { if (error instanceof NoContainingScopeError) { diff --git a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts index 124eb6cd67..65896065f8 100644 --- a/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts +++ b/packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/InteriorScopeHandler.ts @@ -74,6 +74,7 @@ export class InteriorScopeHandler extends BaseScopeHandler { { type: "surroundingPair", delimiter: "any", + requireStrongContainment: this.scopeType.requireStrongContainment, }, this.languageId, );