[GH-ISSUE #684] Textarea delete actions handle newlines incorrectly (Option+Backspace and Cmd+Backspace) #950

Open
opened 2026-03-14 09:08:11 +03:00 by kerem · 0 comments
Owner

Originally created by @slimewell on GitHub (Feb 13, 2026).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/684

Context

This issue was found while fixing OpenCode input behavior (anomalyco/opencode#8645).
The fix should be in OpenTUI action handling so all textareas behave consistently.

Current behavior

  • Option+Backspace (delete-word-backward) can remove a newline when deleting the first word of a line (when there is a line above it).
  • Cmd+Backspace (delete-to-line-start) deletes to the start of the current line, but does not remove the newline when the cursor is already at the start of a line.

Expected behavior

  • Option+Backspace: delete the previous word only and keep the newline.
  • Cmd+Backspace:
    • mid-line: delete to start of current line
    • at start of line: delete previous newline (join with previous line)

Reproduction

Input:

first line of words
second line doo
third foo bar

  1. Place cursor after third on the third line.
  2. Press Option+Backspace.

Then test Cmd+Backspace:

  • mid-line should delete to line start
  • line-start should remove previous newline and join lines

Moved here as this is action-level behavior (delete-word-backward / delete-to-line-start) and should be fixed in OpenTUI rather than app-level onKeyDown workarounds.

Originally created by @slimewell on GitHub (Feb 13, 2026). Original GitHub issue: https://github.com/anomalyco/opentui/issues/684 ## Context This issue was found while fixing OpenCode input behavior (`anomalyco/opencode#8645`). The fix should be in OpenTUI action handling so all textareas behave consistently. ## Current behavior - `Option+Backspace` (`delete-word-backward`) can remove a newline when deleting the first word of a line (when there is a line above it). - `Cmd+Backspace` (`delete-to-line-start`) deletes to the start of the current line, but does not remove the newline when the cursor is already at the start of a line. ## Expected behavior - `Option+Backspace`: delete the previous word only and keep the newline. - `Cmd+Backspace`: - mid-line: delete to start of current line - at start of line: delete previous newline (join with previous line) ## Reproduction Input: first line of words second line doo third foo bar 1. Place cursor after `third` on the third line. 2. Press `Option+Backspace`. Then test `Cmd+Backspace`: - mid-line should delete to line start - line-start should remove previous newline and join lines Moved here as this is action-level behavior (`delete-word-backward` / `delete-to-line-start`) and should be fixed in OpenTUI rather than app-level `onKeyDown` workarounds. ## Related - anomalyco/opencode#436 - anomalyco/opencode#6314 - anomalyco/opencode#8645
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#950
No description provided.