restore last session of my text editor
TextEdit, which is part of every version of MacOS, does exactly that, if you check this box when shutting down or logging out.



The downside is trying to discipline yourself to put things away once in a while.  At this moment, I literally¹ have three dozen "Untitled" text windows in my Dock.

¹The pre-2000 meaning of "literally"