Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-010
The find bar paints the matches of the rendered text and walks them
While the find bar holds a query, the extension SHALL paint every match in the rendered text of the page, show the match count, move the current match with Enter, Shift+Enter and F3, unfold the folded sections that hold it and bring it into view, vertically and inside any box that scrolls sideways; the find bar SHALL offer the options match case, whole word and regular expression, and report an invalid regular expression in place of the count instead of searching.
Step 2 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-003: from “The find bar is open” to “The matches are walked”.
Scenarios 7
The situations the tests check; open one to read it.
nominalMatches are painted and walked
Givena page whose rendered text holds a word four times, in a heading, a paragraph (once inside bold markup), an admonition and a table cell
Whenthe reader types the word in the find bar
Thenthe four matches are painted, the count reads "1 of 4", Enter shows "2 of 4", Shift+Enter and F3 move back and forward and wrap around at the ends
nominalA match in a folded section opens it
Givena folded section that holds the only match
Whenthe match becomes the current one
Thenthe folded sections that hold it are unfolded and the page scrolls the match to the middle when it is outside the pane
nominalA hit inside a table scrolled sideways
Givena wide table scrolled to its last column and a word that exists only in its second column
Whenthe reader types it and presses Enter
Thenthe table's box scrolls so that the hit text lies inside it with a 16 px margin, and the page does not scroll sideways
boundaryWhat is searched
| Input | Outcome |
|---|---|
| Text of a hidden element, a button, a field, a formula's MathML copy, a comment chip | Not searched |
| Text inside a folded section (hidden until found) | Searched |
| A match across inline markup ("Pre" and bold "view") | One match |
| A line break or runs of spaces in a paragraph | One space for the query; code keeps its own |
| A match across two blocks (two paragraphs, two table cells) | Not a match |
| More than 10000 matches | The first 10000 are kept and the count reads "10000+" |
| The content is updated (an edit, a refresh) | The search runs again on the new content and keeps the current index |
| A hit already in view horizontally | No sideways scroll |
| A hit wider than its scroll box | The box is aligned on the start of the hit |
nominalThe three options
Givena page with "Studio" and "studio" in its text
Whenthe reader turns on Match case (Alt+C), Whole word (Alt+W) or Regular expression (Alt+R)
Thenthe matches are searched again at once: match case keeps the same letter case, whole word needs a non-word character (letter, digit, underscore) on each side, and the expression is used as written
failureAn invalid expression
Giventhe regular expression option is on
Whenthe field holds "stud(io"
Thenthe count shows the reason of the engine, the field is marked aria-invalid, nothing is painted and nothing is replaced
boundaryLiteral queries
| Input | Outcome |
|---|---|
| A query with ".", "+", "(" or "/" and the expression option off | Plain text |
| A pattern that can match the empty string ("a*") | Empty matches are skipped |
| An empty query | No search, no count |
Implemented in 4
Tested by 9
- test/core/find/findMatches.test.tsunit
- test/core/preview/previewStyles.test.tsunit
- test/integration/findInPreview.test.tsintegration
- test/integration/realInput/findWideTable.tsintegration
- test/page/modules/findBar.test.tsunit
- test/page/modules/findIndex.test.tsunit
- test/visual/capture_find_checks.pyvisual
- test/visual/capture_find_wide_table.pyvisual
- test/visual/findWideTableScenarios.tsvisual
Replaces
SwRS-MDOKFSTUDIO-TOOLBAR-011The find bar matches case, whole words and regular expressions superseded superseded by SwRS-MDOKFSTUDIO-TOOLBAR-010 Markdown file