Skip to content

[api] Paragraph::control_text_positions 추가 (옵션 A, #390)#405

Closed
DanMeon wants to merge 3 commits into
edwardkim:develfrom
DanMeon:feature/expose-control-text-positions
Closed

[api] Paragraph::control_text_positions 추가 (옵션 A, #390)#405
DanMeon wants to merge 3 commits into
edwardkim:develfrom
DanMeon:feature/expose-control-text-positions

Conversation

@DanMeon

@DanMeon DanMeon commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

변경 요약

이슈 #390 옵션 A 채택. document_core::find_control_text_positions 의 알고리즘 본체를 Paragraph::control_text_positions(&self) -> Vec<usize> 인스턴스 메서드로 캡슐화하여 외부 crate (third-party PyO3 / napi / JNI 등 binding) 에서 호출 가능하게 합니다.

src/document_core/helpers.rsfind_control_text_positionspub(crate) thin wrapper 로 유지되어 기존 26 caller (cursor / nav / 렌더러 / 책갈피 / 명령 / WASM) 동작 변경 없습니다. 의존성 방향 (model ← parser ← document_core) 보존을 위해 본체를 model::Paragraph 로 이동했습니다.

관련 이슈

closes #390

테스트

  • cargo test 통과
  • cargo clippy -- -D warnings 통과
  • 관련 샘플 파일로 SVG 내보내기 확인
  • 웹(WASM) 렌더링 확인 (해당하는 경우)

스크린샷

해당 없음 (API 노출, 시각적 변경 없음).

DanMeon and others added 3 commits April 28, 2026 11:15
…elpers wrapper 전환

- src/model/paragraph.rs: impl Paragraph 의 char_shape_id_at 다음에 pub fn control_text_positions(&self) -> Vec<usize> 신설. 알고리즘 본체 이식 (char_offsets 갭 분석).
- src/document_core/helpers.rs: find_control_text_positions 본체 → para.control_text_positions() thin wrapper. pub(crate) 가시성 유지로 26 caller 호환.
- 의존성 방향 model ← parser ← document_core 보존을 위해 알고리즘 본체를 model::Paragraph 로 이동.

mydocs/plans/task_m100_390.md, _impl.md 동봉.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- test_control_text_positions_empty: controls.is_empty() 분기
- test_control_text_positions_no_offsets_inline_sequential: fallback 인라인 컨트롤 (Table) 순차 배치
- test_control_text_positions_no_offsets_non_inline_skipped: fallback else 분기 (비인라인 Bookmark 는 pos 미증가)
- test_control_text_positions_gap_between_chars: 일반 분기 'AB' 사이 갭 분석
- test_control_text_positions_gap_before: 첫 문자 이전 갭
- test_control_text_positions_surrogate_pair_char_width: surrogate pair (U+1F389) UTF-16 width=2 분기 boundary

cargo test --lib 1022 passed (baseline upstream/devel @ 4828937 = 1016, +6 신규).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cargo test 1072 / cargo clippy -- -D warnings / samples/2010-01-06.hwp SVG 내보내기 6페이지 검증 통과.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim added a commit that referenced this pull request Apr 28, 2026
- PR #405 (Paragraph::control_text_positions, @DanMeon) 옵션 A cherry-pick 머지 완료
- 작업지시자 사전 PR 권유 사안 — 이슈 작성자 본인 정정
- 알고리즘 위치 이동 리팩토링 (외부 binding PyO3/napi/JNI 등 노출 위함)
- 검토 / 처리 보고서 추가
- 오늘할일 갱신

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

Copy link
Copy Markdown
Owner

완료. `devel` 에 cherry-pick (작성자 attribution 보존) 으로 머지됨 (commit `35c5c1d`).

이슈 #390 자동 close 됩니다 (PR 본문에 `closes #390` 명시).

머지 commit

작성자 attribution 보존:

  • `2c6727f` (cherry-pick, @DanMeon) — Stage 1: Paragraph::control_text_positions 메서드 + helpers wrapper 전환
  • `eeb1971` (cherry-pick, @DanMeon) — Stage 2: 단위 테스트 6건 추가
  • `13ffd0a` (cherry-pick, @DanMeon) — 최종 보고서

검증

  • `cargo test --lib`: 1037 passed (1031 → +6 신규)
  • `cargo test --test svg_snapshot`: 6/6
  • `cargo clippy --lib -- -D warnings`: warning 0건
  • WASM 빌드: 4,111,447 bytes
  • 본 PR 은 알고리즘 위치 이동 리팩토링 (변경 없음, 외부 가시성만 추가) 이라 시각 판정 불필요

평가

옵션 A (Paragraph 인스턴스 메서드 캡슐화) 선택이 long-term API 안정성 측면에서 적절했습니다 — helpers 모듈은 내부 구현으로 자유롭게 진화 가능하면서도 외부 binding (PyO3 / napi / JNI 등) 이 안정적인 surface 를 통해 호출 가능하게 됐습니다.

`rhwp-python` 작업에 본 변경이 도움이 되길 바랍니다. 외부 binding 사용 중 추가로 누락된 surface 가 있으면 이슈로 알려주세요.

좋은 기여 감사합니다.

@DanMeon

DanMeon commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

빠른 피드백 감사합니다!

edwardkim added a commit that referenced this pull request Apr 30, 2026
본 사이클 15번째 PR. PR #405 (DanMeon, v0.7.8) 와 같은 결의
외부 노출 작업. 이슈 #484 옵션 A — Paragraph::utf16_pos_to_char_idx
인스턴스 메서드 캡슐화.

cherry-pick 3 commits (DanMeon author 보존):
  - a068645 Stage 1: 메서드 신설
  - 36631fd Stage 2: 단위 테스트 6 추가
  - efa0054 최종 보고서

검증:
  - cargo test --lib: 1086 passed (1080 + 6)
  - svg_snapshot: 6/6, issue_418: 1/1, clippy: 0건

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim added a commit that referenced this pull request Apr 30, 2026
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.

2 participants