Closed SharpBit closed 3 years ago
Tried using os.system
to modify the title bar but got text_editor.py:72:1: S605 Starting a process with a shell, possible injection detected, security issue.
when linting.
Seems to be no event that is called whenever a TextArea
has its contents edited.
There is accept_handler – Called when Enter is pressed (This should be a callable that takes a buffer as input).
but that's only when Enter is pressed.
Maybe look into History
Just noticed the Buffer data structure has an on_text_changed
callable, which sounds like what we're after.
https://python-prompt-toolkit.readthedocs.io/en/master/pages/reference.html#module-prompt_toolkit.buffer
I think this is definitely doable by setting that callable to toggle an asterisk before the window title on a change to the text buffer. I could then write a function to remove the asterisk on saving and call it from within each of the save functions on successful save.
*
in the title bar of the terminalTextArea
has its contents edited.