make native text widgets selection-aware (T-135)
Foundation for rendering the Claude conversation natively (T-132) with the cross-widget select+copy the terminal gives today. Converts the raw RichText in clide_markdown + clide_code_block to Text.rich, which registers with a Flutter SelectionArea's selection machinery (raw RichText does not). Adds a selectionBackground surface token (globalFocus at ~40% alpha, matching the terminal's selection tint) via tokens + resolver default; bundled palettes are untouched (D-69). Text and code blocks now select across each other under a SelectionArea; tables and tappable link-spans remain non-selectable islands for now. The selection contrast pair is intentionally not added to the WCAG gate: the tint is semi-transparent and the gate's neutral-grey compositor would false-fail it (documented in contrast.dart); deferred to the -hc/-cb pass. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,8 @@ class SurfaceTokens {
|
||||
required this.syntaxComment,
|
||||
required this.syntaxMethod,
|
||||
required this.syntaxPunct,
|
||||
// selection
|
||||
required this.selectionBackground,
|
||||
required this.extensionTokens,
|
||||
});
|
||||
|
||||
@@ -186,6 +188,11 @@ class SurfaceTokens {
|
||||
final Color syntaxMethod;
|
||||
final Color syntaxPunct;
|
||||
|
||||
/// Background color for text selection highlights. Rendered at ~40 % alpha
|
||||
/// (like the terminal's `globalFocus.withAlpha(0x66)`) so the selected text
|
||||
/// remains legible through the tint.
|
||||
final Color selectionBackground;
|
||||
|
||||
/// Extension-declared tokens keyed by their dotted path
|
||||
/// (e.g. `ext.sqlite.table.background`).
|
||||
final Map<String, Color> extensionTokens;
|
||||
@@ -296,6 +303,9 @@ abstract class TokenKeys {
|
||||
static const syntaxMethod = 'syntax.method';
|
||||
static const syntaxPunct = 'syntax.punct';
|
||||
|
||||
// selection
|
||||
static const selectionBackground = 'selection.background';
|
||||
|
||||
static const all = <String>[
|
||||
globalForeground,
|
||||
globalBackground,
|
||||
@@ -363,5 +373,6 @@ abstract class TokenKeys {
|
||||
syntaxComment,
|
||||
syntaxMethod,
|
||||
syntaxPunct,
|
||||
selectionBackground,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user