From 1ba075ced0aa03fd21f4ec95ace047d803678374 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 14:13:41 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/calculator/src/index.tsx | 2 +- examples/rss-reader/src/index.tsx | 2 +- packages/ui/src/Form.ts | 2 ++ scripts/build-registry.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/calculator/src/index.tsx b/examples/calculator/src/index.tsx index 852911990..a2ed8284b 100644 --- a/examples/calculator/src/index.tsx +++ b/examples/calculator/src/index.tsx @@ -403,7 +403,7 @@ class CalculatorApp extends Widget { } private evaluate() { - if (this.expression.trim() === "") return; + if (this.expression.trim().length === 0) return; const oldExpr = this.expression; this.result = safeEval(this.expression); if (this.result !== null && !this.result.startsWith("Error")) { diff --git a/examples/rss-reader/src/index.tsx b/examples/rss-reader/src/index.tsx index 2b269cb81..5ff542b3f 100644 --- a/examples/rss-reader/src/index.tsx +++ b/examples/rss-reader/src/index.tsx @@ -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; } diff --git a/packages/ui/src/Form.ts b/packages/ui/src/Form.ts index bf96ede6b..38d630037 100644 --- a/packages/ui/src/Form.ts +++ b/packages/ui/src/Form.ts @@ -138,3 +138,5 @@ export class Form extends Widget { } } } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file diff --git a/scripts/build-registry.ts b/scripts/build-registry.ts index f84844538..01abfbde1 100644 --- a/scripts/build-registry.ts +++ b/scripts/build-registry.ts @@ -44,7 +44,7 @@ export function collectDeps(content: string): string[] { const deps = new Set(); let m: RegExpExecArray | null; while ((m = re.exec(content)) !== null) deps.add(m[1]!); - return [...deps].sort(); + return [...deps].sort((a, b) => a - b); } export function toSlug(name: string): string {