From 76f917813be3edc3c79f9e39a6849c8259279add Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sun, 27 Sep 2026 22:24:30 +0900 Subject: [PATCH] =?UTF-8?q?fix(spreadsheet):=20D=20=ED=8E=B8=EC=A7=91?= =?UTF-8?q?=EA=B8=B0=20=E2=80=94=20=ED=8B=80=EB=A6=B0=20=EC=8B=9D(?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=20=EC=88=98=20=EB=93=B1)=EC=9D=80=20Enter=20?= =?UTF-8?q?=EB=A1=9C=20=ED=99=95=EC=A0=95=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 확정 때 = 로 시작하면 parseFormula(sub3 a3434e3c) — 실패면 편집 유지 · 오류 알림 · 커서를 오류 자리로(엑셀처럼) - M02 [스프레드시트 시험] ORCA: =SUM() Enter 막힘 · 「SUM 인수가 너무 적음(1 개부터)」 알림 · =SUM(1,2) → 3 - 크기 시험 통과(화면 28,613 B) · D 규칙 시험 9 통과 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01L6KXAabDTenEU7hrDQmCKY --- A00_Common/spreadsheet/spreadsheet_editor.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/A00_Common/spreadsheet/spreadsheet_editor.ts b/A00_Common/spreadsheet/spreadsheet_editor.ts index fc4de019..3ede2592 100644 --- a/A00_Common/spreadsheet/spreadsheet_editor.ts +++ b/A00_Common/spreadsheet/spreadsheet_editor.ts @@ -13,7 +13,7 @@ import { moveFormula } from "./spreadsheet_refshift"; import { colName, parseA1, parseRange, rangeToA1, toA1 } from "./spreadsheet_address"; import { funcHelp, suggestFunctions, type FuncHelp } from "./spreadsheet_func_help"; import { defineName, resolveName } from "./spreadsheet_names"; -import { tokenize } from "./spreadsheet_parser"; +import { parseFormula, tokenize } from "./spreadsheet_parser"; import { cellsOf, move, selectCell } from "./spreadsheet_selection"; import { checkValue, findValidation } from "./spreadsheet_validation"; import type { Cell, CellAddress, CellStyle, Sheet } from "./spreadsheet_types"; @@ -356,9 +356,19 @@ export function createEditor(ctx: SpreadsheetContext): Editor { focus(); } - /** 칸에 적음 — 유효성(sub4) 「막음」 을 어기면 안 적고 false(편집 그대로 · 엑셀처럼 다시 치게) */ + /** 칸에 적음 — 식이 틀렸거나(인자 수 등) 유효성(sub4) 「막음」 을 어기면 안 적고 false(편집 그대로 · 엑셀처럼 다시 치게) */ function write(cells: CellAddress[], value: string, from: CellAddress): boolean { if (!st) return true; + const parsed = value.length > 1 && value[0] === "=" ? parseFormula(value) : null; + if (parsed && !parsed.ok) { + showToast(parsed.message, "error"); + const node = src(); + const at = Math.min(parsed.at + 1, node.value.length); + st.mode = "edit"; // 방향키가 글자 사이를 움직이게 + st.point = null; + node.setSelectionRange(at, at); + return false; + } const sheet = sheetOf(st.sheet); const out: Record = {}; const warn = new Set();