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)
- Broken bindings after 0.61.0 HOT 3
- Header icon broken since 0.61.0 HOT 4
- Action lookup failing HOT 3
- Footer issue on 0.63.0 HOT 1
- Action lookup problems on 0.63.1 HOT 1
- Footer bindings invisible on app launch HOT 2
- UI freezes on screen dismissal with new Footer HOT 14
- Make textual apps pipeable by default HOT 1
- Add `isort` to dev dependencies HOT 1
- New `Footer` missing space between key and description HOT 1
- https://textual.textualize.io/getting_started/ Bad Link for Mamba HOT 4
- Textual CSS Tree-sitter grammar/parser HOT 1
- Bindings in footer sometimes don't update HOT 2
- DataTable inside a TabbedContent/TabPane behaves abnormally. HOT 5
- `MountError: Can't mount widget(s) before <widget> is mounted` with `widgets=()` during dynamic refresh HOT 10
- Initial `Footer` flicker with overlapping key bindings HOT 2
- Emojis in command names HOT 1
- Input templates HOT 1
- `grid-rows: auto` does not consider height for rows that are spanned HOT 1
- Markdown Widget Lagging when Opening Large Files HOT 2
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.