Skip to content

fix(opencode): delete-to-line-start getting stuck at line boundary#21670

Open
fredsh2k wants to merge 1 commit intoanomalyco:devfrom
fredsh2k:fix-delete-to-line-start
Open

fix(opencode): delete-to-line-start getting stuck at line boundary#21670
fredsh2k wants to merge 1 commit intoanomalyco:devfrom
fredsh2k:fix-delete-to-line-start

Conversation

@fredsh2k
Copy link
Copy Markdown

@fredsh2k fredsh2k commented Apr 9, 2026

Issue for this PR

Closes #21663

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

deleteToLineStart() in @opentui/core only deletes when cursor.col > 0. After clearing a line's content, the cursor is at col 0 and further presses do nothing — it never removes the newline to join with the previous line.

This adds an onKeyDown intercept in the prompt: when delete-to-line-start fires and the cursor is at col 0 with row > 0, it calls deleteCharBackward() to remove the newline, joining with the previous line. Repeated presses then continue clearing upward as expected.

How did you verify your code works?

  • Typecheck passes (bun typecheck in packages/opencode)
  • Manual testing: typed 3+ lines, pressed Ctrl+U repeatedly — each press now clears a line or joins with the previous one

Screenshots / recordings

N/A — keyboard behavior fix, no UI change.

Checklist

  • I have tested my changes locally, see screen recording
opencode-cmd-backspace.mov
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Hey! Your PR title Fix Ctrl+U / delete-to-line-start getting stuck at line boundary doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@fredsh2k fredsh2k changed the title Fix Ctrl+U / delete-to-line-start getting stuck at line boundary fix(opencode): delete-to-line-start getting stuck at line boundary Apr 9, 2026
@github-actions github-actions bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@fredsh2k fredsh2k marked this pull request as ready for review April 9, 2026 09:47
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.

Cmd+Backspace / Ctrl+U stops deleting after first line in multi-line input

1 participant