Skip to content

fix(terminal): Shift+Enter가 일반 Enter로 전달되는 문제 수정 - #339

Merged
devswha merged 5 commits into
devswha:mainfrom
WOULDU-pres:fix/terminal-shift-enter
Oct 2, 2026
Merged

devswha merged 5 commits into
devswha:mainfrom
WOULDU-pres:fix/terminal-shift-enter

Conversation

@WOULDU-pres

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

Copy link
Copy Markdown
Contributor

Change

안녕하세요. Web UI의 라이브 터미널에서 Shift+Enter가 일반 Enter로 전달되는 문제를 확인하여 수정을 제안드립니다.

v0.3.43에서 브라우저 입력과 실제 PTY 수신 바이트를 확인해 보니, Enter와 Shift+Enter가 모두 \r로 전달되고 있었습니다. 줄바꿈을 기대하며 Shift+Enter를 누르면 에이전트 TUI에서는 일반 Enter와 같은 입력을 받게 됩니다. Web UI에서 에이전트가 실행 중인 pane의 터미널 보기를 열고 Shift+Enter를 누르면 재현할 수 있습니다.

이번 변경은 xterm이 IME 확정 처리를 마친 뒤 발생하는 onKey에서 Shift+Enter를 식별하고, 바로 이어지는 onData의 CR만 기존 Alt+Enter와 같은 \x1b\r로 변환합니다. xterm의 원래 키 처리를 끝까지 거치므로, compositionend 직후 전송 대기 중인 한글이 있어도 한글 → 줄바꿈 순서가 유지됩니다. 별도의 타이머나 xterm 내부 API는 사용하지 않습니다. 기존 연결 상태·입력 권한 검사와 일반 Enter·Alt+Enter, 다른 수정 키 조합은 그대로 유지합니다. 입력이 잠긴 상태에서는 매핑을 예약하지 않습니다.

기존 브라우저 회귀 테스트에 Enter·Shift+Enter·Alt+Enter의 실제 키 이벤트, 입력 프레임의 중복 전송 여부, isComposing 및 keyCode === 229 보호 검증을 추가했습니다. 실제 xterm textarea에서 compositionend("한") 직후 같은 작업 안에서 Shift+Enter를 발생시켜, 전송 순서가 ["한", "\x1b\r"]이고 지연된 중복 전송이 없는지도 검증합니다. 변경 이력도 Unreleased 항목에 기재했습니다.

Validation

별도로 만든 테스트 세션에서 원본과 수정본을 각각 실행했습니다. 실제 브라우저에서 세 키를 순서대로 누르고, raw-mode PTY가 받은 바이트를 확인했습니다.

키 입력 수정 전: v0.3.43 (1608cce) 수정 후
Enter 0d (CR) 0d (CR)
Shift+Enter 0d (CR) 1b 0d (ESC + CR)
Alt+Enter 1b 0d (ESC + CR) 1b 0d (ESC + CR)

수정 전 캡처

수정 전: Shift+Enter가 Enter와 같은 바이트를 전달

수정 후 캡처

수정 후: Shift+Enter가 Alt+Enter와 같은 바이트를 전달

캡처는 이번 검증용으로 생성한 터미널에서 촬영했습니다. 운영 중인 터미널이나 사용자 대화는 포함하지 않았으며, 이미지와 검증 로그는 포크의 별도 자료 브랜치에 보관했습니다.

검증 환경: Linux(WSL), Herdr 0.9.3, Bun 1.4.2, lockfile에 맞는 Playwright Chromium 153.

  • bun run generate:types --check: 통과
  • bun run typecheck: 통과
  • bun run build: 통과
  • bun run test:unit: 1,036건 통과, 3건 건너뜀, 실패 없음
  • bun scripts/ui-regression.ts: 전체 통과(확정 직후 IME 입력 순서 회귀 테스트 포함)
  • #334의 93caf43 xterm 백포트를 적용한 별도 검증 빌드: 같은 실제 브라우저 입력 순서 테스트 통과

