I have the same problem – every time I edit code in the theme editor the whole php file becomes blank. Once this happens it is impossible to re-add content to that file, as each time I hit ‘update file’ the file becomes blank again. The files I have not edited are OK.
This has only happened recently and I have updated these files many times before without issue. I have not upgraded my WordPress version or changed theme recently, and as far as I know I have not made any recent changes that might have caused this. I have the same problem on multiple sites. If anyone knows a solution for this, please let me know.
Thanks