fix(tui): add eslint-disable for intentional control character regex
The regex is intentionally matching ANSI escape sequences which contain control characters. Added disable comment and fixed formatting.
This commit is contained in:
parent
6933def1d7
commit
5c16ea9f55
@ -143,6 +143,7 @@ export class SearchableSelectList implements Component {
|
|||||||
for (const token of uniqueTokens) {
|
for (const token of uniqueTokens) {
|
||||||
// CRITICAL FIX: Skip ANSI escape sequences to avoid breaking color codes
|
// CRITICAL FIX: Skip ANSI escape sequences to avoid breaking color codes
|
||||||
// Split text into ANSI and visible parts, only highlight visible parts
|
// Split text into ANSI and visible parts, only highlight visible parts
|
||||||
|
// eslint-disable-next-line no-control-regex -- intentional: matching ANSI escape sequences
|
||||||
const ansiRegex = /\x1b\[[0-9;]*m/g;
|
const ansiRegex = /\x1b\[[0-9;]*m/g;
|
||||||
const parts: Array<{ text: string; isAnsi: boolean }> = [];
|
const parts: Array<{ text: string; isAnsi: boolean }> = [];
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
@ -273,9 +274,7 @@ export class SearchableSelectList implements Component {
|
|||||||
const truncatedDesc = truncateToWidth(item.description, remainingWidth, "");
|
const truncatedDesc = truncateToWidth(item.description, remainingWidth, "");
|
||||||
// Highlight first, then apply theme - avoids breaking ANSI codes
|
// Highlight first, then apply theme - avoids breaking ANSI codes
|
||||||
const highlightedDesc = this.highlightMatch(truncatedDesc, query);
|
const highlightedDesc = this.highlightMatch(truncatedDesc, query);
|
||||||
const descText = isSelected
|
const descText = isSelected ? highlightedDesc : this.theme.description(highlightedDesc);
|
||||||
? highlightedDesc
|
|
||||||
: this.theme.description(highlightedDesc);
|
|
||||||
const line = `${prefix}${valueText}${spacing}${descText}`;
|
const line = `${prefix}${valueText}${spacing}${descText}`;
|
||||||
const rendered = isSelected ? this.theme.selectedText(line) : line;
|
const rendered = isSelected ? this.theme.selectedText(line) : line;
|
||||||
return this.ensureLineWidth(rendered, width);
|
return this.ensureLineWidth(rendered, width);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user