diff --git a/packages/cli/src/ui/utils/InlineMarkdownRenderer.test.ts b/packages/cli/src/ui/utils/InlineMarkdownRenderer.test.ts deleted file mode 100644 index 11fb6d56eb..0000000000 --- a/packages/cli/src/ui/utils/InlineMarkdownRenderer.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import { getPlainTextLength } from './InlineMarkdownRenderer.js'; -import { describe, it, expect } from 'vitest'; - -describe('getPlainTextLength', () => { - it.each([ - ['**Primary Go', 12], - ['*Primary Go', 11], - ['**Primary Go**', 10], - ['*Primary Go*', 10], - ['**', 2], - ['*', 1], - ['compile-time**', 14], - ])( - 'should measure markdown text length correctly for "%s"', - (input, expected) => { - expect(getPlainTextLength(input)).toBe(expected); - }, - ); -}); diff --git a/packages/cli/src/ui/utils/InlineMarkdownRenderer.tsx b/packages/cli/src/ui/utils/InlineMarkdownRenderer.tsx index 8d4c6a7da6..0418582919 100644 --- a/packages/cli/src/ui/utils/InlineMarkdownRenderer.tsx +++ b/packages/cli/src/ui/utils/InlineMarkdownRenderer.tsx @@ -7,7 +7,6 @@ import React from 'react'; import { Text } from 'ink'; import { theme } from '../semantic-colors.js'; -import stringWidth from 'string-width'; import { debugLogger } from '@google/gemini-cli-core'; // Constants for Markdown parsing @@ -171,19 +170,3 @@ const RenderInlineInternal: React.FC = ({ }; export const RenderInline = React.memo(RenderInlineInternal); - -/** - * Utility function to get the plain text length of a string with markdown formatting - * This is useful for calculating column widths in tables - */ -export const getPlainTextLength = (text: string): number => { - const cleanText = text - .replace(/\*\*(.*?)\*\*/g, '$1') - .replace(/\*(.+?)\*/g, '$1') - .replace(/_(.*?)_/g, '$1') - .replace(/~~(.*?)~~/g, '$1') - .replace(/`(.*?)`/g, '$1') - .replace(/(.*?)<\/u>/g, '$1') - .replace(/.*\[(.*?)\]\(.*\)/g, '$1'); - return stringWidth(cleanText); -};