Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(tui): handle Home and End keys in prompt input
  • Loading branch information
lichuang committed Jun 9, 2026
commit ef48d56bcda9838ec46850ee18353dffa3042c6b
10 changes: 9 additions & 1 deletion packages/tui/src/component/prompt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1366,11 +1366,19 @@ export function Prompt(props: PromptProps) {
setCursorVersion((value) => value + 1)
}}
onCursorChange={() => setCursorVersion((value) => value + 1)}
onKeyDown={(e: { preventDefault(): void }) => {
onKeyDown={(e: KeyEvent) => {
if (props.disabled) {
e.preventDefault()
return
}
if (e.name === "end") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You have hardcoded the HOME and END keys, which overcorrected the PR bound as a modification keybinds. To change keybind edit tui.json

e.preventDefault()
input.gotoBufferEnd()
}
if (e.name === "home") {
e.preventDefault()
input.cursorOffset = 0
}
}}
onSubmit={() => {
// IME: double-defer so the last composed character (e.g. Korean
Expand Down
Loading