-
Notifications
You must be signed in to change notification settings - Fork 230
fix: resolve 4 bugs in termui #3553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ function decodeEntities(value: string): string { | |
|
|
||
| return value.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (match, entity: string) => { | ||
| if (entity.startsWith('#x')) { | ||
| const codePoint = Number.parseInt(entity.slice(2), 16); | ||
| const codePoint = Number.parseInt(entity.slice(2, 10), 16); | ||
| return Number.isFinite(codePoint) ? String.fromCodePoint(codePoint) : match; | ||
|
Comment on lines
+30
to
31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: node <<'NODE'
const truncated = Number.parseInt('000000041'.slice(0, 8), 16);
console.log({ truncated });
try {
String.fromCodePoint(Number.parseInt('110000', 16));
process.exit(1);
} catch (error) {
console.log(error.name);
}
NODERepository: Karanjot786/TermUI Length of output: 184 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Files matching index.tsx:\n'
fd -a 'index\.tsx$' . | sed 's#^\./##'
printf '\nRelevant excerpt from examples/rss-reader/src/index.tsx:\n'
if [ -f examples/rss-reader/src/index.tsx ]; then
nl -ba examples/rss-reader/src/index.tsx | sed -n '1,80p'
else
echo 'not found'
fi
printf '\nSearch for decodeEntities usages:\n'
rg -n "decodeEntities|decodeEntity|&`#x`|`#x`|String\.fromCodePoint|fromCodePoint" examples/rss-reader/src || trueRepository: Karanjot786/TermUI Length of output: 2181 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Relevant excerpt from examples/rss-reader/src/index.tsx:\n'
awk '{printf "%6d %s\n", NR, $0}' examples/rss-reader/src/index.tsx | sed -n '1,100p'
printf '\nSearch for decodeEntities and code-point parsing usages:\n'
grep -RInE "decodeEntities|decodeEntity|&`#x`|`#x`|String\.fromCodePoint|fromCodePoint|Number\.parseInt" examples/rss-reader/src || trueRepository: Karanjot786/TermUI Length of output: 5050 Reject invalid hexadecimal entities before decoding.
🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,7 @@ async function fetchWeather() { | |
| } | ||
| } | ||
|
|
||
| setInterval(fetchWeather, 5000); | ||
| clearInterval(window.__interval); window.__interval = setInterval(fetchWeather, 5000); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 3 '__interval|interface Window|declare global' examples/weather --glob '*.{ts,tsx,d.ts}' || true
rg -n -C 2 '"strict"[[:space:]]*:[[:space:]]*true' --glob 'tsconfig*.json' --glob '!node_modules' || trueRepository: Karanjot786/TermUI Length of output: 582 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)tsconfig.*\.json$|examples/weather/src/index\.tsx$|\.d\.ts$|package\.json$|pnpm-lock\.yaml$|yarn\.lock$|package-lock\.json$' || true
echo "== example index relevant section =="
sed -n '180,215p' examples/weather/src/index.tsx | cat -n -v
echo "== ts configs =="
for f in $(git ls-files '*tsconfig*.json' 'packages/**/tsconfig*.json' 'apps/**/tsconfig*.json' '**/tsconfig*.json' | rg -v node_modules || true); do
echo "--- $f"
sed -n '1,80p' "$f"
done
echo "== window declarations repo-wide =="
rg -n -C 3 '^\s*(declare )?(interface|type|namespace)\s+Window\s*|declare global|__interval|interface\s+Global.*Window|--extends|--skipLibCheck|--noImplicitAny|--strict' . --glob '*.{ts,tsx,d.ts,json,yaml,yml}' --glob '!node_modules/**' || trueRepository: Karanjot786/TermUI Length of output: 21330 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== weather package metadata =="
cat examples/weather/package.json
echo "== root package scripts/typecheck =="
sed -n '1,160p' package.json
echo "== lockfile TS version candidates =="
for f in pnpm-lock.yaml package-lock.json yarn.lock; do
[ -f "$f" ] || continue
echo "--- $f"
rg -n 'typescript|`@types/node`|`@types/react`|`@termuijs`' "$f" | head -80 || true
done
echo "== examples/weather typecheck if TS is available =="
if command -v npx >/dev/null 2>&; then
(set -x; npx --package typescript -- tsc --version 2>&1);
npx --package typescript -- tsc --noEmit --strict --module ESNext --moduleResolution Bundler --target ES2022 examples/weather/src/index.tsx 2>&1 | sed -n '1,120p' || true
else
echo "npx not available"
fi
echo "== declare global occurrences excluding node_modules =="
rg -n -C 2 'declare global|interface Window|declare module' . --glob '!node_modules/**' || trueRepository: Karanjot786/TermUI Length of output: 1965 🏁 Script executed: #!/bin/bash
set -euo pipefail
cd examples/weather
if command -v bun >/dev/null 2>&1; then
echo "== bun tsc if available =="
bun tsc --version 2>&1 || true
bun tsc --noEmit 2>&1 | sed -n '1,160p'
else
echo "bun not available"
fi
echo "== node_modules/typescript availability =="
if [ -x node_modules/.bin/tsc ]; then
./node_modules/.bin/tsc --version
./node_modules/.bin/tsc --noEmit 2>&1 | sed -n '1,160p' || true
else
echo "node_modules/.bin/tsc not available"
fiRepository: Karanjot786/TermUI Length of output: 253 Declare
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| fetchWeather(); | ||
|
|
||
| // Gauge does not expose a public setColor() method, so dynamic color | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 187
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 3046
Apply the epsilon before scaling the percentage value.
Number.EPSILONis too small after multiplying by 100. For example,this._value = 29 / 200can produce14.499999999999998, so the current expression displays14%instead of15%.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents