- Enable Raw Mode
I will use cfmakeraw(&termios_struct); but its better to know how and what is being done
Disable in c_lflag - ICANON, ECHO, ISIG, IEXTEN
Basicly all processing in real time of the input given by user is disabled. Now, all characters are read one by one.
Disable in c_iflag - IXON, ICRNL, INLCR, IGNCR, BRKINT, PARMRK, ISTRIP
Interpret all input modes as they are. No flow contro by ctrl + (-), prevents \r and \n translations. disables special characters, keeps /-bit characters, etc.
Verify in c_cflag - CS8, PARENB
Ensures 8-bit data.
Set c_cc - VMIN, VTIME
No timeout, and blocks read until 1 byte available.
- Disable Ctrl+( ) escape keys
- Implement exit key. -> 'q' but in the end the exit key will be
similar to
nano's design.
- Write input on screen.
CTRL+#leads to an action.(X: Exits, TAB: 4 spaces)
Main References:
- https://gibby.dev/posts/gram/
- https://philippflenker.com/hecto-chapter-1/
Secondary References:
- https://www.averylaird.com/programming/the%20text%20editor/2017/09/30/the-piece-table
- https://www.catch22.net/tuts/neatpad/