textual icon indicating copy to clipboard operation
textual copied to clipboard

Should `TextArea` post `TextArea.Changed` message when calling the `load_text()` method?

Open joshbduncan opened this issue 1 year ago • 3 comments

I have an app that is tracking changes to a text area so it can update other widgets. If I change the content of the text area using the load_text() method shouldn't a TextArea.Changed message be posted. I understand not doing this during the init but I feel after the init, it may be a nice since the text area does actually change. It wouldn't be too hard to implement a catch that only posts the message if the text content is different from what is currently loaded.

I could do a PR if this is something you all feel warrants exploration, and if not, not a big deal as I found a simple work-a-round.

Keep up the great work. Cheers!

joshbduncan avatar Nov 09 '23 22:11 joshbduncan

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

github-actions[bot] avatar Nov 09 '23 22:11 github-actions[bot]

Perhaps related to the wider question of when messages should be posted in Textual:

  • #3417

TomJGooding avatar Nov 09 '23 22:11 TomJGooding

@TomJGooding, I did not see your issue when searching because I was being too specific in my search term. I agree with what @rodrigogiraoserrao said on your issue. Seems to me that if a widget has a Changed message it should post anytime the widget changes. If that is not in-line with how the API plans to work, then I agree with you it should be noted clearly in the docs. Thanks!

joshbduncan avatar Nov 09 '23 22:11 joshbduncan

Seems to have been fixed in https://github.com/Textualize/textual/pull/4256

darrenburns avatar Mar 26 '24 13:03 darrenburns

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

github-actions[bot] avatar Mar 26 '24 13:03 github-actions[bot]