Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,22 @@ function impactRow(diff: string, onTouched: (names: string[]) => void): HTMLElem
return row;
}

/**
* 승인 카드 제목. 파일 수정은 "파일 수정: 경로"를 이름과 폴더로 나눠, 이름은 한 덩어리로 두고
* 폴더는 흐리게 `/` 뒤에서만 줄을 바꾼다 (글자 중간에서 "tokenize.r / s"로 꺾이지 않게).
*/
function approvalTitle(title: string, isEdit: boolean): HTMLElement {
const m = isEdit ? title.match(/^(.+?): (.+)$/) : null;
if (!m) return h("span", { class: "atitle" }, title);
const [, label, path] = m;
const dir = dirname(path);
const parts = dir ? dir.split("/").flatMap((p) => [p + "/", h("wbr")]) : [];
return h("span", { class: "atitle", title: path },
h("span", { class: "alabel" }, label), " ",
h("span", { class: "aname" }, basename(path)),
dir ? h("span", { class: "adir" }, ...parts) : null);
}

/** 되돌리기. 그 뒤로 다른 곳에서 바뀐 파일이 있으면 한 번 더 묻는다. 취소하면 null */
export async function revertSafely(cp: string): Promise<number | null> {
try {
Expand Down Expand Up @@ -450,7 +466,7 @@ function handle(ev: AgentEvent) {
const newPath = isEdit ? ev.detail.match(/^\+\+\+ (?:b\/)?(.+)$/m)?.[1]?.trim() : undefined;
if (newPath) task.approvalPaths.set(ev.id, newPath);
const el = h("div", { class: "approval", role: "group", "aria-label": ev.title },
h("div", { class: "ahead" }, codicon(isEdit ? "edit" : "terminal"), h("span", { class: "atitle" }, ev.title), h("span", { class: "verdict" })),
h("div", { class: "ahead" }, codicon(isEdit ? "edit" : "terminal"), approvalTitle(ev.title, isEdit), h("span", { class: "verdict" })),
isEdit ? renderDiff(ev.detail) : h("pre", { class: "diff" }, h("div", {}, ev.detail)),
target && !replaying ? impactRow(ev.detail, (names) => {
task.approvalTouched.set(ev.id, names);
Expand Down
2 changes: 2 additions & 0 deletions app/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
"새 키를 누르세요 (Esc 취소)": "Press a new key (Esc to cancel)",
"새 터미널": "New Terminal",
"새 파일": "New File",
"파일 수정": "Edit file",
"파일 덮어쓰기": "Overwrite file",
"새 파일…": "New File…",
"새 폴더": "New Folder",
"새 폴더…": "New Folder…",
Expand Down
4 changes: 3 additions & 1 deletion app/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ kbd { font: 11px/1 var(--ui-font); display: inline-block; background: var(--sunk
.approval { border: 1px solid var(--warning); border-radius: var(--radius); background: var(--elevated); overflow: hidden; }
.approval .ahead { padding: 8px 10px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); font-size: 12px; background: var(--warning-soft); }
.approval .ahead .codicon { font-size: 14px; color: var(--warning); }
.approval .atitle { flex: 1; word-break: break-all; font-weight: 600; }
.approval .atitle { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
/* 파일 이름은 한 덩어리로, 폴더는 흐리게 `/` 뒤에서만 줄바꿈 (이름이 칸보다 길 때만 글자 단위) */
.approval .adir { margin-left: 6px; font-weight: 400; color: var(--muted); }
.approval .actions { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); align-items: center; }
.approval .actions .hint { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.approval.resolved { border-color: var(--border); }
Expand Down