mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 00:05:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react'
|
||||
import { Text } from '@anthropic/ink'
|
||||
import * as React from 'react';
|
||||
import { Text } from '@anthropic/ink';
|
||||
|
||||
/**
|
||||
* Inverse-highlight every occurrence of `query` in `text` (case-insensitive).
|
||||
@@ -7,23 +7,23 @@ import { Text } from '@anthropic/ink'
|
||||
* and preview panes.
|
||||
*/
|
||||
export function highlightMatch(text: string, query: string): React.ReactNode {
|
||||
if (!query) return text
|
||||
const queryLower = query.toLowerCase()
|
||||
const textLower = text.toLowerCase()
|
||||
const parts: React.ReactNode[] = []
|
||||
let offset = 0
|
||||
let idx = textLower.indexOf(queryLower, offset)
|
||||
if (idx === -1) return text
|
||||
if (!query) return text;
|
||||
const queryLower = query.toLowerCase();
|
||||
const textLower = text.toLowerCase();
|
||||
const parts: React.ReactNode[] = [];
|
||||
let offset = 0;
|
||||
let idx = textLower.indexOf(queryLower, offset);
|
||||
if (idx === -1) return text;
|
||||
while (idx !== -1) {
|
||||
if (idx > offset) parts.push(text.slice(offset, idx))
|
||||
if (idx > offset) parts.push(text.slice(offset, idx));
|
||||
parts.push(
|
||||
<Text key={idx} inverse>
|
||||
{text.slice(idx, idx + query.length)}
|
||||
</Text>,
|
||||
)
|
||||
offset = idx + query.length
|
||||
idx = textLower.indexOf(queryLower, offset)
|
||||
);
|
||||
offset = idx + query.length;
|
||||
idx = textLower.indexOf(queryLower, offset);
|
||||
}
|
||||
if (offset < text.length) parts.push(text.slice(offset))
|
||||
return <>{parts}</>
|
||||
if (offset < text.length) parts.push(text.slice(offset));
|
||||
return <>{parts}</>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user