Skip to content

feat: page:new-page-num (새 번호로 시작) 커맨드 구현#755

Closed
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/new-page-number
Closed

feat: page:new-page-num (새 번호로 시작) 커맨드 구현#755
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/new-page-number

Conversation

@oksure

@oksure oksure commented May 9, 2026

Copy link
Copy Markdown
Contributor

문제

쪽 > 새 번호로 시작 (page:new-page-num) 커맨드가 스텁으로 남아 있어 메뉴에서 비활성 상태입니다.

수정 내용

NumberingRestartDialog

시작 번호를 입력받는 간단한 대화상자입니다. ModalDialog 패턴을 따릅니다.

커맨드 구현

  1. 현재 커서 위치의 섹션/문단 인덱스를 확인
  2. NumberingRestartDialog에서 시작 번호 입력
  3. setNumberingRestart(sec, para, mode=2, startNum) WASM API 호출
    • mode=2: NewStart (새 번호로 시작)
  4. document-changed 이벤트 발행

테스트

  • cargo test 통과
  • cargo clippy -- -D warnings 경고 없음

감사합니다.

- NumberingRestartDialog 추가 (시작 번호 입력 대화상자)
- setNumberingRestart WASM API (mode=2, NewStart) 활용
- 현재 커서 위치의 문단에 쪽번호 재시작 설정

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 9, 2026 15:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the previously stubbed “page:new-page-num (새 번호로 시작)” command by adding a small modal dialog to capture the start number and invoking the WASM API to apply numbering restart at the current cursor location.

Changes:

  • Added NumberingRestartDialog modal for entering the restart start number.
  • Implemented page:new-page-num command to call wasm.setNumberingRestart(..., mode=2, startNum) and emit document-changed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
