I finally figured out what's going on here after years of frustration, and it's super annoying.
If you press and hold the Right-Ctrl key, then press and release the Right-Shift key, the whole script editor goes into Right-To-Left (RTL) mode.
If you then press and hold the Left-Ctrl key, then press and release the Left-Shift key, the script editor will revert back to Left-To-Right (LTR; non-RTL) mode.
For years this bugged me, because it would happen while using selection navigation keys such as Ctrl+Shift + Home/End/Up/Down etc. Turns out if my finger releases the Shift key before the Ctrl key, it will enter RTL mode. I never knew why this was or how to undo it until now.
If RTL mode might be useful to someone, please add a push button to get out of RTL mode when somebody accidentally gets into it.
There is also a mysterious RTL hotkey for the typical channel/query Editbox, but I'm not sure how I accidentally get into that just yet. It's a different key combination.
Well. At least I won lunch.
Good philosophy, see good in bad, I like!