refactor(coding-agent/src): migrated keyword decorators to shared helper

- Replaced composed keyword decorators in `CustomEditor.decorateText` with `highlightMagicKeywords`.
- Adjusted `UserMessageComponent` rendering to use `highlightMagicKeywords` with `keywordReset` for consistent foreground.
This commit is contained in:
can1357
2026-05-31 09:47:24 +02:00
parent c637db9741
commit bfdbb3ff20
2 changed files with 12 additions and 6 deletions
@@ -1,8 +1,6 @@
import { Editor, type KeyId, matchesKey, parseKittySequence } from "@oh-my-pi/pi-tui";
import type { AppKeybinding } from "../../config/keybindings";
import { highlightOrchestrate } from "../orchestrate";
import { highlightUltrathink } from "../ultrathink";
import { highlightWorkflow } from "../workflow";
import { highlightMagicKeywords } from "../magic-keywords";
type ConfigurableEditorAction = Extract<
AppKeybinding,
@@ -47,8 +45,9 @@ const DEFAULT_ACTION_KEYS: Record<ConfigurableEditorAction, KeyId[]> = {
* Custom editor that handles configurable app-level shortcuts for coding-agent.
*/
export class CustomEditor extends Editor {
/** Gradient-highlight the "ultrathink" / "orchestrate" / "workflow" keywords as the user types them. */
decorateText = (text: string): string => highlightWorkflow(highlightOrchestrate(highlightUltrathink(text)));
/** Gradient-highlight the "ultrathink" / "orchestrate" / "workflow" keywords as the user types
* them, skipping any occurrence inside code spans, fenced blocks, or XML sections. */
decorateText = (text: string): string => highlightMagicKeywords(text);
onEscape?: () => void;
shouldBypassAutocompleteOnEscape?: () => boolean;
onClear?: () => void;