Skip to content

fix(terminal): macOS Cmd+Backspace의 한 줄 삭제 동작 수정 - #347

Merged
devswha merged 3 commits into
devswha:mainfrom
WOULDU-pres:fix/terminal-command-backspace
Oct 3, 2026
Merged

devswha merged 3 commits into
devswha:mainfrom
WOULDU-pres:fix/terminal-command-backspace

Conversation

@WOULDU-pres

@WOULDU-pres WOULDU-pres commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Change

안녕하세요. macOS에서 Web UI의 라이브 터미널을 사용할 때 Cmd+Backspace가 한 글자만 삭제하는 문제의 수정을 제안드립니다.

현재 xterm은 Cmd+Backspace도 일반 Backspace와 같은 DEL(0x7f)로 전달합니다. Mac의 Command 키 의미가 반영되지 않아, 입력줄 끝에서 Cmd+Backspace를 눌러도 줄 전체가 지워지지 않습니다.

이번 변경은 macOS의 Cmd+Backspace를 터미널에서 줄 앞부분을 삭제하는 Ctrl+U(0x15)로 전달합니다. 커서가 줄 끝에 있으면 입력줄 전체가 삭제됩니다. xterm이 대기 중인 IME 입력을 먼저 확정한 뒤 발생하는 onKey에서 키를 식별하고, 바로 이어지는 onData만 변환하므로 한글 → 삭제 순서를 보존합니다. 입력이 잠긴 상태에서는 매핑을 예약하지 않습니다.

