mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
feat(ui): add terminal cursor support (#17711)
This commit is contained in:
@@ -71,6 +71,13 @@ export function cpLen(str: string): number {
|
||||
return toCodePoints(str).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a code point index to a UTF-16 code unit offset.
|
||||
*/
|
||||
export function cpIndexToOffset(str: string, cpIndex: number): number {
|
||||
return cpSlice(str, 0, cpIndex).length;
|
||||
}
|
||||
|
||||
export function cpSlice(str: string, start: number, end?: number): string {
|
||||
// Slice by code‑point indices and re‑join.
|
||||
const arr = toCodePoints(str).slice(start, end);
|
||||
|
||||
Reference in New Issue
Block a user