-
Notifications
You must be signed in to change notification settings - Fork 234
fix: resolve 4 bugs in termui #3684
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -104,7 +104,7 @@ class CustomMultiProgress extends (MultiProgressClass as any) { | |||||
| const value = Math.max(0, Math.min(1, item.value)); | ||||||
| const filled = Math.round(barWidth * value); | ||||||
|
|
||||||
| const pct = Math.round(value * 100); | ||||||
| const pct = Math.round(value * 100 + Number.EPSILON); | ||||||
|
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
node <<'NODE'
const value = 0.145;
const current = Math.round(value * 100 + Number.EPSILON);
if (current !== 15) {
process.exit(1);
}
NODERepository: Karanjot786/TermUI Length of output: 156 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n examples/todo-app/src/index.ts | sed -n '90,115p'
node --version
node - <<'NODE'
console.log({
value: 0.145,
product: 0.145 * 100,
current: Math.round(0.145 * 100 + Number.EPSILON),
beforeScale: Math.round((0.145 + Number.EPSILON) * 100),
scaledEpsilon: Math.round(0.145 * 100 + Number.EPSILON * 100),
});
NODERepository: Karanjot786/TermUI Length of output: 1605 Scale the epsilon before rounding the percentage. Adding Proposed fix- const pct = Math.round(value * 100 + Number.EPSILON);
+ const pct = Math.round(value * 100 + Number.EPSILON * 100);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| const percentStr = ` ${pct}% `; | ||||||
| const showPct = barWidth >= percentStr.length; | ||||||
| const labelStart = showPct ? Math.floor((barWidth - percentStr.length) / 2) : -1; | ||||||
|
|
||||||
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 156
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 3382
Reject invalid hexadecimal entities before decoding.
Hexadecimal entities that do not match exactly 1–8 hex digits cause
Number.isFinite(...)to returnfalse, so valid inputs such asfall through to the replacement text. Use the captured hex substring as the parsed value and reject empty values before callingNumber.parseInt.🤖 Prompt for AI Agents