Sahej-sethi/collab-editor ? reverse-engineered prompt

Reverse engineered prompt

Build me a real time collaborative code editor that runs in the terminal, kind of like Google Docs for code, but self hosted and written in C++17 for Linux.

I want a server and client that connect over TCP, let multiple people edit the same file at once, and keep everyone in sync without overwriting each other’s changes. The editor should show other users’ cursors, a small collaborator sidebar, syntax highlighting for C++ code, and basic smart editing like auto indent, bracket pairing, tab snapping, comment toggle, scrolling, selection, copy and paste, and save to disk.

Please make it work with raw sockets, ncurses, and a lightweight custom protocol, with a focus on handling concurrent edits cleanly. Use a data structure that makes text editing efficient, and make sure the app can handle clients joining and leaving without crashing. If you need to, look up current Linux or ncurses docs online. Also add a simple build process and a few tests so I can run it easily from the Makefile.