IME 순서 검증: 기존 구현에서 실패한 재현, 수정 후 전체 브라우저 테스트, #334 백포트 검증.

관련 브라우저 테스트 로그(전체 원본):

PASS terminal Shift+Enter sends a newline chord once and preserves Enter, Alt+Enter and IME
PASS pending IME commit precedes Shift+Enter without duplicate text
PASS terminal clipboard paste sends text once and preserves Ctrl+C
PASS: browser frames and received PTY bytes match for all three keys

전체 통합 테스트도 실행했으며, 결과는 169건 통과·8건 실패였습니다. 실패는 모두 이번 PR에서 변경하지 않은 server/codex-binding.contract.test.ts에서 테스트용 Codex 프로세스를 찾지 못하는 경우였습니다. 수정하지 않은 원본 1608cce의 별도 checkout에서 대표 실패 1건을 다시 실행하여 아래와 같은 오류가 동일하게 발생하는 것을 확인했습니다. 이 환경의 통합 테스트 전체 통과 여부까지 확인한 것은 아니라는 점을 함께 남깁니다.

error: no codex process in <owned-test-pane>
  at server/codex-binding.contract.test.ts:52

확인해 주시면 감사하겠습니다. 프로젝트에서 선호하시는 키 입력 방식이나 테스트 보완 사항이 있으면 그에 맞춰 조정하겠습니다.

@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.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 80d2da7f-b3b1-47ba-9275-f67470a4ded7

📥 Commits

Reviewing files that changed from the base of the PR and between fafc3a5 and 31a8c21.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • scripts/ui-regression.ts
  • src/components/PaneTerminal.tsx
 _________________________________________________
< Code Wars Episode V: The Compiler Strikes Back. >
 -------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

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: 6f176240-d145-4a91-a1e6-8ef48e311f1f

📥 Commits

Reviewing files that changed from the base of the PR and between 97f5e48 and fafc3a5.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • scripts/ui-regression.ts
  • src/components/PaneTerminal.tsx
🚧 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
    • In the live terminal, Shift+Enter sends the same newline command as Alt+Enter instead of submitting an agent message.
    • Pending IME input is sent before the Shift+Enter command, preventing delayed duplicate text. Enter continues to send a carriage return, and Shift+Enter does not interfere with IME composition or commit events.

Walkthrough

PaneTerminal remaps the following carriage-return data event to \x1b\r when an eligible Shift+Enter event occurs. Browser regression checks cover Enter sequences and IME ordering. The changelog records the behavior.

Changes

Terminal Enter key handling

Layer / File(s) Summary
Shift+Enter chord handling
src/components/PaneTerminal.tsx, scripts/ui-regression.ts, CHANGELOG.md
PaneTerminal remaps the following carriage-return data event after eligible Shift+Enter to \x1b\r and disposes the key listener during cleanup. Browser checks cover Enter sequences, IME events, pending IME text, and delayed duplicates. The changelog records the behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: devswha

Merge Risk: ⚪ Minimal · up to fafc3

The Shift+Enter change is mergeable after normal checks; no actionable blocking risk remains in the supplied review evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 31b55

The existing pane identity and input-permission checks remain in place. However, protection against input to stopped or unsupported terminals depends on terminal-library behavior that was not verified. No unauthorized input or privilege expansion was demonstrated.

Retained concerns

  • Low · security · inferred: The new Shift+Enter injection relies on unverified xterm disabled-stdin enforcement. If custom-key dispatch and term.input permit input while disableStdin is set, the existing onData checks do not independently reject ended or unsupported terminals. This is a conditional control gap, not a verified bypass.
Security review details

Security Blast Radius

  • observed — The inspected route sends input for paneRef.current through the existing machine-scoped socket. It does not introduce a separate PTY destination. Server-side authorization and broader cross-pane or cross-machine exposure were not independently assessed.

