A text editor of your own

: the road from a key you press to a letter on the screen. You will write the program in the middle of that road, the one that reads the key, changes the text and draws the screen again.
Salvatore Sanfilippo, who goes by antirez and who also created Redis, wrote a text editor and called it Kilo. The name comes from its size, because the whole editor is under 1024 lines of C. It uses no library for the screen, not even curses. It still has search and colours for code. The copyright line in its source says 2016, and he published it as a small program that anyone can read from top to bottom.
That is the surprise. An editor feels like a huge thing, but the core is small. Your terminal sends each key to the program, and the program must do everything else itself: keep the text, change it, undo the change, find words and paint the screen.
By the end you will be able to write a working terminal editor of 125 lines in Python. It will type, move, save, search, undo and redraw. You will also know why it stores its text the way it does.
Before you start. A terminal sends a signal when you press Ctrl-C, and a program decides what to do with it (The tap on the shoulder). A program reads the keyboard through a numbered door called a file descriptor, number 0 (Everything is a file descriptor). In the shell lesson the terminal chose which program got Ctrl-C and Ctrl-Z (A shell of your own). Here you take the keyboard for yourself and switch those helpers off. Growing a block of memory when it is full is the same problem that an allocator solves (A malloc of your own).