Stop painting code green, and give each checkout its own emulator
Code is not a literal. Green is what this palette colours a literal, so painting a whole fenced block green said the block *was* one -- and it disagreed with the syntax highlighter a tool call's input already gets, where green means a string and peach means a number. Code blocks and inline spans now take the ordinary text colour; the monospace face and the tinted background are what say "this is code", which is the part colour was not doing. `codeColor` goes with it, since nothing else wanted a colour for code. Where a literal really does appear inside code, the thing that should colour it is a highlighter reading the code, not a rule about the container. `run-android.sh` derives its AVD name from the checkout instead of defaulting to a machine-wide `tdep`. That default made the emulator the one thing here that cannot be worked on in parallel: two clones of this repo meant asking whoever had it, waiting, and handing it back, and installing onto a running one takes the foreground from whatever they were looking at. Derived rather than written down, so neither clone names the other's, and `AVD_NAME=` still overrides for sharing one deliberately. Also: two things reported as markdown defects yesterday were not defects, and are worth recording so nobody fixes them twice. The table is not clipped -- it scrolls horizontally, which the renderer does whenever the columns are wider than the screen; a screenshot of one looks exactly like a clipped table, and swiping it shows the rest. The paragraph that appeared to break around an inline code span was an artifact of how the test text was sent through the echo driver, not of the renderer: sent as one message it flows correctly.
This commit is contained in:
1 parent
dde592ecb7
commit
2f4dff1435
3 files changed
+23
-18
No files matched your search
@@ -59,21 +59,28 @@ fun MarkdownText(text: String, modifier: Modifier = Modifier) {
|
||||
bullet = body,
|
||||
list = body,
|
||||
table = body,
|
||||
// Code in a monospace face: a code block set in the body font stops looking like
|
||||
// code at all. The colour rides on the style here rather than in `markdownColor`,
|
||||
// which stopped carrying `codeText`/`inlineCodeText`/`linkText` when the renderer
|
||||
// moved them onto the typography.
|
||||
// Code in a monospace face, in the ordinary text colour. The face and the tinted
|
||||
// background are what say "this is code"; colour is not, and it used to be green
|
||||
// -- the palette's colour for a *literal*. A block of code is not a literal, it
|
||||
// is text that happens to be code, and painting all of it green said the whole
|
||||
// block was one. Where a literal really does appear inside code, the thing that
|
||||
// should colour it is a syntax highlighter looking at the code, which is exactly
|
||||
// what a tool call's input already gets from `catppuccinSyntax`.
|
||||
//
|
||||
// The colour rides on the style here rather than in `markdownColor`, which
|
||||
// stopped carrying `codeText`/`inlineCodeText`/`linkText` when the renderer moved
|
||||
// them onto the typography.
|
||||
code =
|
||||
MaterialTheme.typography.bodyMedium.copy(
|
||||
fontFamily = FontFamily.Monospace,
|
||||
color = codeColor,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
),
|
||||
inlineCode =
|
||||
body.copy(
|
||||
fontFamily = FontFamily.Monospace,
|
||||
// Unspecified so an inline span keeps the size of the line it sits in.
|
||||
fontSize = TextUnit.Unspecified,
|
||||
color = codeColor,
|
||||
color = MaterialTheme.colorScheme.onSurface,
|
||||
),
|
||||
textLink =
|
||||
TextLinkStyles(
|
||||
|
||||
@@ -169,15 +169,6 @@ private const val WARNING_PERCENT = 75.0
|
||||
/** Close enough that the next turn may be the one that is refused. */
|
||||
private const val OVER_LIMIT_PERCENT = 90.0
|
||||
|
||||
/**
|
||||
* Code: a fenced block, an inline span, a tool's input.
|
||||
*
|
||||
* Green because on this palette it is what a literal is coloured as, and because code sits on
|
||||
* Surface 0 where the ordinary text colour would say nothing about it being code.
|
||||
*/
|
||||
val codeColor: Color
|
||||
@Composable get() = Mocha.Green
|
||||
|
||||
/**
|
||||
* Catppuccin Mocha as a syntax theme, for the highlighter used on a tool call's input.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user