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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user