I have followed the tutorial on how to make a text editor here. An annoying thing is that when the program exits raw mode, it doesn't show my previous commands. For example, if my shell prompt looks like this:
$ ls
$ gcc main.c -o main -Wall -std=c99 -Wextra -pedantic
$
and I run the text editor and quit it, it will look like this:
$
Can I get it to look like this:
$ ls
$ gcc main.c -o main -Wall -std=c99 -Wextra -pedantic
$ kilo main.c
$
Here's the code for entering raw mode, if that's helpful.
void enableRawMode(){
if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) die("tcgetattr");
atexit(disableRawMode);
struct termios raw = E.orig_termios;
raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
raw.c_oflag &= ~(OPOST);
raw.c_cflag |= ~(CS8);
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
raw.c_cc[VMIN] = 0;
raw.c_cc[VTIME] = 1;
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) die("tcsetattr");
}