Skip to content

Commit a315e6f

Browse files
authored
Fix "pour" / "drink" with keyboardTargetFollowsSelection (#2473)
Before, if you have the new target follows cursor setting enabled, the "pour" action wouldn't do anything because it was a strong target. Changing it so it's equivalent to setting keyboard target to "this" every time you move cursor Didn't add tests because this setting is still super experimental; not convinced we want to keep it ## Checklist - [-] 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 53aedd7 commit a315e6f

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

packages/cursorless-engine/src/KeyboardTargetUpdater.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Disposable } from "@cursorless/common";
22
import { Debouncer } from "./core/Debouncer";
33
import { StoredTargetMap } from "./core/StoredTargets";
4-
import { PlainTarget } from "./processTargets/targets";
4+
import { CursorStage } from "./processTargets/marks/CursorStage";
55
import { ide } from "./singletons/ide.singleton";
66

77
export class KeyboardTargetUpdater {
@@ -49,17 +49,7 @@ export class KeyboardTargetUpdater {
4949
return;
5050
}
5151

52-
this.storedTargets.set(
53-
"keyboard",
54-
activeEditor.selections.map(
55-
(selection) =>
56-
new PlainTarget({
57-
contentRange: selection,
58-
editor: activeEditor,
59-
isReversed: selection.isReversed,
60-
}),
61-
),
62-
);
52+
this.storedTargets.set("keyboard", new CursorStage().run());
6353
}
6454

6555
dispose() {

packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class MarkStageFactoryImpl implements MarkStageFactory {
3030
create(mark: Mark): MarkStage {
3131
switch (mark.type) {
3232
case "cursor":
33-
return new CursorStage(mark);
33+
return new CursorStage();
3434
case "that":
3535
case "source":
3636
case "keyboard":

packages/cursorless-engine/src/processTargets/marks/CursorStage.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import type { CursorMark } from "@cursorless/common";
21
import { ide } from "../../singletons/ide.singleton";
32
import type { Target } from "../../typings/target.types";
43
import type { MarkStage } from "../PipelineStages.types";
54
import { UntypedTarget } from "../targets";
65
import { getActiveSelections } from "./getActiveSelections";
76

87
export class CursorStage implements MarkStage {
9-
constructor(private mark: CursorMark) {}
10-
118
run(): Target[] {
129
return getActiveSelections(ide()).map(
1310
(selection) =>

0 commit comments

Comments
 (0)