Skip to content

Commit e93692d

Browse files
cursorless_command("replaceWithTarget") fix (#1813)
Fixes #1811 I have not added any Talon side tests. The reason for this is that the failing code path is not used with voice commands. You could only hit this bug by manually calling our public python api. ## 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 0f5d011 commit e93692d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

cursorless-talon-dev/src/cursorless_test.talon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ tag: user.cursorless
55
# For testing our public api
66
test api command <user.cursorless_target>:
77
user.cursorless_command("setSelection", cursorless_target)
8+
test api command bring <user.cursorless_target>:
9+
user.cursorless_command("replaceWithTarget", cursorless_target)
810
test api insert snippet:
911
user.cursorless_insert_snippet("Hello, $foo! My name is $bar!")
1012
test api insert snippet by name:

cursorless-talon/src/actions/actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def cursorless_command(action_name: str, target: CursorlessTarget):
8787
if action_name in callback_actions:
8888
callback_actions[action_name](target)
8989
elif action_name in ["replaceWithTarget", "moveToTarget"]:
90-
actions.user.cursorless_bring_move(
90+
actions.user.private_cursorless_bring_move(
9191
action_name, BringMoveTargets(target, ImplicitDestination())
9292
)
9393
elif action_name in no_wait_actions:

packages/cursorless-engine/src/test/fixtures/talonApi.fixture.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const setSelectionAction: ActionDescriptor = {
99
mark: { type: "cursor" },
1010
},
1111
};
12+
const replaceWithTargetAction: ActionDescriptor = {
13+
name: "replaceWithTarget",
14+
source: {
15+
type: "primitive",
16+
mark: { type: "decoratedSymbol", symbolColor: "default", character: "a" },
17+
},
18+
destination: { type: "implicit" },
19+
};
1220
const insertSnippetAction: ActionDescriptor = {
1321
name: "insertSnippet",
1422
destination: { type: "implicit" },
@@ -57,6 +65,7 @@ const wrapWithSnippetByNameAction: ActionDescriptor = {
5765
*/
5866
export const talonApiFixture = [
5967
spokenFormTest("test api command this", setSelectionAction),
68+
spokenFormTest("test api command bring air", replaceWithTargetAction),
6069
spokenFormTest("test api insert snippet", insertSnippetAction),
6170
spokenFormTest("test api insert snippet by name", insertSnippetByNameAction),
6271
spokenFormTest("test api wrap with snippet this", wrapWithSnippetAction),

0 commit comments

Comments
 (0)