Security Findings and Attack Paths

  • inferred — A conditional path remains unresolved: Shift+Enter on a disabled terminal could reach sendInput only if xterm allows both custom-key handling and injected input in that state. The available evidence does not demonstrate that behavior, a remote attack path, or privilege gain.

Trust Boundaries and Controls

  • observed — The new chord retains ref-based observe, secret-prompt, and held-state rejection before socket transmission. Programmatic xterm input already existed for key-bar taps, so reliance on that library contract predates this PR; the change adds a keyboard caller rather than a new authority mechanism.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 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 and concisely describes the main change: fixing Shift+Enter being delivered as ordinary Enter in the terminal.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the problem, resulting behavior, implementation approach, regression coverage, screenshots, test results, and known un…
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 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 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The Shift+Enter mapping is useful, but the new early return can reorder a just-finished IME commit. Please preserve xterm composition ordering before merging.

Comment thread src/components/PaneTerminal.tsx Resolved

@devswha devswha left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

수정 확인했습니다. 실제 CompositionHelper 코드로 원본 xterm과 #334 백포트 양쪽에서 대기 중인 한글이 먼저 전달되고 Shift+Enter가 이어지는 것을 확인했습니다. 지연 중복 입력이 없고, 입력 잠금 해제 뒤에도 이전 키 매핑 상태가 남지 않습니다.

최신 main과 통합하면서 #334의 입력 준비 검사와 사용자 단축키 설정을 유지했습니다. 타입 검사와 관련 테스트가 통과했고, 이 커밋에서 Fast checks, Integration and browser, Native Windows install도 모두 통과했습니다. 기존 P2 스레드는 해결 처리했습니다.

