-
Notifications
You must be signed in to change notification settings - Fork 229
fix: resolve 4 bugs in termui #3511
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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,7 +113,7 @@ async function promptSelect<T = string>(options: SelectPromptOptions<T>): Promis | |||||||
| return; | ||||||||
| } | ||||||||
| const n = parseInt(trimmed, 10); | ||||||||
| if (!isNaN(n) && n >= 1 && n <= choices.length) { | ||||||||
| if (!Number.isNaN(n) && n >= 1 && n <= choices.length) { | ||||||||
|
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 malformed select input.
Proposed fix- const n = parseInt(trimmed, 10);
- if (!Number.isNaN(n) && n >= 1 && n <= choices.length) {
+ const n = Number(trimmed);
+ if (Number.isInteger(n) && n >= 1 && n <= choices.length) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| rl.close(); | ||||||||
| resolve(choices[n - 1].value); | ||||||||
| return; | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,7 +44,7 @@ export function collectDeps(content: string): string[] { | |||||
| const deps = new Set<string>(); | ||||||
| let m: RegExpExecArray | null; | ||||||
| while ((m = re.exec(content)) !== null) deps.add(m[1]!); | ||||||
| return [...deps].sort(); | ||||||
| return [...deps].sort((a, b) => a - b); | ||||||
|
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 | 🔴 Critical | ⚡ Quick win Use a string comparator for dependency names.
Use the default lexicographic sort: Proposed fix- return [...deps].sort((a, b) => a - b);
+ return [...deps].sort();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| } | ||||||
|
|
||||||
| export function toSlug(name: string): string { | ||||||
|
|
||||||
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: 4865
Apply the epsilon before percentage scaling.
Number.EPSILONis added aftervalue * 100, where it is too small to correct half-boundary floating-point errors. For example,0.285 * 100rounds down to28, while adding the epsilon before* 100rounds it to29.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents