Search and Replace

Last modified by Thiago Krieck on 2026/09/15 15:33

 XWiki/Cristal
 Feature
 Idea
 
 
No

Description

Parameters

Match case

Find matches uppercase and lower case characters. 

  • Match case off: searching "page" matches "page", "Page", "PAGE", etc.
  • Match case on: searching "page" matches "page only"

Whole Word

Find matches only complete words and stops at word boundaries (spaces, commas, dots, etc)

  • Whole word off: searching "car" matches "car", "carpet"
  • Whole word on: searching "car" matches "car" only.

Regex

Evaluates the search string as a standard regex pattern. Needs validation on the UI.

Preserve case

When replacing only, matches the casing of the original word.

  • From Foo to Bar
  • From FOO to BAR

Scope

Current Selection

Searches only within the currently highlighted text block. This should default when there's text selected prior to activating find/replace.

Complete file

Searches the entire active document. Default when no text selected

Actions

Find Next / Previous

Navigates the cursor to the next / previous word matched by search

Replace

Replace the current word under the cursor and stop.

Replace All

Replace all matches across the document.

UI

Entry points

Keyboard shortcut

ctrl/cmd+f for entering search mode.

New proposed Icon Theme entry (replace action)

Screenshot 2026-09-04 at 09.04.16.png

https://fontawesome.com/icons/classic/solid/repeat

Toolbar and Floating Toolbar

toolbar.png

Slash command

slash.png

Main UIs

Quick entry

Screenshot 2026-09-15 at 10.10.40.png

Modal

dialog.png

UX

Quick entry

Starting a local search by keyboard shortcut should present the quick entry UI. This is to keep the UI footprint low for advanced users (denoted by the use of a hotkey).

In the quick entry UI there's an icon that lead to the full search/replace modal.

Live Highlighting

As the user types in the search field, all matches in the document should be visually highlighted (ex., yellow background), with the currently active match visually distinct (ex., orange background).

highlight.png

Auto-Scroll

"Next/Previous" must automatically scroll the document so the active match is centered or clearly visible in the viewport.

Match Counter

Display a live counter showing the active match index and total matches.

Screenshot 2026-09-04 at 09.46.34.png

Search History

The input fields should retain a dropdown history of the last 10-20 search and replace terms.

history.png

Edge Cases

Undo Stack

A "Replace All" action must be registered as a single action in the undo/redo stack. Pressing Undo should revert all replacements at once, not one by one.

Empty Replace String

If the replace field is empty, executing a replace should delete the matched text.

Empty Search String

The search logic should not execute or highlight anything if the search input is empty.


 


Get Connected