Skip to content

Task #768: Distribute 다단 column-break wrap-around (shortcut.hwp p3 정정)#772

Closed
planet6897 wants to merge 6 commits into
edwardkim:develfrom
planet6897:pr-task768
Closed

Task #768: Distribute 다단 column-break wrap-around (shortcut.hwp p3 정정)#772
planet6897 wants to merge 6 commits into
edwardkim:develfrom
planet6897:pr-task768

Conversation

@planet6897

Copy link
Copy Markdown
Contributor

Summary

  • 본질: 한컴 다단 분배의 column-break 처리는 ColumnType 에 따라 다름.
    • Distribute (배분) / Parallel (병행): column-break = col div 마감 신호 → 같은 페이지 내 새 zone 추가 (좌단/우단 추가행)
    • Normal (일반/신문형): column-break = 일반 텍스트 연속 등가 → 다음 단으로 advance, 마지막 단이면 페이지 break
  • 결함: rhwp 가 모든 다단 type 에서 마지막 단 + column-break 시 push_new_page 강제 → Distribute 다단(shortcut.hwp)에서 페이지 잔여 공간 무시하고 페이지 break
  • 정정: src/renderer/typeset.rs:417 column-break 분기에 ColumnType::Distribute | Parallel 가드 추가. 마지막 단 + Distribute/Parallel 시 advance_column_break_wrap_in_multi 호출 (같은 페이지 내 새 zone). Normal 다단은 기존 동작 유지

Root cause

src/renderer/typeset.rs:advance_column_or_new_pagecurrent_column + 1 >= col_count 시 무조건 push_new_page. PDF 권위(한글 2022) 의 Distribute 다단 동작은 col 0 으로 wrap-around (같은 다단 영역에 좌단/우단 추가행).

샘플 다단 유형 본 정정 영향
samples/basic/shortcut.hwp 배분 (Distribute) wrap-around (정정)
samples/exam_math.hwp 일반 (Normal) 영향 없음
samples/21_언어_기출_편집가능본.hwp 일반 (Normal) 영향 없음

정정

src/renderer/typeset.rs:417 column-break 분기에 ColumnType 가드:

let is_last_col_in_multi = st.col_count > 1
    && st.current_column + 1 >= st.col_count;
let is_distribute_or_parallel = matches!(
    st.current_zone_column_type,
    ColumnType::Distribute | ColumnType::Parallel
);
if is_last_col_in_multi && is_distribute_or_parallel {
    self.advance_column_break_wrap_in_multi(&mut st);
} else {
    st.advance_column_or_new_page();
}

advance_column_break_wrap_in_multi 보조 함수 신규 — process_multicolumn_break 의 zone 진입 로직 (zone_y_offset 누적, col=0, h=0) 을 ColumnDef 변경 없이 수행. 페이지 잔여 공간 1 line 미만 시 push_new_page 폴백.

검증

RED → GREEN

$ cargo test --test issue_768 -- --nocapture

[issue_768] pi=94 등장 페이지 인덱스 = 2 (page_count=7), PDF 권위 = 2
test issue_768_pi94_appears_on_page3_not_page4 ... ok

→ pi=94 ("<편집 화면 분할에서>") 등장 페이지 인덱스 3 → 2 (PDF 권위 정합).

회귀 (cargo test --release)

test result: ok. 1217 passed; 0 failed; 2 ignored;
  • 통합 테스트 회귀 0
  • 골든 SVG 7개 PASS
  • test_539 / test_548 / test_exam_math_page_count PASS

광범위 (205 샘플)

메트릭 Before After Δ
샘플 수 205 205
LAYOUT_OVERFLOW_DRAW 226 225 -1
LAYOUT_OVERFLOW 354 353 -1
페이지 수 변동 샘플 1 (shortcut 8→7)

샘플별 변경:

  • shortcut.hwp (Distribute): 페이지 8→7 (PDF 권위 7 정합 ✓)
  • 그 외 204 샘플: 변동 없음

shortcut.hwp 단독 영향. Newspaper / Distribute 미동반 다단 회귀 0.

PDF 정합

샘플 rhwp (after) PDF (한글 2022)
shortcut.hwp 7페이지 7페이지
exam_math.hwp 20페이지 20페이지 ✓

Test plan

  • cargo test --test issue_768 PASS (RED → GREEN)
  • cargo test --release 1217 passed, 0 failed (회귀 0)
  • 골든 SVG 회귀 0
  • 205 샘플 광범위: shortcut.hwp 만 변경 (의도된 정정)
  • PDF 권위 (한글 2022) 페이지 수 정합

closes #768

🤖 Generated with Claude Code

