Make `cursor_location` a reactive attribute
Closed this issue · 4 comments
joostrijneveld commented
I'm using a TextArea to create a fairly specific 'editor' Widget, and would like to constantly report to the user what the location of their cursor is (i.e., offset from the start of the line), like many editors do in the their footer.
Rather than polling the current value of cursor_location
, it would be nice if this is a reactive attribute that I can watch for.
github-actions commented
TomJGooding commented
You might instead watch the TextArea.selection
which is a reactive attribute, or handle the SelectionChanged
messages.
textual/src/textual/widgets/_text_area.py
Lines 1685 to 1691 in 0f62d13
joostrijneveld commented
Excellent! That solved my issue perfectly.
github-actions commented
Don't forget to star the repository!
Follow @textualizeio for Textual updates.