You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Find and Add Next" not working in Quarto Visual Mode #16540
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
In 'Modify Keyboard Shortcuts", set Ctrl+H as the shortcut for the Find and Add Next command.
Create a Quarto document containing these lines:
testing
this is a test
mid-line testing
attest
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.
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.
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:
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.
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.
"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.
Activity
github-actions commentedon Apr 13, 2026
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.
DesiQuintans commentedon Apr 13, 2026
Unstale
ronblum commentedon Apr 15, 2026
Reproducible in RStudio Desktop 2026.04.0+518 on Windows 11, both in Quarto and R Markdown.
gtritchie commentedon May 6, 2026
Investigation notes
Root cause:
TextEditingTarget.onQuickAddNextunconditionally callsdocDisplay_.quickAddNext(), wheredocDisplay_is the source-mode Ace editor. Unlike sibling handlers (onFindReplace,onFindNext,onFindFromSelection), it never checksvisualMode_.isActivated(), so in Visual Mode the call goes to a hidden Ace instance and does nothing visible.onFindSelectAllhas 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:
VisualModeChunk).quickAddNextis just Ace's "Add Next Selection" multi-cursor feature, so it works natively here once routed to the active inner editor via the existingwithActiveEditor(...)helper.PanmirrorFindReplaceonly exposes single-selection ops (selectFirst/Next/Previous/Current,replace,replaceAll). ProseMirror'sTextSelectionis single-range; multi-cursor isn't a native concept.Where the fix lives:
onQuickAddNext(andonFindSelectAll) to usewithActiveEditor(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 inTextEditingTarget.java.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.
12 remaining items
enlarge the server e2e browser window to 1280x900
suspend idle commands across a visual mode format reload
run the footnote find-seeding steps last
settle the buffered find before the footnote steps
fix two visual-editor find gaps: multi-cursor commands and search-box…
gtritchie commentedon Sep 1, 2026
Partially addressed in 2026.09, moving for 2026.10 for investigation of the other parts.
kevinushey commentedon Sep 1, 2026
A status update on where this stands.
Fixed in 2026.09 (via #18651):
Still to be addressed (tracked for 2026.10):