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/pomodoro-timer/src/index.tsx b/examples/pomodoro-timer/src/index.tsx index cad749f32..6444f948d 100644 --- a/examples/pomodoro-timer/src/index.tsx +++ b/examples/pomodoro-timer/src/index.tsx @@ -182,7 +182,7 @@ class GradientProgressBar extends Widget { const attrs = styleToCellAttrs(this._style); - const label = this._showLabel ? ` ${Math.round(this._value * 100)}%` : ''; + const label = this._showLabel ? ` ${Math.round(this._value * 100 + Number.EPSILON)}%` : ''; const barWidth = Math.max(0, width - label.length); const filled = this._value <= 0 ? 0 : Math.round(barWidth * this._value); const empty = barWidth - filled; 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; diff --git a/packages/ui/src/TreeSelect.ts b/packages/ui/src/TreeSelect.ts index 652ede256..2c3a59a97 100644 --- a/packages/ui/src/TreeSelect.ts +++ b/packages/ui/src/TreeSelect.ts @@ -182,7 +182,7 @@ function _pathsEqual(a: number[], b: number[]): boolean { function _valuesEqual(a: string[], b: string[]): boolean { if (a.length !== b.length) return false; - const sortedA = [...a].sort(); + const sortedA = [...a].sort((a, b) => a - b); const sortedB = [...b].sort(); for (let i = 0; i < sortedA.length; i++) { if (sortedA[i] !== sortedB[i]) return false;