[api] Paragraph::utf16_pos_to_char_idx 추가 (옵션 A, #484)#494
Closed
DanMeon wants to merge 3 commits into
Closed
Conversation
- src/model/paragraph.rs: impl Paragraph 의 control_text_positions 다음에 pub fn utf16_pos_to_char_idx(&self, utf16_pos: u32) -> usize 신설. helpers 의 free function 과 동일 알고리즘 (1줄 iter().position) 자체 보유. - src/document_core/helpers.rs: 변경 없음 — free function 시그니처 (raw &[u32]) 가 Paragraph 인스턴스를 받지 않아 wrapper 변환 불가. caller (cursor_nav, clipboard 5+ 라인) 변경을 회피하여 본 PR scope 외. - 코드 중복은 알고리즘 1줄 — silent drift 위험 trivial. mydocs/plans/task_m100_484.md, _impl.md 동봉. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- test_utf16_pos_to_char_idx_empty_offsets: char_offsets.is_empty() → unwrap_or(0) 분기
- test_utf16_pos_to_char_idx_zero_returns_first: utf16_pos = 0 → offsets[0] = 0 >= 0 첫 인덱스
- test_utf16_pos_to_char_idx_exact_match: offsets 정확값 매칭
- test_utf16_pos_to_char_idx_between_offsets: offsets 사이 값 (SMP "A🎉" 케이스)
- test_utf16_pos_to_char_idx_beyond_end_returns_len: utf16_pos > all → char_offsets.len() fallback
- test_utf16_pos_to_char_idx_surrogate_pair_midpoint: surrogate pair low half 위치 정규화 ("🎉A")
cargo test --lib 1081 passed (baseline upstream/devel @ 109bb04 = 1075, +6 신규).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cargo test --lib 1081 passed (baseline upstream/devel @ 109bb04 = 1075, +6 신규) / 변경 파일 (paragraph.rs, paragraph/tests.rs) clippy 깨끗. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
처리 결과: cherry-pick 머지 (commit PR #405 와 같은 결의 작업 — 이슈 #484 옵션 A 채택, cherry-pick 정합 (3 commits, author 보존)
검증
정합
후속본 PR 흡수 후 — 내부 호출자를 점진적으로 @DanMeon 일관된 결의 외부 노출 작업 흡수했습니다. PR #405 의 패턴 정합 + Hyperfall 절차 (Stage 별 commit + 보고서) 정합 — 흡수 후 추적 용이하게 작성됨. 본 PR close. |
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
본 사이클 본질: - Task #501 (cell.padding 한컴 방어 로직 모방 정정, closes #501) - PR #428 (oksure — 그룹 내 그림 직렬화) - PR #494 (DanMeon — Paragraph::utf16_pos_to_char_idx 외부 노출, #484) - PR #478 (planet6897 — 7 Task / 10 commits cherry-pick: #488/#490/#483/#489/#495/#480/#476) - PR #498 (seo-rii — Canvas visual diff 파이프라인, relates #364) 미흡수 + 분리: - 이슈 #502 (#495 잔존 — 문단 내 글상자 TextRun 처리) - 이슈 #503 (#479 미흡수 — 한컴 2020 시각 판정 필수) 버전 갱신: Cargo.toml + npm/editor + rhwp-studio + rhwp-vscode 모두 0.7.8 → 0.7.9. CHANGELOG (한/영) 갱신, rhwp-vscode/CHANGELOG.md 갱신. README 기여자 감사 누적 갱신 (cskwork/DanMeon/oksure/planet6897/seanshin/seo-rii 추가). 검증: cargo build OK, cargo test --lib 1102 passed, cargo clippy 0건, WASM 빌드 정합. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim
added a commit
that referenced
this pull request
May 1, 2026
본 사이클: - rhwp-chrome / Edge v0.2.2: 4 파일 버전 동기화 (manifest + package + dev-tools-inject + content-script — v0.2.0 hotfix 사례 정합) - rhwp-firefox v0.2.2: 동일 영역, content-script.js 는 manifest 동적 참조로 자동 정합 라이브러리 코어 v0.7.3 → v0.7.9 (4 사이클) 갱신 — Task #501 + PR #428/#494/#478/#498 누적 + v0.7.6/v0.7.7/v0.7.8 사이클 흡수. 등록 문구: - chrome-0.2.2_kor.md / chrome-0.2.2_eng.md (한/영) — Chrome/Edge 공통 + AMO 등록 정보 - edge-0.2.2_reviewer_notes.md — Edge 파트너 센터 Notes for certification (1,918자, 2,000자 한계 내) - chrome-0.2.1 한/영 등록 문구 백업 자기검열 grep (feedback_external_docs_self_censor 메모리 룰): 통과 AMO 4 함정 (feedback_amo_submission_gotchas 메모리 룰): 통과 빌드 환경: Node v22.18.0 (rolldown 호환). 빌드 결과: - rhwp-chrome.zip 16 MB - rhwp-firefox.zip 12.9 MB - rhwp-source-0fb3e67.zip 47.9 MB (AMO 소스 제출) 3 스토어 제출 완료: - Chrome Web Store (1~3 영업일 심사) - Microsoft Edge Add-ons (1~2 영업일) - Mozilla AMO (1~5 영업일) .gitignore: rhwp-chrome/*.zip, rhwp-firefox/*.zip, rhwp-firefox/dist/ 추가 (빌드 산출물 누적 차단) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
변경 요약
이슈 #484 옵션 A 채택.
helpers::utf16_pos_to_char_idx와 동일 알고리즘을Paragraph::utf16_pos_to_char_idx(&self, utf16_pos: u32) -> usize인스턴스 메서드로 추가하여 외부 crate (third-party PyO3 / napi / JNI 등 binding) 에서 호출 가능하게 합니다.PR #405 (
Paragraph::control_text_positions) 와 같은 결의 외부 노출입니다. 다만 본 helper 는 free function 시그니처 (char_offsets: &[u32], utf16_pos: u32) 가Paragraph인스턴스를 받지 않아 본체 이동 + thin wrapper 패턴 적용 불가 —helpers::utf16_pos_to_char_idx는 변경 없이 그대로 두고 (caller 5+ 라인 호환 유지), 메서드 본체만 자체 보유합니다. 알고리즘이 1줄 (iter().position(...).unwrap_or(...)) 짜리라 코드 중복으로 인한 silent drift 위험은 무시 가능합니다.관련 이슈
closes #484
테스트
cargo test --lib1081 passed / 0 failed / 1 ignored (baseline upstream/devel @ 109bb04 = 1075, +6 신규)cargo clippy --all-targets변경 파일 (paragraph.rs,paragraph/tests.rs) warning 0스크린샷
해당 없음 (API 노출, 시각적 변경 없음).