@devswha
devswha merged commit 2507b0c into devswha:main Oct 2, 2026
3 of 4 checks passed
devswha added a commit that referenced this pull request Oct 3, 2026
Bumps package.json and herdr-plugin.toml to 0.3.44, moves the Unreleased
notes under [0.3.44] - 2026-10-03, adds the compare link, and removes a
merge marker line left in CHANGELOG.md by #351's conflict resolution.
### Added
- Native Windows x64 installation through `install.ps1`, with the same
herdr plugin startup
and updates. Windows needs Bun and Git, without Node or WSL, and keeps
using the terminal
screen mirror. ([#330](#330)
by @JJLiebig)
- Settings can choose Chat, Terminal, or Auto as the default view for
panes. Changing it resets
remembered pane views on this device. Shell panes still open in
Terminal.
([#325](#325) by
@Haeminway1)
- Choose the terminal input line or direct typing on desktop as well as
touch screens, and
customize or unbind the app's Mod+Shift shortcuts with conflict checks
and reset.
  ([#334](#334))

### Changed
- In the sidebar's By workspace view, a workspace with one pane keeps
its numbered header and
can be folded, renamed and reordered from that header, just like a
workspace with several panes.
  ([#332](#332) by @beomq)
- The top usage panel shows larger percentages, remaining-capacity
colors and compact reset
countdowns with their local time. Expired reset times stay hidden until
fresh usage arrives.
([#336](#336) by
@Haeminway1)
- Pane titles that contain a directory show its last folder, and
matching workspace and folder
names appear once in the sidebar and command palette, including Windows
paths.
([#337](#337) by
@Haeminway1)
- In the sidebar's By workspace view, a pane row no longer repeats the
workspace its header names.
Its second line shows the folder only when neither the title nor the
workspace already says it.
  ([#358](#358))

### Fixed
- GJC conversations are resolved from the foreground process directory
when it differs from
the pane directory.
([#333](#333) by @Kinetic27)
- Direct terminal input preserves rapid IME commits when punctuation
arrives before composition
timers run, with a bounded xterm 5.5 backport and Korean final-consonant
regression checks.
Native Android/Gboard checks also fixed stale editor text after
Backspace breaking the next
Hangul word. Secret entry now refuses a held or unready attachment and
failed PTY writes.
  ([#334](#334))
- New session in the browser demo opens the new session instead of
leaving a blank page.
  ([#355](#355))
- Terminal input keeps multi-character IME commits and emoji while
disconnected, waits for the
attachment before sending keys, and reports input failures. Unsent input
lines survive pane,
lens and mode changes; late acknowledgements preserve replacement edits.
Composition keeps
its Enter and Send button, and terminal key-bar taps wait until it
finishes.
  ([#334](#334))
- The background tasks list stays below the app header on a short
screen, such as a phone held
  sideways, and scrolls inside the room above the message box.
  ([#354](#354))
- The mobile message box sits closer to the home indicator while
retaining its base spacing.
([#335](#335) by
@Haeminway1)
- Adding or reconnecting a remote PC says when herdr is not running or
not answering there,
  instead of only `Bridge verification failed (500)`.
  ([#353](#353))
- Shift+Enter in the live terminal sends the same newline chord as
Alt+Enter, instead of plain
Enter that submits an agent's message. Pending IME text is sent before
the newline chord.
([#339](#339) by
@WOULDU-pres)
- On Windows, and from an install path with a space or a non-ASCII
character, the app page loads
instead of the "not built yet" notice. The Windows installer replaces a
copy from a release
  without Windows support, and says so when a release cannot run there.
  ([#356](#356))
- On an iPhone home screen app, a text field that keeps its focus with
the keyboard down no
  longer leaves a status-bar band under the message box.
([#349](#349) by
@Haeminway1)
- After `/new` in an OmO pane, the chat stops showing the conversation
before it: OmO writes the
new session's file only with its first message, and until then the chat
shows what a fresh OmO
shows. ([#351](#351) by
@WOULDU-pres)
- On a Windows PC, an omo pane shows omo's mark instead of Claude's, and
its chat finds the
conversation: process words with `bun.exe`, backslashes and a drive
letter read as omo, and the
  session folder is named as omo's engine names a Windows folder.
([#342](#342) by
@Haeminway1)
- The chat lens finds an omo pane's conversation when its process keeps
its sessions outside
`~/.omo/agent` (`OMO_CODING_AGENT_DIR`, `SENPI_CODING_AGENT_DIR` or
`PI_CODING_AGENT_DIR`).
([#350](#350) by
@Haeminway1) passes. After the merge: .
devswha added a commit that referenced this pull request Oct 3, 2026
## 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가 한 글자 삭제 신호를
전달](https://raw.githubusercontent.com/WOULDU-pres/herdr-web-ui/evidence/terminal-command-backspace/before.png)

**수정 후 캡처**

![수정 후: Cmd+Backspace가 Ctrl+U와 같은 줄 삭제 신호를
전달](https://raw.githubusercontent.com/WOULDU-pres/herdr-web-ui/evidence/terminal-command-backspace/after.png)

캡처는 별도로 생성한 테스트 터미널의 실제 PTY 수신 바이트입니다. WebSocket 입력 프레임과 수신 바이트가 일치하는지도
확인했습니다. [검증
자료](https://github.com/WOULDU-pres/herdr-web-ui/tree/evidence/terminal-command-backspace)는
포크의 별도 브랜치에 보관했습니다.

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

- 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`에 포함된 #334 xterm 백포트: 같은 Mac 키·IME 순서·실제 readline 삭제 테스트를 포함한
전체 브라우저 검사 통과

관련 [브라우저 원본
로그](https://github.com/WOULDU-pres/herdr-web-ui/blob/evidence/terminal-command-backspace/ui-regression.log):

```text
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에서 이 서버 파일들을 수정하지 않습니다. [검증
로그](https://github.com/WOULDU-pres/herdr-web-ui/blob/evidence/terminal-command-backspace/validation.txt)에
최신 통과 범위와 이 제한을 함께 기록했습니다.

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

Co-authored-by: Hako <[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