-
-
Notifications
You must be signed in to change notification settings - Fork 919
Textarea optimizations #5925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Textarea optimizations #5925
Conversation
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still navigate and select the text in read-only mode, so don't we need the cursor?
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
|
|||
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.