fix: COD-153 support terminal-focused command palette shortcuts

This commit is contained in:
Saqeb Akhter
2026-07-09 11:08:23 -04:00
committed by Aamer Akhter
parent ad25e234f4
commit c45e456b0e
6 changed files with 54 additions and 10 deletions
+7 -2
View File
@@ -257,12 +257,17 @@ Object.assign(CodemanApp.prototype, {
shouldOpenCommandPaletteFromShortcut(e) {
if (!e) return false;
if ((e.key || '').toLowerCase() !== 'k') return false;
if (!(e.metaKey || e.ctrlKey) || e.altKey) return false;
const key = (e.key || '').toLowerCase();
if (key !== 'k' && e.code !== 'KeyK') return false;
if (!(e.metaKey || e.ctrlKey || e.altKey)) return false;
const target = e.target;
if (!target) return true;
const tagName = (target.tagName || '').toUpperCase();
const className = typeof target.className === 'string' ? target.className : '';
const isXtermHelper =
target.classList?.contains?.('xterm-helper-textarea') || className.includes('xterm-helper-textarea');
if (isXtermHelper) return true;
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') return false;
if (target.isContentEditable) return false;
if (typeof target.closest === 'function' && target.closest('[contenteditable="true"]')) return false;