-
Notifications
You must be signed in to change notification settings - Fork 14.6k
feat: Port TUI customizations from my-claude-code #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| import * as React from 'react' | ||
| import { memo, useEffect, useMemo, useRef, useState } from 'react' | ||
| import { useSettings } from '../hooks/useSettings.js' | ||
| import { | ||
| Ansi, | ||
| Box, | ||
|
|
@@ -34,20 +33,14 @@ export const HighlightedCode = memo(function HighlightedCode({ | |
| const ref = useRef<DOMElement>(null) | ||
| const [measuredWidth, setMeasuredWidth] = useState(width || DEFAULT_WIDTH) | ||
| const [theme] = useTheme() | ||
| const settings = useSettings() | ||
| const syntaxHighlightingDisabled = | ||
| settings.syntaxHighlightingDisabled ?? false | ||
|
|
||
| const colorFile = useMemo(() => { | ||
| if (syntaxHighlightingDisabled) { | ||
| return null | ||
| } | ||
| const ColorFile = expectColorFile() | ||
| if (!ColorFile) { | ||
| return null | ||
| } | ||
| return new ColorFile(code, filePath) | ||
| }, [code, filePath, syntaxHighlightingDisabled]) | ||
| }, [code, filePath]) | ||
|
Comment on lines
37
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the env-based disable in the fallback path.
💡 Minimal fix-import { expectColorFile } from './StructuredDiff/colorDiff.js'
+import {
+ expectColorFile,
+ getColorModuleUnavailableReason,
+} from './StructuredDiff/colorDiff.js' const [theme] = useTheme()
+ const syntaxHighlightingUnavailable =
+ getColorModuleUnavailableReason() !== null
const colorFile = useMemo(() => {
const ColorFile = expectColorFile()
if (!ColorFile) {
return null
@@
<HighlightedCodeFallback
code={code}
filePath={filePath}
dim={dim}
- skipColoring={false}
+ skipColoring={syntaxHighlightingUnavailable}
/>Also applies to: 88-93 🤖 Prompt for AI Agents |
||
|
|
||
| useEffect(() => { | ||
| if (!width && ref.current) { | ||
|
|
@@ -69,7 +62,7 @@ export const HighlightedCode = memo(function HighlightedCode({ | |
| // line number (max_digits = lineCount.toString().length) + space. No marker | ||
| // column like the diff path. Wrap in <NoSelect> so fullscreen selection | ||
| // yields clean code without line numbers. Only split in fullscreen mode | ||
| // (~4× DOM nodes + sliceAnsi cost); non-fullscreen uses terminal-native | ||
| // (~4x DOM nodes + sliceAnsi cost); non-fullscreen uses terminal-native | ||
| // selection where noSelect is meaningless. | ||
| const gutterWidth = useMemo(() => { | ||
| if (!isFullscreenEnvEnabled()) return 0 | ||
|
|
@@ -96,7 +89,7 @@ export const HighlightedCode = memo(function HighlightedCode({ | |
| code={code} | ||
| filePath={filePath} | ||
| dim={dim} | ||
| skipColoring={syntaxHighlightingDisabled} | ||
| skipColoring={false} | ||
| /> | ||
| )} | ||
| </Box> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.