From c182bced3133105f78df8bf860dd20011216e882 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Tue, 4 Aug 2026 15:01:46 +0530 Subject: [PATCH] fix: resolve 4 bugs in termui --- examples/calculator/src/index.tsx | 2 +- examples/forms-and-validation/src/index.tsx | 2 +- examples/todo-app/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/calculator/src/index.tsx b/examples/calculator/src/index.tsx index 852911990..328248060 100644 --- a/examples/calculator/src/index.tsx +++ b/examples/calculator/src/index.tsx @@ -85,7 +85,7 @@ function safeEval(expr: string): string { if (tokens.length === 0) return '0'; // Handle initial negative number - if (tokens[0] === '-' && tokens.length > 1 && !isNaN(Number(tokens[1]))) { + if (tokens[0] === '-' && tokens.length > 1 && !Number.isNaN(Number(tokens[1]))) { tokens.splice(0, 2, '-' + tokens[1]); } diff --git a/examples/forms-and-validation/src/index.tsx b/examples/forms-and-validation/src/index.tsx index e8a9bb4ea..4ac42a672 100644 --- a/examples/forms-and-validation/src/index.tsx +++ b/examples/forms-and-validation/src/index.tsx @@ -122,7 +122,7 @@ class FormsExampleApp extends Widget { return false; // Quit } - if (event.key === 'c' && event.ctrl === false) { + if (event.key === 'c' && event.ctrl !) { this.modal.show(); return true; } diff --git a/examples/todo-app/src/index.ts b/examples/todo-app/src/index.ts index d26035d3c..d4cf9b550 100644 --- a/examples/todo-app/src/index.ts +++ b/examples/todo-app/src/index.ts @@ -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); const percentStr = ` ${pct}% `; const showPct = barWidth >= percentStr.length; const labelStart = showPct ? Math.floor((barWidth - percentStr.length) / 2) : -1;