Skip to content

Commit 058d545

Browse files
Fix bug with "every token inside" (#2768)
Fixes #1806 ## Checklist - [x] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet
1 parent d419437 commit 058d545

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change every token inside
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: everyScope
11+
scopeType: {type: token}
12+
- {type: interiorOnly}
13+
usePrePhraseSnapshot: false
14+
initialState:
15+
documentContents: "'hello world'"
16+
selections:
17+
- anchor: {line: 0, character: 1}
18+
active: {line: 0, character: 1}
19+
marks: {}
20+
finalState:
21+
documentContents: "' '"
22+
selections:
23+
- anchor: {line: 0, character: 1}
24+
active: {line: 0, character: 1}
25+
- anchor: {line: 0, character: 2}
26+
active: {line: 0, character: 2}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
languageId: plaintext
2+
command:
3+
version: 7
4+
spokenForm: change last token inside
5+
action:
6+
name: clearAndSetSelection
7+
target:
8+
type: primitive
9+
modifiers:
10+
- type: ordinalScope
11+
scopeType: {type: token}
12+
start: -1
13+
length: 1
14+
- {type: interiorOnly}
15+
usePrePhraseSnapshot: false
16+
initialState:
17+
documentContents: "'hello world'"
18+
selections:
19+
- anchor: {line: 0, character: 1}
20+
active: {line: 0, character: 1}
21+
marks: {}
22+
finalState:
23+
documentContents: "'hello '"
24+
selections:
25+
- anchor: {line: 0, character: 7}
26+
active: {line: 0, character: 7}

packages/cursorless-engine/src/processTargets/modifiers/EveryScopeStage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class EveryScopeStage implements ModifierStage {
6161

6262
if (
6363
scopes.length === 1 &&
64-
scopes[0].domain.contains(target.contentRange)
64+
scopes[0].domain.contains(target.contentRange) &&
65+
!target.hasExplicitScopeType
6566
) {
6667
// If the only scope that came back completely contains the input target
6768
// range, we treat the input as if it had no explicit range, expanding

0 commit comments

Comments
 (0)