Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: dezren39
Expand Down
11 changes: 10 additions & 1 deletion pkgs/id/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

# Configure cargo to use vendored dependencies (nix sandbox has no network)
cat >> .cargo/config.toml << EOF
export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3"
export CC_x86_64_unknown_linux_gnu="gcc"
chmod -R +w ${cargoDeps} || true
cat >> .cargo/config.toml << EOF

[source.crates-io]
replace-with = "vendored-sources"
Expand Down Expand Up @@ -191,6 +194,9 @@
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

# Configure cargo to use vendored dependencies (nix sandbox has no network)
export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3"
export CC_x86_64_unknown_linux_gnu="gcc"
chmod -R +w ${cargoDeps} || true
cat >> .cargo/config.toml << EOF

[source.crates-io]
Expand Down Expand Up @@ -363,6 +369,9 @@
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

# Configure cargo to use vendored dependencies (nix sandbox has no network)
export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3"
export CC_x86_64_unknown_linux_gnu="gcc"
chmod -R +w ${cargoDeps} || true
cat >> .cargo/config.toml << EOF

[source.crates-io]
Expand Down
14 changes: 5 additions & 9 deletions pkgs/id/web/src/search-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { keymap } from "prosemirror-keymap";
import {
findNext,
findPrev,
getMatchHighlights,
getSearchState,
replaceAll,
replaceNext,
Expand Down Expand Up @@ -54,15 +55,10 @@ function countMatches(view: EditorView): number {
const ss = getSearchState(view.state);
if (!ss || !ss.query.valid) return 0;

let count = 0;
let result = ss.query.findNext(view.state, 0);
const seen = new Set<number>();
while (result && !seen.has(result.from)) {
seen.add(result.from);
count++;
result = ss.query.findNext(view.state, result.to);
}
return count;
// ⚑ Bolt Optimization: Use pre-calculated decorations instead of traversing the document again
// The prosemirror-search plugin already finds all matches and stores them as decorations.
// getMatchHighlights(...).find().length is O(M) (where M is number of matches) compared to O(N) (N = doc size) for the previous loop traversal.
return getMatchHighlights(view.state).find().length;
}

/** Update match count label. */
Expand Down
Loading