planet6897 and others added 6 commits May 10, 2026 13:00
shortcut.hwp 페이지 3 끝의 "<편집 화면 분할에서>" + "화면 이동" 행이
페이지 4 첫 줄로 밀리는 결함.

Root cause (정적 분석): typeset.rs:261-273 의 advance_column_or_new_page
가 마지막 단(current_column+1 == col_count)에서 column-break 만나면
무조건 push_new_page. PDF 권위(한글 2022)는 같은 다단 영역에 col 0
wrap-around (좌단 7행, 우단 7행).

정정 방향 (가설 H1): 다단 영역 마지막 단의 column-break 는 페이지
잔여 공간이 충분하면 col 0 으로 wrap-around, 부족 시만 push_new_page.

ref edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tests/issue_768.rs 신규. samples/basic/shortcut.hwp 의 pi=94
("<편집 화면 분할에서>") 가 PDF 권위(한글 2022) 정합 인덱스 2 (3쪽) 에
등장함을 단언.

RED 결과 (의도된 FAIL):
  pi=94 등장 페이지 인덱스 = 3 (page_count=8), PDF 권위 = 2
  → column-break 가 다단 영역 마지막 단에서 페이지 break 강제

부수 관찰: shortcut.hwp 4쪽에서 별개 LAYOUT_OVERFLOW (본 task 비범위).

ref edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Root cause: typeset.rs:417 의 column-break + has_diff_col_def=false +
last col 분기에서 push_new_page 강제 (페이지 잔여 공간 무시).

정정 시도 3 차례:
1. 무가드 wrap → 회귀 3건 (페이지 수 절반 수준)
2. vpos=0 가드 → 회귀 3건 (잔존)
3. vpos=0 + controls=0 가드 → 회귀 2건 (test_539, test_548)

본질: shortcut.hwp pi=94 (wrap 의도) 와 21_언어_기출_편집가능본.hwp
pi=44/71/... (push_new_page 의도) 가 단순 IR 필드 (column_type, vpos,
controls) 로 구분되지 않음. 다단 분배 algorithm 의 깊은 재설계가 필요.

src/renderer/typeset.rs revert. 회귀 0 (issue_768 만 FAIL — RED 유지).

옵션 A/B/C (revert/부분정정/RFC) 중 결정 요청.

ref edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…round

본질 (다단 유형별 column-break 동작):
- Distribute(배분) / Parallel(병행) 다단: column-break = col div 마감 신호
  → 마지막 단에서 같은 페이지 내 새 col div (zone) 추가
- Normal(일반/신문형) 다단: column-break = 일반 텍스트 연속과 등가
  → 마지막 단이면 페이지 break (기존 동작 유지)

src/renderer/typeset.rs:417-446 column-break 분기에 ColumnType 가드 추가.
advance_column_break_wrap_in_multi 보조 함수 신규 (process_multicolumn_break
의 zone 진입 로직 반영, ColumnDef/col_count/layout 변경 없이).

PDF 정합:
  shortcut.hwp:  8 → 7 (PDF 7) ✓ Distribute
  exam_math.hwp: 20    (PDF 20) ✓ Normal (영향 없음)
  21_언어_기출:  15    (영향 없음) ✓ Normal

회귀 검증:
  cargo test --release: 1217 passed; 0 failed; 2 ignored
  test_539 / test_548 / test_exam_math_page_count 모두 PASS

ref edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cargo test --release: 1217 passed, 0 failed (회귀 0)
205 샘플 광범위:
  shortcut.hwp만 변경: 8→7쪽 (PDF 7 정합), DRAW 12→11 (-1), FLOW 13→14 (+1)
  그 외 204 샘플: 변동 없음

ColumnType 가드 (Distribute/Parallel) 로 핀포인트 정정. Newspaper(일반)
다단 샘플은 영향 없음.

ref edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
본질: 한컴 다단 분배의 column-break 처리는 ColumnType 에 따라 다름.
- Distribute/Parallel: col div 마감 신호 (zone 추가)
- Normal: 일반 텍스트 연속과 등가 (advance/page break)

정정: src/renderer/typeset.rs:417 column-break 분기에 ColumnType 가드 추가.
Distribute/Parallel + 마지막 단 시 advance_column_break_wrap_in_multi 호출
(같은 페이지 내 새 zone). Normal 다단은 기존 동작 유지.

검증:
  RED → GREEN: pi=94 페이지 인덱스 3 → 2 (PDF 정합)
  cargo test: 1217 passed, 0 failed (회귀 0)
  205 샘플 광범위: shortcut.hwp만 변경 (8→7쪽, PDF 정합)
  PDF 정합: shortcut 7쪽, exam_math 20쪽 모두 일치

plans/task_m100_768{,_impl}.md → plans/archives/ 이동.

closes edwardkim#768

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant