Skip to content

rhwp-studio: moveToDocumentEnd 단일 구역 가정 영역 영역 다중 구역 문서 영역 영역 커서 위치 미발견 오류 #784

@edwardkim

Description

@edwardkim

증상

Ctrl/Cmd + ↓ (문서 끝, moveToDocumentEnd) 영역 영역 다중 구역 문서 영역 영역 cursor rect 미발견 오류 발생.

재현 절차

  1. 다중 구역 문서 (예: samples/aift.hwp — 3 구역) 열기
  2. Ctrl/Cmd + ↓ 입력
  3. 결과: 콘솔 영역 영역 다음 오류 발생, 커서 위치 미이동
cursor.ts:699 [CursorState] updateRect 실패 → rect=null pos=(0,111,0) cell=(undefined,undefined,undefined,undefined): 렌더링 오류: 커서 위치를 찾을 수 없습니다: sec=0, para=111, offset=0

본 환경 점검 결과

본질 진단 — 단일 구역 가정 하드코드

rhwp-studio/src/engine/cursor.ts::moveToDocumentEnd:

moveToDocumentEnd(): void {
    this.preferredX = null;
    try {
        const sec = 0; // 현재 단일 구역 가정 ← 결함
        const paraCount = this.wasm.getParagraphCount(sec);
        if (paraCount > 0) {
            const lastPara = paraCount - 1;
            const paraLen = this.wasm.getParagraphLength(sec, lastPara);
            this.position = { sectionIndex: sec, paragraphIndex: lastPara, charOffset: paraLen };
        }
        ...
    }
}

moveToDocumentStart 영역 영역 동일 패턴 — sectionIndex: 0 하드코드.

본 환경 영향

aift.hwp (3 구역) 영역 영역:

  • 구역 0 영역 영역 paragraphCount 영역 영역 가정 영역 영역
  • 마지막 구역 영역 영역 lastPara 영역 영역 무관 영역 영역
  • sec=0, para=111, offset=0 영역 영역 잘못된 위치 영역 영역 cursor rect 미발견

처리 방향 (제안)

moveToDocumentStart

  • sectionIndex: 0, paragraphIndex: 0, charOffset: 0 — 정합 (첫 구역 첫 문단 영역 영역 항상 정합)

moveToDocumentEnd

  • getSectionCount() (또는 wasm.sectionCount) 영역 영역 마지막 구역 인덱스 도출
  • 마지막 구역 영역 영역 lastPara = getParagraphCount(lastSec) - 1
  • paraLen = getParagraphLength(lastSec, lastPara)

영향 범위

관련

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions