Skip to content

feat: F5 본문 블록 선택 모드 + F3 영역 확장 선택 (#220)#811

Closed
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/f5-f3-block-select
Closed

feat: F5 본문 블록 선택 모드 + F3 영역 확장 선택 (#220)#811
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/f5-f3-block-select

Conversation

@oksure

@oksure oksure commented May 11, 2026

Copy link
Copy Markdown
Contributor

변경 내용

한컴 HWP의 F5 블록 선택 + F3 영역 확장 기능 구현.

F5 블록 선택 모드 (본문)

  • 본문에서 F5: 현재 위치에 anchor 설정, 블록 선택 모드 진입
  • 이후 화살표 키 이동 시 선택 영역 자동 확장 (Shift 없이)
  • F5 재입력 또는 Esc: 모드 해제 + 선택 해제
  • 기존 F5 표 셀 선택 모드는 그대로 유지 (isInCell() 분기)

F3 선택 영역 확장

입력 횟수 확장 범위
F3 1회 현재 커서 위치의 단어
F3 2회 현재 문단 전체
F3 3회 현재 구역 전체
F3 4회 문서 전체
  • F3 첫 입력 시 블록 모드 자동 진입
  • findWordAt() 헬퍼: Hangul/Latin/Digit 분류 기반 단어 경계 감지

추가 변경

  • wasm-bridge.ts: getSectionCount() 메서드 추가

테스트

  • cargo clippy -- -D warnings 통과
  • TypeScript tsc --noEmit 통과

closes #220

감사합니다.

한컴 HWP F5/F3 블록 선택 기능 구현:

F5 (본문):
- 블록 선택 모드 진입 — 현재 위치에 anchor 설정
- 이후 화살표 키로 선택 영역 확장 (Shift 없이도)
- F5 재입력 또는 Esc로 모드 해제

F3 (선택 영역 확장):
- 단계적 확장: 단어 → 문단 → 구역 → 문서 전체
- F3 첫 입력 시 블록 모드 자동 진입
- findWordAt() 헬퍼 (Hangul/Latin/Digit 분류)

기존 F5 표 셀 선택 모드는 그대로 유지 (isInCell 분기).
wasm-bridge에 getSectionCount() 메서드 추가.

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

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

한컴 HWP 스타일의 본문 블록 선택(F5)과 선택 영역 단계 확장(F3)을 rhwp-studio 편집 엔진 입력/커서 계층에 추가해, 키보드 기반 선택 UX를 강화하는 PR입니다.

Changes:

  • F5로 본문 블록 선택 모드 진입/해제(표 셀 내부는 기존 셀 선택 모드 유지)
  • F3로 선택 영역을 단계적으로 확장하는 커서 로직(expandSelection, findWordAt) 추가
  • 문서 전체 선택을 위해 WasmBridge.getSectionCount() 브리지 메서드 추가

Reviewed changes

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

File Description
rhwp-studio/src/engine/input-handler-keyboard.ts F5/F3/Esc 키 입력 처리에 본문 블록 선택 모드 진입/확장/해제 로직 추가
rhwp-studio/src/engine/cursor.ts 블록 선택 모드 상태 및 F3 확장 선택 로직, 단어 경계 탐지 헬퍼 추가
rhwp-studio/src/core/wasm-bridge.ts 문서 전체 선택에 필요한 섹션 개수 조회 API 추가

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

Comment on lines +379 to +387
// 본문 블록 선택 모드 (#220)
if (this.cursor.isInBlockSelectionMode()) {
this.cursor.exitBlockSelectionMode();
this.selectionRenderer.clear();
this.updateCaret();
} else {
this.cursor.enterBlockSelectionMode();
this.updateSelection();
}
Comment thread rhwp-studio/src/engine/cursor.ts Outdated
enterBlockSelectionMode(): void {
this._blockSelectionMode = true;
this._expandPhase = 0;
this.setAnchor();
Comment on lines +808 to +840
expandSelection(): void {
this._expandPhase++;
const pos = this.position;
const sec = pos.sectionIndex;
const para = pos.paragraphIndex;
try {
if (this._expandPhase === 1) {
// 단어 선택 — 현재 위치의 단어 범위
const paraLen = this.wasm.getParagraphLength(sec, para);
const text = this.wasm.getTextRange(sec, para, 0, paraLen);
const { start, end } = findWordAt(text, pos.charOffset);
this.anchor = { ...pos, charOffset: start };
this.position = { ...pos, charOffset: end };
} else if (this._expandPhase === 2) {
// 문단 전체 선택
const paraLen = this.wasm.getParagraphLength(sec, para);
this.anchor = { ...pos, charOffset: 0 };
this.position = { ...pos, charOffset: paraLen };
} else if (this._expandPhase === 3) {
// 구역 전체 선택
const paraCount = this.wasm.getParagraphCount(sec);
const lastParaLen = this.wasm.getParagraphLength(sec, paraCount - 1);
this.anchor = { sectionIndex: sec, paragraphIndex: 0, charOffset: 0 };
this.position = { sectionIndex: sec, paragraphIndex: paraCount - 1, charOffset: lastParaLen };
} else {
// 문서 전체 선택
const secCount = this.wasm.getSectionCount();
const lastSec = secCount - 1;
const lastParaCount = this.wasm.getParagraphCount(lastSec);
const lastParaLen = this.wasm.getParagraphLength(lastSec, lastParaCount - 1);
this.anchor = { sectionIndex: 0, paragraphIndex: 0, charOffset: 0 };
this.position = { sectionIndex: lastSec, paragraphIndex: lastParaCount - 1, charOffset: lastParaLen };
this._expandPhase = 4; // cap
Comment on lines +56 to +57
private _expandPhase = 0; // F3 확장 단계: 0=none, 1=word, 2=paragraph, 3=section, 4=document

Comment on lines +1309 to +1312
if (!text || offset >= text.length) return { start: offset, end: offset };
const atWord = isWordChar(text[offset] ?? '');
let start = offset;
let end = offset;
기존 setAnchor()는 anchor가 이미 있으면 스킵하여, 이전 선택
상태에서 블록 선택 모드 진입 시 stale anchor 유지 문제.
현재 위치를 직접 anchor에 할당하여 항상 올바른 기준점 설정.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
edwardkim added a commit that referenced this pull request May 11, 2026
PR #808 (commit `ca729bdc`) 영역 영역 wasm-bridge.ts:231 영역 영역 `getSectionCount` 이미 추가됨.
PR #811 영역 영역 같은 메서드 영역 영역 다시 추가 (cherry-pick auto-merge 영역 영역 두 메서드 모두 보존됨).

PR #808 측 (라인 231 `this.doc?.getSectionCount() ?? 0`) 영역 보존 + PR #811 측 (라인 409-411) 영역 제거.
edwardkim added a commit that referenced this pull request May 11, 2026
@oksure — Issue #220 (한컴 F5/F3 블록 선택) 영역 4단계 정합. 5단계 영역 영역 문장 단계 영역
별 Issue 분리 후속.

본질 (2 PR commits + 1 정정 commit):
- cursor.ts (+85): _blockSelectionMode + _expandPhase 상태 + enterBlockSelectionMode /
  exitBlockSelectionMode / expandSelection 메서드 + isWordChar / findWordAt 헬퍼
  (Hangul AC00-D7AF + Hangul Jamo 3131-318E + Digit + Latin)
- input-handler-keyboard.ts (+30/-2): F5 토글 (본문/셀 isInCell() 분기) + F3 확장
  + Escape 분기
- Copilot 리뷰 반영 (59a01de): enterBlockSelectionMode anchor 강제 설정
  (this.anchor = { ...this.position })

F3 4단계 확장 (Issue #220 5단계 영역 영역 문장 단계 누락):
- F3 1회: 단어 (findWordAt)
- F3 2회: 문단 전체
- F3 3회: 구역 전체
- F3 4회: 문서 전체 (phase 4 cap)

본 환경 충돌 수동 해결 (1 파일):
- cursor.ts 파일 끝 영역 영역 PR #794 (findWordBoundaryForward/Backward, Alt+Arrow
  단어 이동) + PR #811 (findWordAt, F3 단어 선택) 두 유틸 양측 보존

정정 commit (dc6aa7a):
- wasm-bridge.ts 영역 영역 getSectionCount 중복 정의 제거 (PR #808 의 라인 231 보존,
  PR #811 영역 영역 추가본 제거)

자기 검증: tsc + cargo test ALL GREEN, WASM 재빌드 불필요 (TypeScript 단일)
시각 판정: 작업지시자 인터랙션 검증 ✅ 통과 (F5 본문/셀 + F3 4단계 + 회귀 부재)
CI: ✅ Build & Test + CodeQL + Canvas visual diff

별 Issue 후속 — F3 문장 단계 (Issue #220 5단계 영역 영역 문장 단계)
@edwardkim

Copy link
Copy Markdown
Owner

@oksure 머지 완료 (commit d8e641a4).

F5 본문 블록 선택 + F3 4단계 확장 정합. Copilot 리뷰 반영 (enterBlockSelectionMode anchor 강제 설정) 정확. isInCell() && !isInTextBox() 분기 영역 영역 표 셀 영역 기존 셀 선택 모드 보존 정합.

본 환경 충돌 + 정정:

Issue #220 영역 영역 5단계 vs PR 4단계 — Issue 본문 영역 영역 5단계 (단어 → 문장 → 문단 → 섹션 → 문서) 명시, 본 PR 영역 영역 4단계 (문장 단계 누락). 별 Issue 영역 영역 분리 후속 정정 권장 — Issue #220 영역 영역 OPEN 유지.

자기 검증 tsc + cargo test ALL GREEN. 작업지시자 인터랙션 검증 통과 (F5 본문/셀 + F3 4단계 + 기존 단축키 회귀 부재).

수고하셨습니다.

@edwardkim edwardkim closed this May 11, 2026
edwardkim added a commit that referenced this pull request May 11, 2026
- mydocs/pr/archives/pr_811_review.md (F5/F3 블록 선택 + 충돌 분석 + 5단계 vs 4단계)
- mydocs/pr/archives/pr_811_report.md (옵션 A 처리 결과 + 중복 제거 + Issue #220 OPEN 유지)
- mydocs/orders/20260511.md PR #811 행 추가

별 Issue #839 분리 — F3 문장 단계 추가 (Issue #220 5단계 영역 영역 문장 누락)
@edwardkim edwardkim mentioned this pull request May 17, 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.

3 participants