fix: update colorizeCode calls to use new parameter order

The colorizeCode function signature was changed to have tabWidth as the
last parameter with a default value. Update all call sites to match.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-03-04 20:12:58 +08:00
parent 2819c7d887
commit 18f9e5ac34
3 changed files with 3 additions and 5 deletions

View file

@ -125,17 +125,17 @@ export function colorizeLine(
*
* @param code The code string to highlight.
* @param language The language identifier (e.g., 'javascript', 'css', 'html')
* @param tabWidth The tabWidth of the language, default is 4
* @param tabWidth The number of spaces to replace each tab character with, default is 4
* @returns A React.ReactNode containing Ink <Text> elements for the highlighted code.
*/
export function colorizeCode(
code: string,
language: string | null,
tabWidth = 4,
availableHeight?: number,
maxWidth?: number,
theme?: Theme,
settings?: LoadedSettings,
tabWidth = 4,
): React.ReactNode {
const codeToHighlight = code
.replace(/\n$/, '')

View file

@ -328,7 +328,6 @@ const RenderCodeBlockInternal: React.FC<RenderCodeBlockProps> = ({
const colorizedTruncatedCode = colorizeCode(
truncatedContent.join('\n'),
lang,
4,
availableTerminalHeight,
contentWidth - CODE_BLOCK_PREFIX_PADDING,
undefined,
@ -347,7 +346,6 @@ const RenderCodeBlockInternal: React.FC<RenderCodeBlockProps> = ({
const colorizedCode = colorizeCode(
fullContent,
lang,
4,
availableTerminalHeight,
contentWidth - CODE_BLOCK_PREFIX_PADDING,
undefined,