fix(spreadsheet): 회계 0 구역 '?' 자리 빈칸 처리 · 통화 로캘 태그 대조 확인
브레인이 짐작한 [$-412](로캘만 · 기호 없음) 이 통화 기호로 잘못 바뀌는지 여러 실제 꼴(단순 태그·회계 네 구역·접두/접미 위치)로 대조해 봤으나 지금 코드는 이미 옳게 기호를 안 보임(회귀 시험으로 고정). 그 김에 회계 0 구역의 `"-"??` 관용구가 진짜 0 값에서 정수부 `?` 를 「0」 으로 채우던 것을 고쳐 엑셀처럼 빈칸으로 보이게 함. 사용자가 보고한 ₩ 는 이 두 경로로는 재현이 안 돼 — main_desktop_1 의 fixture_excel_user_won.html 이 아직 안 와서 실제 원문으로는 대조 못 함(오면 바로 대조). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RrQ65VtGZbae2VKgYVMhmc
This commit is contained in:
@@ -185,7 +185,11 @@ function renderNumericSection(toks: Tok[], magnitude: Frac): string {
|
||||
const rawFracStr = fracDigitToks.length > 0 ? allDigits.slice(-fracDigitToks.length) : "";
|
||||
|
||||
let intStr = rawIntStr;
|
||||
if (intDigitToks.length > intStr.length) {
|
||||
// 정수부가 온통 `?`(회계 형식 0 구역의 `"-"??` 자리맞춤 버릇)뿐이고 값이 정말 0 이면
|
||||
// 자리마다 빈칸(엑셀은 `?` 를 「있으면 숫자 · 없으면 빈칸」으로 봄 — `0` 처럼 0 을 안 채움).
|
||||
if (intDigitToks.length > 0 && rawIntStr === "0" && intDigitToks.every((t) => t.ch === "?")) {
|
||||
intStr = " ".repeat(intDigitToks.length);
|
||||
} else if (intDigitToks.length > intStr.length) {
|
||||
const need = intDigitToks.length - intStr.length;
|
||||
let pad = "";
|
||||
for (let i = 0; i < need; i++) pad += intDigitToks[i].ch === "0" ? "0" : "";
|
||||
|
||||
@@ -441,6 +441,16 @@ ok(
|
||||
fmt(frac(2n), '_-[$€-2]* #,##0.00_-;-[$€-2]* #,##0.00_-;_-[$€-2]* "-"??_-') === " €2.00 ",
|
||||
fmt(frac(2n), '_-[$€-2]* #,##0.00_-;-[$€-2]* #,##0.00_-;_-[$€-2]* "-"??_-'),
|
||||
);
|
||||
ok(
|
||||
"회계형 0 구역 '-'?? 는 자리만(0 안 보임)",
|
||||
fmt(frac(0n), '_-[$-412]* #,##0.00_-;-[$-412]* #,##0.00_-;_-[$-412]* "-"??_-') === " - ",
|
||||
JSON.stringify(fmt(frac(0n), '_-[$-412]* #,##0.00_-;-[$-412]* #,##0.00_-;_-[$-412]* "-"??_-')),
|
||||
);
|
||||
ok(
|
||||
"통화 로캘 태그만([$-412] · 기호 없음)은 통화 기호를 안 보임",
|
||||
!fmt(frac(2n), "[$-412]#,##0.00").includes("₩") && fmt(frac(2n), "[$-412]#,##0.00") === "2.00",
|
||||
fmt(frac(2n), "[$-412]#,##0.00"),
|
||||
);
|
||||
ok("따옴표 접두·접미", fmt(frac(800n), '"φ"###') === "φ800", fmt(frac(800n), '"φ"###'));
|
||||
ok(
|
||||
"음수 회계형",
|
||||
|
||||
Reference in New Issue
Block a user