Skip to content

"Find and Add Next" not working in Quarto Visual Mode #16540

Open

Description

@DesiQuintans

System details

RStudio Edition : Desktop
RStudio Version : 2025.09.1 Build 401, "Cucumberleaf Sunflower" Release (20de3565, 2025-09-23) for Ubuntu Jammy
OS Version      :  Linux Mint 22.2 Cinnamon (Cinnamon 648), Linux kernel 6.8.0-85-generic
R Version       :  4.3.3

Steps to reproduce the problem

  1. In 'Modify Keyboard Shortcuts", set Ctrl+H as the shortcut for the Find and Add Next command.
  2. Create a Quarto document containing these lines:
testing
this is a test
mid-line testing
attest
  1. In Quarto Visual Mode, select the substring test in the first line and hit Ctrl+H to start marking all subsequent occurrences. It will not work.

  2. Switch to Quarto Source Mode, do the same thing. It will work.

Describe the problem in detail

"Find and Add Next" does not work in Visual Mode, it only works in Source Mode.

Describe the behavior you expected

"Find and Add Next" should work in documents regardless of display mode, expecially when the user tries to use it inside a code block.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on Oct 11, 2025
  2. added theissue type on Oct 14, 2025
  3. github-actions commented on Apr 13, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

  4. added
    stale
    on Apr 13, 2026
  5. DesiQuintans commented on Apr 13, 2026

    @DesiQuintans
    Author

    Unstale

  6. removed
    stale
    on Apr 14, 2026
  7. ronblum commented on Apr 15, 2026

    @ronblum
    Contributor

    Reproducible in RStudio Desktop 2026.04.0+518 on Windows 11, both in Quarto and R Markdown.

  8. added
    visual markdown
    and removed
    new
    on Apr 15, 2026
  9. added this to the Golden Wattle milestone on Apr 22, 2026
  10. gtritchie commented on May 6, 2026

    @gtritchie
    Member

    Investigation notes

    Root cause: TextEditingTarget.onQuickAddNext unconditionally calls docDisplay_.quickAddNext(), where docDisplay_ is the source-mode Ace editor. Unlike sibling handlers (onFindReplace, onFindNext, onFindFromSelection), it never checks visualMode_.isActivated(), so in Visual Mode the call goes to a hidden Ace instance and does nothing visible. onFindSelectAll has the same shape of bug.

    The repro uses prose (paragraph text), not a code chunk, and that distinction matters because Visual Mode contains two kinds of editable surface:

    1. Code chunks — embedded Ace editors (VisualModeChunk). quickAddNext is just Ace's "Add Next Selection" multi-cursor feature, so it works natively here once routed to the active inner editor via the existing withActiveEditor(...) helper.
    2. Prose — panmirror/ProseMirror. PanmirrorFindReplace only exposes single-selection ops (selectFirst/Next/Previous/Current, replace, replaceAll). ProseMirror's TextSelection is single-range; multi-cursor isn't a native concept.

    Where the fix lives:

    • RStudio (this repo) — small, contained: change onQuickAddNext (and onFindSelectAll) to use withActiveEditor(disp -> disp.quickAddNext()). That makes both commands work when the cursor is inside a code chunk in Visual Mode, matching the pattern already used by many other handlers in TextEditingTarget.java.
    • Quarto/panmirror (https://github.com/quarto-dev/quarto) — larger feature: to make it work for prose (the exact repro in this issue), panmirror needs a new "add next match" capability, plumbed through PanmirrorFindReplace -> HasFindReplace -> the GWT handler. Non-trivial: ProseMirror doesn't natively support multi-range selections, so this likely requires a custom plugin maintaining decorations and routing edits to all ranges.

    Suggested path: ship the RStudio-side change now to cover the code-chunk case (low risk, isolated), and open an upstream issue at quarto-dev/quarto for prose multi-cursor support.

  11. removed this from the Blue Plumbago milestone on Jun 4, 2026
  12. 12 remaining items

  13. gtritchie commented on Sep 1, 2026

    @gtritchie
    Member

    Partially addressed in 2026.09, moving for 2026.10 for investigation of the other parts.

  14. kevinushey commented on Sep 1, 2026

    @kevinushey
    Collaborator

    A status update on where this stands.

    Fixed in 2026.09 (via #18651):

    • "Find and Add Next" and "Find All" now work in Visual Mode when the cursor is inside a code chunk. In prose, both commands are now correctly reported as disabled, rather than silently doing nothing.
    • Opening Find in Visual Mode now seeds the search box from the current selection (as reported by @Sibojang9 above), and "Use Selection for Find" now picks up selections made inside code chunks as well.

    Still to be addressed (tracked for 2026.10):

    • "Find and Add Next" on prose -- the original repro here. ProseMirror selections are single-range, and panmirror's find API only exposes single-selection operations, so multi-cursor editing in prose needs new upstream support in quarto-dev/quarto (likely a custom plugin maintaining decorations and applying edits to all ranges). The next step is to file an upstream feature request there.
    • "Find and Select All" remains disabled in Visual Mode, even within code chunks: its only affordance is the "All" button in the find bar, and clicking that button blurs the chunk editor, which clears the active-editor routing the other commands now use, so it needs a different approach.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugvisual markdown

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions