Multihead terminal-based text editors ?




Reaction score: 160
Messages: 1,150

He has no requirements. He is just throlling. Look at all the other threads he started.

It is a solid consideration for using terminal editor.
Some might understand the needs, if more interested in terminal and console (no gui) use.



Reaction score: 160
Messages: 1,150

One of challenges when you are working in team is to collaborate in an efficient way. Moreover, working from distance with a team is a nightmare especially when you are creating a report or you are brainstorming ideas. From this perspective, the idea of creating a real-time collaborative text editor was born. The collaborative text editor permits multiple users to work on a single document simultaneously via the network.

This idea should work on the Unix console of NetBSD (likely best Unix ever *ads*).

The drawback of GUI and X11 is that it is slow and unefficient. No X11 or GUI Allowed!!
The magic of the console is that it is fast, robust and readily resource friendly.

The C language only + a compiler clang only + nothing else !!!
No library involved !!
clang tcpedit-server -o server
clang tcpedit-client -o client

To make it work, it is needed to disable enter for instance on the client side.

void disable_waiting_for_enter(void)
    struct termios newt;

    /* Make terminal read 1 char at a time */
    tcgetattr(0, &oldt);  /* Save terminal settings */
    newt = oldt;  /* Init new settings */
    newt.c_lflag &= ~(ICANON | ECHO);  /* Change settings */
    tcsetattr(0, TCSANOW, &newt);  /* Apply settings */
    atexit(restore_terminal_settings); /* Make sure settings will be restored when program ends  */

ch = getchar();

And, then on the server, "write" to send back the drawn screen.

Once a key is pressed on the client, the server send back the full screen (row / cols limited).

Note that you need to test the row/cols before.
printf("Env TERM ROW: %d\n", w.ws_row );
printf("Env TERM COL: %d\n", w.ws_col );

I have just made a basic editor over tcp/ sort of telnet ;)
That's fun.

The server is the editor on port 8888 ( ./tcpedit-server ).
On the intranet, anyone doing tcpedit-client 8888 will edit the file and have a sort of collaborative edition over telnet of a single file.
I have tried with 5 clients over this socket usage on the same server. It works pretty fast.
It still needs a sort of independant viewing, because each client see exactly the same of the other ones ;)
Sure, the editor does "draw" the same view (write/send the current line / cursor position and printed content over tcp).

The advantage is that it is very minimal, takes no cpu, takes no memory usage and it does well.

Does someone need it?