It’s not about the GUI, it’s specifically about
TextEdit‘s strategy for saving changes: it does not write in place on the existing file, but rather it first writes a new one, and when that’s completed it removes the old one and renames the new one to the old one’s names. Many editors (programs that conceptually alter a file “in place”), GUI or not, use this strategy for safety purposes (you won’t lose both the new and old versions if there’s a crash at a very unfortunate moment just when the writing is taking place), but as you noticed it “breaks” hard links.
One example of a non-interactive, non-GUI editor program with this behavior is
perl with the
-i (“in-place edits”) command-line option switch…:
$ touch za.txt $ ln za.txt zo.txt $ echo ciao >za.txt $ cat zo.txt ciao $ perl -i -p -e 's/a/b/' zo.txt $ cat zo.txt cibo $ cat za.txt ciao