Textarea optimizations#5925
Conversation
| - Widget.release_mouse will now only release the mouse, if it was captured by self https://github.com/Textualize/textual/pull/5900 | ||
| - Some optimizations to TextArea, which may be noticeable during scrolling (note: may break snapshots with a TextArea) https://github.com/Textualize/textual/pull/5925 | ||
| - Selecting in the TextArea now hides the cursor until you release the mouse https://github.com/Textualize/textual/pull/5925 | ||
| - Read only TextAreas will no longer display a cursor https://github.com/Textualize/textual/pull/5925 |
There was a problem hiding this comment.
You can still navigate and select the text in read-only mode, so don't we need the cursor?
|
|
||
| - Widget.release_mouse will now only release the mouse, if it was captured by self https://github.com/Textualize/textual/pull/5900 | ||
| - Some optimizations to TextArea, which may be noticeable during scrolling (note: may break snapshots with a TextArea) https://github.com/Textualize/textual/pull/5925 | ||
| - Selecting in the TextArea now hides the cursor until you release the mouse https://github.com/Textualize/textual/pull/5925 |
There was a problem hiding this comment.
I think we also still want the cursor here, as it helps show what exactly is being selected?
For example, try selecting a line with the mouse, starting at the end of the line. If you select only until the start of that line and hit backspace, that leaves a blank line. Whereas if you select until the end of the previous line, the line is removed entirely.
When you're quickly trying to edit, after selecting the text you're probably almost immediately going to hit the next key, which is why I think the cursor context while selecting is important.
There was a problem hiding this comment.
I don't follow. The cursor is always directly under the mouse, which is why it feels redundant. As soon as you release the mouse the cursor reappears.
Screen.Recording.2025-07-06.at.08.15.17.mov
I'm going to merge this shortly. But if I've missed something, I'm happy to revisit it.
A few optimizations to TextArea.
Started out as a modest optimization to avoid calculating cell lengths. But turned in to implementing a line cache, which results in a very good win, but potential for breakage. I'd appreciate an extra set of eyes on this.