Skip to content

Add advanced search and polish PrettySumatraPDF v1.0.2 - #16

Merged
JaviLendi merged 12 commits into
masterfrom
Improve-search
Oct 24, 2026
Merged

JaviLendi merged 12 commits into
masterfrom
Improve-search

Conversation

@JaviLendi

Copy link
Copy Markdown
Owner

Summary

  • Add regular-expression, case-sensitive, and whole-word search.
  • Add a results sidebar grouped by page, with match counts and navigation that jumps to a page and highlights its matches.
  • Improve multi-document startup and show the native window while the WebView2 toolbar initializes.
  • Refine the hybrid toolbar’s keyboard handling, localization, themes, dropdowns, and accessibility.
  • Support independent colors for highlight, underline, and strikeout tools.
  • Bundle the web UI and required fonts and icons in the installer for offline use.

Add a minimal Inno Setup script for testing and a PowerShell helper that copies the webui to a short path (avoiding long-path issues), sets SHORT_WEBUI_SRC, and runs ISCC.

Reorganize the v1.0.2 release notes into Search, Startup and Toolbar, and Annotations and Installer sections, and drop the build artifacts list.
- EnsureAreaVisibility now requires the full title bar and at least 120px of width to be visible, otherwise the window is moved to the work area. Session restore uses it and skips empty window positions.
- RenderCache rejects invalid page numbers in RequestRendering and Render to avoid out-of-range requests.
- Add SearchResults.* to premake and the VS2022 project and filters.
- build.ts copies SumatraPDF-dll.exe to SumatraPDF.exe after the debug build.
- Also adds an accidental installer build log (scripts/installer/iscc_build.log) that likely shouldn't be committed.
@JaviLendi
JaviLendi requested a balanced review from Copilot October 23, 2026 19:04
@JaviLendi JaviLendi self-assigned this Oct 23, 2026
@JaviLendi JaviLendi added the enhancement New feature or request label Oct 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved regressions in search correctness and responsiveness, document loading, toolbar initialization, and panel accessibility block approval.

19 open issues
What changed in this PR

This PR advances PrettySumatraPDF to v1.0.2, extending document search and refining the integration between its native Win32 interface and WebView2 controls.

Changes:

  • Adds advanced search options, per-page result counts, and sidebar navigation with highlighting.
  • Defers toolbar initialization, introduces asynchronous startup loading, and updates annotation panels, themes, and keyboard interactions.
  • Updates build tooling, offline web-asset packaging, and release documentation.
File Description
vs2022/​SumatraPDF.vcxproj.filters Groups the new search-results files.
vs2022/​SumatraPDF.vcxproj Includes the search-results implementation.
vs2022/​SumatraPDF-dll.vcxproj Includes search results and regex sources.
src/​wingui/​WebView.cpp Routes Escape and identifies bridge message sources.
src/​Version.h Sets version 1.0.2.
src/​Theme.h Declares annotation-panel theme colors.
src/​Theme.cpp Implements panel colors and changes muted text.
src/​TextSearch.h Declares advanced search and counting support.
src/​TextSearch.cpp Implements regex, whole-word matching, and counts.
src/​SumatraStartup.cpp Adds asynchronous startup loading.
src/​SumatraPDF.cpp Integrates deferred toolbars and docked sidebars.
src/​SearchResults.h Declares the results-sidebar interface.
src/​SearchResults.cpp Builds page-result rows and handles navigation.
src/​SearchAndDDE.h Declares page-targeted search helpers.
src/​SearchAndDDE.cpp Publishes counts, highlights results, and changes DDE loading.
src/​resource.h Adds the results-header control identifier.
src/​RenderCache.cpp Rejects invalid rendering page requests.
src/​prettysumatra/​BridgeDispatcher.h Extends search synchronization and message routing.
src/​prettysumatra/​BridgeDispatcher.cpp Handles search options and WebView readiness.
src/​MainWindow.h Adds search, sidebar, and WebView state.
src/​MainWindow.cpp Cleans up new controls and updates colors.
src/​HomePage.cpp Gates home-page visibility on readiness.
src/​Favorites.cpp Coordinates favorites with search results.
src/​EditAnnotations.h Exposes docked-panel layout and visibility helpers.
src/​EditAnnotations.cpp Converts the annotation editor to a themed child panel.
src/​DisplayModel.cpp Guards missing page information during zoom lookup.
src/​AppTools.cpp Improves restored-window visibility.
scripts/​installer/​README_INSTALLER.md Updates build and installation instructions.
scripts/​installer/​PrettySumatraPDF.iss Packages selected offline assets for v1.0.2.
scripts/​installer/​PrettySumatraPDF_minimal.iss Adds a minimal test installer.
scripts/​installer/​prepare_and_build.ps1 Stages web assets under a shorter path.
scripts/​installer/​iscc_build.log Records an installer compilation attempt.
scripts/​installer/​build-webui-fonts.py Generates optimized web fonts.
prettysumatra/​webui/​vendor/​material-icons/​material-icons.css Uses the subset WOFF2 icon font.
prettysumatra/​webui/​vendor/​inter/​inter.css Switches retained font weights to WOFF2.
prettysumatra/​webui/​toolbar.css Adds responsive toolbar and search styling.
prettysumatra/​webui/​home.html Refines keyboard access, styling, and readiness messages.
premake5.files.lua Registers search-results sources for project generation.
ext/​mujs/​regexp.h Declares offset-based regex execution.
ext/​mujs/​regexp.c Implements execution from a supplied offset.
docs/​releases/​RELEASE_NOTES_v1.0.2.md Documents release features.
docs/​releases/​RELEASE_DRAFT.md Updates the release draft to v1.0.2.
cmd/​util.ts Expands Visual Studio detection and solution selection.
cmd/​test-plugin.ts Uses shared toolchain and solution discovery.
cmd/​run-tests.ts Uses shared solution selection.
cmd/​build.ts Selects the solution and copies the executable.
cmd/​build-smoke.ts Uses shared toolchain and solution discovery.
cmd/​build-codeql.ts Uses shared solution selection.
cmd/​build-ci.ts Uses shared solution selection.
cmd/​build-ci-daily.ts Uses shared solution selection.
cmd/​build-all.ts Uses shared toolchain and solution discovery.