일반 Backspace, Ctrl/Alt/Shift가 함께 눌린 조합과 macOS 이외의 Meta+Backspace는 기존 동작을 유지합니다. Shift+Enter 수정(#339)과 분리하여 main 기준의 별도 브랜치에서 작성했습니다. 최신 main(bb7ef50)과의 충돌을 정리했으며, 이미 병합된 #339와 #334의 입력 준비 검사·사용자 단축키 설정을 유지했습니다. 두 키 조합을 함께 검증했습니다.

Validation

Linux(WSL), Herdr 0.9.3, Bun 1.4.2, lockfile에 맞는 Playwright Chromium 153에서 검증했습니다. 브라우저의 별도 컨텍스트에 MacIntel 플랫폼과 Command 키 이벤트를 재현했으며, 실제 macOS/Safari 기기 테스트는 수행하지 않았습니다.

키 입력 수정 전 수정 후
Backspace 7f (DEL) 7f (DEL)
Cmd+Backspace 7f (DEL) 15 (Ctrl+U)
Ctrl+U 15 (Ctrl+U) 15 (Ctrl+U)

수정 전 캡처

수정 전: Cmd+Backspace가 한 글자 삭제 신호를 전달

수정 후 캡처

수정 후: Cmd+Backspace가 Ctrl+U와 같은 줄 삭제 신호를 전달

캡처는 별도로 생성한 테스트 터미널의 실제 PTY 수신 바이트입니다. WebSocket 입력 프레임과 수신 바이트가 일치하는지도 확인했습니다. 검증 자료는 포크의 별도 브랜치에 보관했습니다.

새 브라우저 회귀 테스트에서는 다음을 확인합니다.

  • Cmd+Backspace가 Ctrl+U를 한 번만 전송하며, 다른 Backspace 조합과 비 Mac 플랫폼은 기존 시퀀스를 유지합니다.
  • compositionend("한") 직후 Cmd+Backspace를 발생시켜 ["한", "\x15"] 순서와 지연된 중복 전송이 없음을 확인합니다. 조합 중 플래그는 줄 삭제로 바꾸지 않습니다.
  • 별도 테스트 pane의 실제 Node readline 프로세스에 remove this entire input을 입력한 뒤 Cmd+Backspace를 눌러, 입력 버퍼가 빈 문자열이 되는 것을 확인합니다.

검증 결과:

  • bun run generate:types --check, bun run typecheck, bun run build: 통과
  • bun run test:unit: 1,059건 통과, 기존 3건 건너뜀, 실패 없음
  • bun scripts/ui-regression.ts: 전체 통과
  • 최신 main에 포함된 fix(terminal): preserve IME input, drafts and attachment readiness #334 xterm 백포트: 같은 Mac 키·IME 순서·실제 readline 삭제 테스트를 포함한 전체 브라우저 검사 통과

관련 브라우저 원본 로그:

PASS Cmd+Backspace clears the entire input in a real owned readline PTY
PASS macOS Cmd+Backspace sends Ctrl+U once and preserves other Backspace combinations
PASS pending IME text precedes Cmd+Backspace without duplicates; active composition stays native
PASS non-macOS Meta+Backspace keeps native DEL

전체 통합 테스트 재실행은 170건 통과·9건 실패였습니다. 8건은 변경하지 않은 server/codex-binding.contract.test.ts의 테스트용 Codex 프로세스 탐지 실패로, 수정 없는 원본에서도 대표 실패를 확인한 상태입니다. 나머지 1건은 변경하지 않은 server/updater.test.ts의 supervisor 종료 코드 검사가 0 대신 1을 받은 경우이며, 해당 테스트를 단독 재실행하면 통과했습니다(1건 통과, 12건 필터링, 실패 없음). 이번 PR에서 이 서버 파일들을 수정하지 않습니다. 검증 로그에 최신 통과 범위와 이 제한을 함께 기록했습니다.

확인해 주시면 감사하겠습니다. 프로젝트에서 선호하시는 키 입력 방식이나 보완할 사항이 있으면 말씀 부탁드립니다.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9de5d556-b3e6-41ab-88ec-237845e8ecbc
📥 Commits

Reviewing files that changed from the base of the PR and between 7f3da8a and 49ca26a.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • On macOS, Cmd+Backspace in the live terminal deletes input back to the start of the line. Pending IME text is sent before the deletion without duplication, and active text composition is unaffected. On Linux, Meta+Backspace continues to send the native delete input.

Walkthrough

The terminal maps eligible macOS Cmd+Backspace input to Ctrl+U. Browser regression checks cover macOS input and IME behavior, readline line clearing, and native Linux behavior.

Changes

Terminal Backspace behavior

Layer / File(s) Summary
Remap macOS Cmd+Backspace
src/components/PaneTerminal.tsx, CHANGELOG.md
The terminal maps the DEL value following an eligible macOS Cmd+Backspace keydown to Ctrl+U. Cleanup disposes the key listener. The changelog records the fix and IME text ordering.
Browser regression checks
scripts/terminal-command-backspace-regression.ts, scripts/ui-regression.ts
The regression check verifies macOS modifier combinations, pending and active IME behavior, readline line clearing, and Linux native DEL input. The UI regression runner invokes the check.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 49ca2

No actionable issue remains; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 7f3da

The shortcut retains existing pane routing and input controls. No new access or authority has been demonstrated. Interrupted-event behavior remains uncertain, including whether pending shortcut state could survive a pane change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated effect is a line-deletion control byte sent to the current pane through existing routing. Broader tenant, service, credential, or environment exposure is not established by this change. Cross-pane effects from interrupted delivery remain conditional and unverified.

Trust Boundaries and Controls

  • observed — Shortcut recognition checks enabled stdin and eligible key identity. Forwarding retains current-pane, observation, secret-prompt, and held-attachment checks. The inspected change adds no authorization mechanism and does not remove these controls; downstream server authorization remains outside the inspected scope.

Resilience and Maintainability Implications

  • observed — Pending remap state is consumed before forwarding, including when routing guards reject input. A failed send follows the existing explicit-review draft path rather than automatic replay. Listener disposal bounds the new state to the terminal mount.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing whole-line deletion with macOS Cmd+Backspace in the terminal.
Description check ✅ Passed The description includes both required sections. It explains the problem and resulting behavior, and provides detailed validation results and before-and-after screenshots. It also reports the integrat…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@devswha
devswha merged commit 7915b81 into devswha:main Oct 3, 2026
4 checks passed
devswha added a commit to WOULDU-pres/herdr-web-ui that referenced this pull request Oct 3, 2026
…aw the chat lens for the shared grid

Two cases the covered attach (keep_size) left open, found in review:

- A resize that reached the server while the pane's attachment was still
  being created was dropped. A chat lens that attached and then switched
  to the terminal lens before the terminal was looked up stayed on the
  pane's own grid under a terminal fitted to the device. The resize now
  waits for the creation.
- The terminal lens ignores pane-geometry (it drives the grid), so a
  device that entered the chat lens after another one had resized the pty
  kept its hidden screen at its own size. The last pane-geometry is kept
  and the hidden screen takes it on entering the chat lens.

The changelog entries of devswha#347 and devswha#363 were written before 0.3.44 was cut
and merged under that released version: both move to Unreleased, with
their PR links.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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