rhwp-studio/src/ui/numbering-restart-dialog.ts Adds a modal dialog UI to input the “start number” for numbering restart.
rhwp-studio/src/command/commands/page.ts Replaces the stubbed command with a real implementation that opens the dialog and calls the WASM API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +42
protected onConfirm(): void {
const num = parseInt(this.input.value, 10);
if (num >= 1) {
this.callback(num);
}
Comment on lines +7 to +13
constructor(currentPage: number, callback: (startNum: number) => void) {
super('새 번호로 시작', 300);
this.callback = callback;
this.defaultValue = currentPage;
}

private defaultValue: number;
Comment on lines +276 to +283
const ih = services.getInputHandler();
if (!ih) return;
const pos = ih.getPosition();
const dlg = new NumberingRestartDialog(1, (startNum) => {
try {
services.wasm.setNumberingRestart(pos.sectionIndex, pos.paragraphIndex, 2, startNum);
services.eventBus.emit('document-changed');
} catch (err) {
- constructor 파라미터 currentPage → defaultStartNum 변경
- onConfirm에서 잘못된 입력 시 false 반환 (대화상자 유지)
- 호출부에서 실제 현재 페이지 번호 전달 (cursor.rect.pageIndex + 1)

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

oksure commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

Copilot 리뷰 피드백을 e3091b39에서 반영했습니다:

  • constructor 파라미터 currentPagedefaultStartNum으로 명확화
  • onConfirm에서 유효하지 않은 입력(NaN, < 1) 시 false 반환 → 대화상자 유지 + 빨간 테두리 표시
  • 호출부에서 cursor.rect.pageIndex + 1 (현재 페이지 번호) 전달

@edwardkim

Copy link
Copy Markdown
Owner

@oksure 리뷰 영역 영역 본질 결함 발견되어 close 영역 영역 본질 정정 후 별 PR 영역 영역 재요청 부탁드립니다. 감사합니다.

본질 진단

본 PR 의 setNumberingRestart(sec, para, mode=2, startNum) 영역 영역 paragraph numbering (1.1.1 / 가, 나 같은 자동 번호 매기기) 영역 영역 재시작하는 API. 페이지 번호 (쪽번호) 영역 영역 무관.

본 환경 점검 결과:

영역 의미 본 환경 영역 영역 API
paragraph numbering HWP "번호 매기기" 형식 영역 영역 1.1.1, 가, 나 자동 번호 카운터 setNumberingRestart (본 PR 영역 영역 호출)
page number (쪽번호) footer 의 "1쪽, 2쪽" 영역 영역 페이지 번호 NewNumber 컨트롤 영역 (WASM 삽입 API 미구현)

본 환경 입증

  • src/document_core/commands/formatting.rs:1141 set_numbering_restart_nativeparagraph.numbering_restart = NewStart(N) 설정만 함
  • src/renderer/layout.rs:96 advance — paragraph numbering counter 영역 영역 사용 영역 영역, 페이지 번호 영역 영역 미참조
  • src/renderer/page_number.rs 영역 영역 numbering_restart 미참조 — 페이지 번호 영역 영역 무관 입증
  • NewNumber 컨트롤 (src/model/control.rs:38) 영역 영역 model 영역 존재 영역 영역, WASM 영역 영역 삽입 API 부재

작업지시자 시각 검증 결과

"새 번호로 시작 > 대화창에서 특정 페이지 시작번호를 1로 설정해도 기존 쪽번호 업데이트 되지 않습니다."
→ 페이지 번호 영역 영역 paragraph numbering 영역 영역 잘못 매핑 영역 영역 결함 입증.

별 PR 권장 방향

페이지 번호 새 시작 영역 영역 본질:

  1. WASM API 신규insertNewNumber(sec, para, startNum) (paragraph 영역 영역 NewNumber 컨트롤 삽입)
  2. page:new-page-num 커맨드 영역 영역 신규 API 호출 영역 영역 변경
  3. PR Task #634: 첫 NewNumber Page 발화 전 쪽번호 미표시 — 한컴 호환 #745 (Task 한컴 호환: 첫 NewNumber Page 컨트롤 발화 전 페이지의 쪽번호 미표시 #634 NewNumber Page 한컴 호환) 영역 영역 정합 영역 영역 시각 검증

본 PR 영역 영역 NumberingRestartDialog UI + 호출 인프라 영역 영역 정합 — 다만 호출 대상 WASM API 영역 영역 setNumberingRestartinsertNewNumber (신규 영역) 영역 영역 변경 필요.

처리 결정

본 환경 영역 영역 cherry-pick reset 영역 영역 PR #755 commits 제거. 별 PR 영역 영역 본질 정정 후 재요청 부탁드립니다.

보존 영역

  • NumberingRestartDialog UI 클래스 영역 영역 별 PR 영역 영역 재사용 가능
  • ModalDialog 패턴 영역 영역 정합

수고하셨습니다.

@edwardkim

Copy link
Copy Markdown
Owner

본질 결함 발견 영역 영역 close — setNumberingRestart 영역 영역 paragraph numbering 영역 영역 페이지 번호 영역 영역 무관. 별 PR 영역 영역 NewNumber 컨트롤 삽입 WASM API 영역 영역 본질 정정 후 재요청 부탁드립니다.

@edwardkim edwardkim closed this May 10, 2026
edwardkim added a commit that referenced this pull request May 10, 2026
PR #755 (Issue 미연결, close) 처리 보고서 + 검토 문서 archives 이동 + 5/10 orders 22번째 PR 시도 행 추가.

본질 결함 — setNumberingRestart 영역 영역 paragraph numbering 영역 영역 재시작 API 영역 영역 페이지 번호 (쪽번호) 영역 영역 무관.
작업지시자 웹 에디터 시각 검증 영역 영역 결함 발견 (페이지 번호 미갱신).

본 환경 cherry-pick reset (9cb3e1ae+6d28d653 영역 영역 제거) + PR close + 컨트리뷰터 본질 결함 보고 + Issue #791 신규 등록.

Issue #791: NewNumber 컨트롤 삽입 WASM API + dialog UI (NumberingRestartDialog UI 영역 영역 재사용 가능)
edwardkim added a commit that referenced this pull request May 11, 2026
…dialog UI

@oksure — Issue #791 (PR #755 close 후속): page:new-page-num (쪽 > 새 번호로 시작) stub
→ 실동작 구현. PR #755 의 setNumberingRestart (paragraph numbering) 잘못 매핑 close 후
NewNumber 컨트롤 영역 신규 insertNewNumber API 영역 정확 본질.

본질 (3 commits, 5 files, +174/-1):
- Rust: insert_new_number_native (object_ops.rs +63) + insertNewNumber WASM 바인딩
  (wasm_api.rs +21) — find_control_text_positions 영역 삽입 인덱스 + char_offsets +8 조정
  + control_mask 갱신 + reflow/recompose/paginate 후처리
- TypeScript: NewNumberDialog 신규 (+65) + wasm-bridge.ts 래퍼 (+5)
  + page.ts 커맨드 교체 (+19/-1)

리뷰 반영 commits:
- 05a3f5e: start_num 범위 검증 (1~65535, u16) + 이벤트명 정정
- f285df1: Copilot 리뷰 — !inTable 가드 (표 셀 삽입 금지)

PR #745 (Task #634 NewNumber Page 표시) 정합 — typeset.rs 영역 Control::NewNumber 스캔
+ new_page_numbers 적재 + 페이지 렌더링 영역 해당 번호부터 표시.

본 환경 충돌 수동 해결 (2 파일):
- rhwp-studio/src/command/commands/page.ts: import 양쪽 보존
  (ColumnSettingsDialog devel 측 + NewNumberDialog incoming)
- rhwp-studio/src/core/wasm-bridge.ts: 두 메서드 모두 보존
  (getColumnDef devel 측 + insertNewNumber incoming)

자기 검증: tsc + cargo test/clippy ALL GREEN + 광범위 sweep 7 fixture / 170 페이지 /
회귀 0 (신규 API opt-in 영역 영역 기존 동작 무영향 입증) + WASM 4.5 MB 재빌드
시각 판정: 작업지시자 인터랙션 검증 ✅ 통과
edwardkim added a commit that referenced this pull request May 11, 2026
- mydocs/pr/archives/pr_809_review.md (insertNewNumber WASM API + dialog + 충돌 분석)
- mydocs/pr/archives/pr_809_report.md (옵션 A 처리 결과 + PR #745/#755 정합)
- mydocs/orders/20260511.md PR #809 행 추가
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.

3 participants