Skip to content

Commit

Permalink
fix incorrect type definition of text search match nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Jun 19, 2024
1 parent 2b920df commit 4ef46f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
4 changes: 2 additions & 2 deletions v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"watch": "concurrently -c auto npm:watch:bundle npm:watch:ts npm:watch:rs",
"watch:bundle": "npm run bundle -- --watch",
"watch:ts": "npm run lint:tsc -- --watch --preserveWatchOutput --pretty",
"watch:ts": "npm run lint:tsc -- --watch --preserveWatchOutput",
"watch:rs": "cargo watch --watch src --watch bench/benches -- cargo check --all --benches --color always",
"bundle": "node scripts/bundle.mjs",
"release": "npm run bundle -- --minify",
Expand All @@ -16,7 +16,7 @@
"fix:prettier": "prettier --write \"web/**/*.ts\" \"web/**/*.tsx\" scripts/bundle.mjs web/style.css",
"fix:eslint": "eslint --fix \"web/**/*.ts\" \"web/**/*.tsx\"",
"lint": "concurrently -c auto npm:lint:tsc npm:lint:clippy npm:lint:prettier npm:lint:rustfmt npm:lint:eslint npm:lint:stylelint",
"lint:tsc": "tsc --noEmit -p .",
"lint:tsc": "tsc --noEmit -p . --pretty",
"lint:clippy": "cargo clippy --color always --all-features --all --benches -- -D warnings",
"lint:prettier": "prettier --check \"web/**/*.ts\" \"web/**/*.tsx\" scripts/bundle.mjs web/style.css",
"lint:rustfmt": "cargo fmt --all --check -- --color always",
Expand Down
4 changes: 0 additions & 4 deletions v2/web/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,15 @@ export type RenderTreeElem =
}
| {
t: 'match'; // Text search match tokens after match-start
c: RenderTreeElem[];
}
| {
t: 'match-current'; // Current text search match tokens after match-current-start
c: RenderTreeElem[];
}
| {
t: 'match-start'; // First text search match token
c: RenderTreeElem[];
}
| {
t: 'match-current-start'; // First current text search match token
c: RenderTreeElem[];
};

export type MessageFromMain =
Expand Down
24 changes: 4 additions & 20 deletions v2/web/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,31 +504,15 @@ class RenderTreeToReact {
case 'modified':
return this.lastModified(key);
case 'match':
return (
<span key={key} className="search-text">
{await this.renderAll(elem.c)}
</span>
);
return <span key={key} className="search-text" />;
case 'match-current':
return (
<span key={key} className="search-text-current">
{await this.renderAll(elem.c)}
</span>
);
return <span key={key} className="search-text-current" />;
case 'match-start':
this.matchCount++;
return (
<span key={key} className="search-text-start">
{await this.renderAll(elem.c)}
</span>
);
return <span key={key} className="search-text-start" />;
case 'match-current-start':
this.matchCount++;
return (
<span key={key} className="search-text-current-start">
{await this.renderAll(elem.c)}
</span>
);
return <span key={key} className="search-text-current-start" />;
default:
log.error('Unknown render tree element:', JSON.stringify(elem));
return null;
Expand Down

0 comments on commit 4ef46f5

Please sign in to comment.