From 7642f7798cacaedb057959f2c57c332a3ee5a716 Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Tue, 28 Oct 2025 21:08:07 +0000 Subject: [PATCH 1/2] fix(text area): fix cursor display on wrapped line Currently the `TextArea` cursor display is broken when trying to navigate a wrapped line: - Clicking a wrapped line will cause the cursor to disappear - Keyboard navigation on a wrapped line won't blink the cursor The problem is that the line cache introduced in ec0c050 doesn't properly account for wrapped lines. Fix the cache key so the 'cursor location' element is not simply based on a location in document-space. Fixes #6195 --- src/textual/widgets/_text_area.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textual/widgets/_text_area.py b/src/textual/widgets/_text_area.py index 67da60ee61..5ef4dc9066 100644 --- a/src/textual/widgets/_text_area.py +++ b/src/textual/widgets/_text_area.py @@ -1229,6 +1229,7 @@ def render_line(self, y: int) -> Strip: scroll_x, scroll_y = self.scroll_offset absolute_y = scroll_y + y selection = self.selection + _, cursor_y = self._cursor_offset cache_key = ( self.size, scroll_x, @@ -1243,7 +1244,7 @@ def render_line(self, y: int) -> Strip: if ( self._cursor_visible and self.cursor_blink - and absolute_y == selection.end[0] + and absolute_y == cursor_y ) else None ), From 7556655a499df59e8ddad99c9b6d546c6f6c537d Mon Sep 17 00:00:00 2001 From: TomJGooding <101601846+TomJGooding@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:20:27 +0000 Subject: [PATCH 2/2] docs(changelog): add fix for text area cursor display --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09838b667b..d2758a3545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Fixed + +- Fixed `TextArea` cursor display on wrapped lines https://github.com/Textualize/textual/pull/6196 + ## [6.4.0] - 2025-10-22 ### Fixed