quarto-dev / quarto-dev/quarto

visual editor: support multi-cursor 'add next match' in the find API

Open
#1,103 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

visual-editor
Dominant language
TypeScript
Stars
645
Forks
62
Avg merge
17h 42m
Merged PRs (30d)
13

Description

Context

RStudio's "Find and Add Next" and "Find All" commands build a multi-cursor selection from the current find match (Ace's "add next selection" feature). In the visual editor these commands work inside code chunks (routed to the chunk's embedded Ace editor, rstudio/rstudio#18651), but they cannot work in prose: the editor's find API only exposes single-selection operations, so RStudio currently reports the commands as disabled there.

Reported by users in rstudio/rstudio#16540, where the repro is specifically prose.

Feature request

An "add next match to selection" capability (and ideally a companion "select all matches") in the editor's find API, so embedders can offer multi-cursor style editing over find results in prose.

Technical notes
  • EditorFindReplace (packages/editor/src/editor/editor.ts, exposed via Editor.getFindReplace()) currently exposes selectFirst / selectCurrent / selectNext / selectPrevious / replace / replaceAll, all single-selection, backed by the FindPlugin in packages/editor/src/behaviors/find.ts.
  • ProseMirror's TextSelection is a single range and multi-range selection is not a native concept, so this likely requires either a custom Selection subclass or a plugin that maintains the additional ranges as decorations and fans typed edits out to every range.

Not a small change -- filing so the request is tracked upstream and can be prioritized. Happy to discuss design or contribute if there's an agreed direction.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with EditorFindReplace in packages/editor/src/editor/editor.ts and the FindPlugin in packages/editor/src/behaviors/find.ts. Review how the current single-selection operations work and investigate the ProseMirror TextSelection constraint before discussing an agreed design. Done means prose find results expose add-next-match, and ideally select-all, to embedders with multi-cursor editing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.