Comments (8)
Cheers - I reckon this will be changing a True to a False somewhere 😄
from textual.
I had a quick look at this and found that if you set cursor_blink = False
(needed for snapshot testing), the TextArea
still has a cursor even after focussing then blurring:
from textual.app import App, ComposeResult
from textual.widgets import Input, TextArea
class TextAreaCursorApp(App[None]):
def compose(self) -> ComposeResult:
input = Input()
text_area = TextArea()
input.cursor_blink = False
text_area.cursor_blink = False
yield input
yield text_area
if __name__ == "__main__":
TextAreaCursorApp().run()
Then I spotted that the _on_blur
method actually also seems to set the cursor to be visible which is confusing? Changing this to False has no effect, which suggests the cursor visibility must actually be updated elsewhere...?
textual/src/textual/widgets/_text_area.py
Lines 1291 to 1292 in 6459878
EDIT: Ah-ha, I missed that it also has this watch method!
textual/src/textual/widgets/_text_area.py
Lines 523 to 525 in 6459878
from textual.
Oh yeah, the _on_blur
can probably be removed. It was intended to ensure that the cursor remains visible when it's blurred for consistency. Otherwise the visibility of the cursor depended on when you blurred the widget.
I was thinking initialising self._cursor_visible
to False
in the constructor might be enough.
from textual.
Just to note for whoever picks this up (maybe me!), potentially any fix should also account for this issue:
from textual.
Oh yeah, the
_on_blur
can probably be removed. It was intended to ensure that the cursor remains visible when it's blurred for consistency. Otherwise the visibility of the cursor depended on when you blurred the widget.
Sorry I'm not sure I fully understand this - is that just the old implementation, or related to #2476?
from textual.
Sorry, I meant the _on_blur
could be removed because we could handle the logic of pausing the blink insidewatch_has_focus
instead, rather than doing blur-related stuff in 2 places. We'll probably need to pause blink in watch_has_focus
with visible=False.
from textual.
I'm going to pick this up now.
from textual.
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
from textual.
Related Issues (20)
- Consider signing commits/releases with PGP HOT 1
- No module named 'textual'
- Repair broken embedded rich terminal example. HOT 7
- Writing to a hidden RichLog breaks table alignment HOT 7
- Expose ANSI themes HOT 8
- `DirectoryTree.clear_node` doesn't actually clear the node HOT 1
- Select widget "disabled" HOT 1
- Add `remove` attribute to `mount` and `mount_all` HOT 7
- Add a `lock` to every widget. HOT 3
- Clarify `Input` docs about removing spacing HOT 1
- Input widgets error when I configure type arguments
- A Widget with {margin: 1} style in a ScrollableContainer causes infinite resizes and scrollbars flicker HOT 3
- Pilot cannot click switch with horizontally aligned, long text HOT 5
- Clarify `is_end_of_document_line` in docs HOT 6
- Omitting TextArea theme doesn't highlight
- TabbedContent active attribute doesn't post message TabActivated + doesn't arrange tabs HOT 5
- TextArea crashes Python on html language HOT 5
- Blank display on AIX HOT 10
- check error in the "textual colors" app HOT 7
- Search Functionality for the Select Widget HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.