Review effort: Balanced

Comment thread src/SearchAndDDE.cpp Resolved
Comment thread src/SearchAndDDE.cpp Resolved
Comment thread src/SearchResults.cpp Resolved
Comment thread src/SumatraPDF.cpp Resolved
Comment thread src/SumatraStartup.cpp Resolved
Comment thread src/TextSearch.cpp Resolved
Comment thread src/TextSearch.cpp Resolved
Comment thread src/Theme.cpp Resolved
Comment thread src/prettysumatra/BridgeDispatcher.cpp Resolved
Comment thread src/wingui/WebView.cpp Resolved
Annotations panel: add a vertical scrollbar, mouse wheel scrolling, an "Annotations" header, and Tab focus that hands off to the main window at the ends.

Search: add FindFirstOnPage/FindNextOnPage for per-page highlighting; fix regex search (direction changes, match bounds, empty matches, trailing space); report progress while counting matches; clear search state and sidebar when the query is emptied or the document is closed; keep focus in the results tree on keyboard navigation.

Startup/loading: create the hybrid toolbar lazily after the window is shown; allow async load only when tabs are enabled; load synchronously on DDE open.

Misc: lighten disabled text color, let WebView handle Escape, add .copilotignore, and update the installer binary.
Replace the internal draft template with release highlights and a direct installer download link, noting that WebView assets are included for offline use.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Startup initialization, regex memory retention, project regeneration, and UI lifecycle regressions remain unresolved.

7 open issues
19 resolved since last review

Review effort: Balanced

Comment thread src/HomePage.cpp
Comment on lines +157 to +159
if (!win->homePageWebViewReady) {
return;
}
Comment thread src/SumatraStartup.cpp
Comment on lines +313 to +315
if (canLoadAsync) {
StartLoadDocument(&args);
return args.win;
Comment thread src/TextSearch.cpp Resolved
Comment on lines +1196 to +1200
<ClCompile Include="..\ext\mujs\regexp.c">
<DisableSpecificWarnings>4310;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="..\ext\mujs\utf.c">
<DisableSpecificWarnings>4310;%(DisableSpecificWarnings)</DisableSpecificWarnings>
Comment thread src/EditAnnotations.cpp Resolved
Comment thread src/EditAnnotations.cpp Resolved
Comment thread src/SumatraPDF.cpp Resolved
JaviLendi and others added 6 commits October 23, 2026 22:20
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Reset last layout state and relayout the window after updating tab visibility.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add a navigation-completed hook to WebviewWnd (OnNavigationCompleted) wired to the WebView2 NavigationCompleted event. HomePage now uses a HomePageWebviewWnd subclass that calls the new NotifyHomePageWebViewReady once the page finishes loading, instead of relying only on the JS ready message.

Also:
- LoadArgs::Clone now copies all load flags and the engine.
- Show the main window before reporting a load error when showWin is set and the window is hidden.
- Link mujs regexp.c and utf.c in premake5.lua with warning 4310 disabled.
- Update the VS project and filter files for prettysumatra sources, SearchResults and the notes file.
- Rebuild the installer binary.
Strip trailing whitespace in cmd/util.ts, src/EditAnnotations.cpp and src/EditAnnotations.h (formatting only, no behavior change). Delete the stray scripts/installer/iscc_build.log build artifact.
@JaviLendi
JaviLendi merged commit 2c229b8 into master Oct 24, 2026
2 checks passed
@JaviLendi
JaviLendi deleted the Improve-search branch October 24, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants