[PR #522] [CLOSED] fix: select buffer home/end behaviour when textarea's content overflows #593

Closed
opened 2026-03-02 23:47:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/522
Author: @danolekh
Created: 1/14/2026
Status: Closed

Base: mainHead: fix/textarea-scrollable-select-behaviour


📝 Commits (2)

  • 553ce28 fix: select buffer home/end behaviour when textarea's content overflows
  • 07b7000 rm unnecessary logic

📊 Changes

7 files changed (+219 additions, -5 deletions)

View changed files

📝 packages/core/src/editor-view.ts (+10 -0)
📝 packages/core/src/lib/selection.ts (+9 -0)
📝 packages/core/src/renderables/EditBufferRenderable.ts (+32 -5)
📝 packages/core/src/renderables/__tests__/Textarea.selection.test.ts (+100 -0)
📝 packages/core/src/zig.ts (+20 -0)
📝 packages/core/src/zig/editor-view.zig (+33 -0)
📝 packages/core/src/zig/lib.zig (+15 -0)

📄 Description

fixes #521 and makes possible to properly implement #518

overview from clod:

Problem: Shift+cmd+arrow keys (select to buffer home/end) didn't work correctly in scrollable Textareas because selection anchor coordinates were captured relative to the wrong viewport position.

Root Cause: updateSelectionForMovement stored selection anchor using viewport-relative visual coordinates. When the viewport scrolled during a large cursor jump, the anchor became invalid.

Solution:

  1. Store selection anchor using logical coordinates (row, col) which are document-absolute
  2. Added scrollToCursor() to explicitly scroll viewport to cursor (bypassing the normal scroll-skip during selection)
  3. After movement, convert anchor logical coords to visual coords based on current viewport

fix tested in alacritty & kitty terminals

preview
https://github.com/user-attachments/assets/7a61e7f2-6a87-4cbf-843f-b760d9619f76


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/522 **Author:** [@danolekh](https://github.com/danolekh) **Created:** 1/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/textarea-scrollable-select-behaviour` --- ### 📝 Commits (2) - [`553ce28`](https://github.com/anomalyco/opentui/commit/553ce287bb86893758d190d1d0407492fc99a3cb) fix: select buffer home/end behaviour when textarea's content overflows - [`07b7000`](https://github.com/anomalyco/opentui/commit/07b70002e72332e4b12045605b9e1a26707544fc) rm unnecessary logic ### 📊 Changes **7 files changed** (+219 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/editor-view.ts` (+10 -0) 📝 `packages/core/src/lib/selection.ts` (+9 -0) 📝 `packages/core/src/renderables/EditBufferRenderable.ts` (+32 -5) 📝 `packages/core/src/renderables/__tests__/Textarea.selection.test.ts` (+100 -0) 📝 `packages/core/src/zig.ts` (+20 -0) 📝 `packages/core/src/zig/editor-view.zig` (+33 -0) 📝 `packages/core/src/zig/lib.zig` (+15 -0) </details> ### 📄 Description fixes #521 and makes possible to properly implement #518 overview from clod: Problem: Shift+cmd+arrow keys (select to buffer home/end) didn't work correctly in scrollable Textareas because selection anchor coordinates were captured relative to the wrong viewport position. Root Cause: updateSelectionForMovement stored selection anchor using viewport-relative visual coordinates. When the viewport scrolled during a large cursor jump, the anchor became invalid. Solution: 1. Store selection anchor using logical coordinates (row, col) which are document-absolute 2. Added scrollToCursor() to explicitly scroll viewport to cursor (bypassing the normal scroll-skip during selection) 3. After movement, convert anchor logical coords to visual coords based on current viewport fix tested in alacritty & kitty terminals preview https://github.com/user-attachments/assets/7a61e7f2-6a87-4cbf-843f-b760d9619f76 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:15 +03:00
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#593
No description provided.