Building Text Editor From Scratch in C - Part II

The part 2 started with disabling Ctrl-C and Ctrl-Z signals. Instead of terminating current process by pressing Ctrl-C I was able to read byte code. For Ctrl-C it was 3 byte and for Ctrl-Z it was 26. I was able to do that by using ISIG flag: raw.c_lflag &= ~(ECHO | ICANON | ISIG); Next step was disabling Ctrl-S and Ctrl-Q signals. It turned out that Ctrl-S and Ctrl-Q were needed for software flow control to transmit data to the terminal. Ctrl-S allows you to stop transmission and Ctrl-Q allows you to resume transmission. ...

March 13, 2026 · 2 min · Dmytro Chumakov

Building Text Editor From Scratch in C - Part I

What I learned so far I learned that I need to start with a simple read() operation that reads user input. while (read(STDIN_FILENO, &c, 1) == 1); But there was a caveat: if you use the read() operation, the terminal starts in canonical mode. This mode sends keyboard input only after the user presses Enter, so it was not very useful because I want to process all keypresses. The solution was to start the terminal in raw mode, but there was no built-in functionality, so I needed to write it myself by turning off some flags. ...

March 6, 2026 · 2 min · Dmytro Chumakov