mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 00:05:24 +00:00
feat(tui, coding-agent): add configurable code block indent setting (#855)
Add markdown.codeBlockIndent setting to customize indentation prefix for rendered code blocks. Default remains 2 spaces for visual clarity, but setting to empty string removes indentation for easier copy/paste of code snippets to scripts, editors, or other tools. Changes: - tui: add optional codeBlockIndent to MarkdownTheme interface - coding-agent: add MarkdownSettings with codeBlockIndent property - coding-agent: compose theme with settings at call sites (no global state) - coding-agent: update message components to accept optional MarkdownTheme Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
This commit is contained in:
parent
46545276e3
commit
20c7b5fed4
11 changed files with 85 additions and 29 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Box, Markdown, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import { Box, Markdown, type MarkdownTheme, Spacer, Text } from "@mariozechner/pi-tui";
|
||||
import type { BranchSummaryMessage } from "../../../core/messages.js";
|
||||
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
||||
import { editorKey } from "./keybinding-hints.js";
|
||||
|
|
@ -10,10 +10,12 @@ import { editorKey } from "./keybinding-hints.js";
|
|||
export class BranchSummaryMessageComponent extends Box {
|
||||
private expanded = false;
|
||||
private message: BranchSummaryMessage;
|
||||
private markdownTheme: MarkdownTheme;
|
||||
|
||||
constructor(message: BranchSummaryMessage) {
|
||||
constructor(message: BranchSummaryMessage, markdownTheme: MarkdownTheme = getMarkdownTheme()) {
|
||||
super(1, 1, (t) => theme.bg("customMessageBg", t));
|
||||
this.message = message;
|
||||
this.markdownTheme = markdownTheme;
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +39,7 @@ export class BranchSummaryMessageComponent extends Box {
|
|||
if (this.expanded) {
|
||||
const header = "**Branch Summary**\n\n";
|
||||
this.addChild(
|
||||
new Markdown(header + this.message.summary, 0, 0, getMarkdownTheme(), {
|
||||
new Markdown(header + this.message.summary, 0, 0, this.markdownTheme, {
|
||||
color: (text: string) => theme.fg("customMessageText", text),
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue