Skip to content

Commit c1761c6

Browse files
authored
Change "highlight nothing" to target all editors (#1265)
The new behaviour broke my video recorder, because it didn't clear highlights if I targeted something on other side of screen ## 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 9ee7771 commit c1761c6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/actions/Highlight.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ export default class Highlight implements Action {
2222
}
2323

2424
if (targets.length === 0) {
25-
// Special case to clear highlights for the active editor when user says
25+
// Special case to clear highlights for all editors when user says
2626
// "highlight nothing"
27-
const { activeTextEditor } = ide();
28-
29-
if (activeTextEditor == null) {
30-
throw Error(
31-
"The `highlight nothing` command requires an active text editor",
32-
);
33-
}
34-
35-
await ide().setHighlightRanges(highlightId, activeTextEditor, []);
27+
await Promise.all(
28+
ide().visibleTextEditors.map((editor) =>
29+
ide().setHighlightRanges(highlightId, editor, []),
30+
),
31+
);
3632
} else {
3733
await runOnTargetsForEachEditor(targets, (editor, targets) =>
3834
ide().setHighlightRanges(

0 commit comments

Comments
 (0)