Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/forms-and-validation/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class FormsExampleApp extends Widget {
return false; // Quit
}

if (event.key === 'c' && event.ctrl === false) {
if (event.key === 'c' && event.ctrl !) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate and inspect the key section without running repository code.
printf 'File candidates:\n'
fd -a 'index\.tsx$' . | sed 's#^\./##' | grep 'examples/forms-and-validation/src/index.tsx' || true

printf '\nFile size:\n'
wc -l examples/forms-and-validation/src/index.tsx

printf '\nRelevant lines 110-130:\n'
sed -n '110,130p' examples/forms-and-validation/src/index.tsx | nl -ba -v110

printf '\nSearch shortcut-related lines:\n'
rg -n "event\.key|quit|clear|Ctrl|ctrl|modal|key==='c'|key === 'c'" examples/forms-and-validation/src/index.tsx

Repository: Karanjot786/TermUI

Length of output: 362


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Check TypeScript availability for a deterministic syntax/scope probe only if needed.
if command -v tsc >/dev/null 2>&1; then
  tsc --version
else
  echo 'tsc not installed'
fi

Repository: Karanjot786/TermUI

Length of output: 170


Use logical negation for the clear shortcut.

event.ctrl ! is a postfix non-null assertion, not !event.ctrl. Unmodified c therefore does not open the modal. Ctrl+C exits before this condition runs.

-        if (event.key === 'c' && event.ctrl !) {
+        if (event.key === 'c' && !event.ctrl) {
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (event.key === 'c' && event.ctrl !) {
if (event.key === 'c' && !event.ctrl) {
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/forms-and-validation/src/index.tsx` at line 125, Update the
clear-shortcut condition in the event-key handler to use logical negation of
event.ctrl, ensuring unmodified “c” opens the modal while Ctrl+C remains
unaffected.

this.modal.show();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ShowcaseApp extends Widget {
if (event.key === 'q' || (event.ctrl && event.key === 'c')) return false;

// Tab switching: 1-5
const num = parseInt(event.key);
const num = parseInt(event.key, 10);
if (num >= 1 && num <= 5) {
this.switchTab(num - 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class DevTools {
renderTimeMs: timeMs,
widgetCount,
lastRenderAt: now,
fps: Math.round(fps * 10) / 10,
fps: Math.round(fps * 10 + Number.EPSILON) / 10,
memoryMB: Math.round((process.memoryUsage?.().heapUsed ?? 0) / 1024 / 1024 * 10) / 10,
};
}
Expand Down
Loading