-
Notifications
You must be signed in to change notification settings - Fork 229
fix: resolve 4 bugs in termui #3660
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); | ||||||||||||||
|
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 Reject hexadecimal entities longer than eight digits instead of truncating them. Line 28 still matches an unlimited hexadecimal suffix. Line 30 then discards digits after the first eight. For example, Check the digit count and return Proposed fix- const codePoint = Number.parseInt(entity.slice(2, 10), 16);
+ const digits = entity.slice(2);
+ if (digits.length > 8) {
+ return match;
+ }
+ const codePoint = Number.parseInt(digits, 16);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| return Number.isFinite(codePoint) ? String.fromCodePoint(codePoint) : match; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| 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: #!/usr/bin/env bash
set -euo pipefail
node <<'NODE'
const value = 29 / 200;
const current = Math.round(value * 100 + Number.EPSILON);
const proposed = Math.round((value + Number.EPSILON) * 100);
if (current !== 14) {
throw new Error(`Expected current expression to produce 14, got ${current}`);
}
if (proposed !== 15) {
throw new Error(`Expected proposed expression to produce 15, got ${proposed}`);
}
NODERepository: Karanjot786/TermUI Length of output: 156 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf 'Current expression behavior for boundary values:\n'
node <<'NODE'
const boundaries = [29 / 200, 57 / 200, 85 / 200, 4 / 50, 6 / 50, 29 / 200000000, 1.000000012345678e-8, 2e-14, 1.3333333333333333e-8];
for (const value of boundaries) {
const scaled = value * 100;
const current = Math.round(scaled + Number.EPSILON);
const proposed = Math.round((value + Number.EPSILON) * 100);
console.log({
value,
roundedValue: scaled.toFixed(20),
current,
proposed
});
}
NODE
printf '\nRelevant src/index.ts context:\n'
sed -n '80,120p' examples/todo-app/src/index.tsRepository: Karanjot786/TermUI Length of output: 2869 Add
Proposed fix- const pct = Math.round(value * 100 + Number.EPSILON);
+ const pct = Math.round((value + 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.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Restore the missing negation operator.
event.ctrl !is invalid TypeScript syntax, so the application cannot compile. Use!event.ctrlto open the clear-form modal only for plainc; Ctrl+C remains handled by the quit branch on Lines 121-123.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents