aligrudi / neatvi

A small vi/ex editor for editing bidirectional UTF-8 text

Home Page:http://litcave.rudi.ir/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Restore terminal state when neatvi exits

lobre opened this issue · comments

From what I have read from raw mode in the terminal, there is way to "restore" the terminal state when the application exits, so that the terminal goes back to where it was.

It means storing the original state in memory though.

See this link or the below snippet for more info.

struct termios orig_termios;

void disableRawMode() {
  tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

Is there a good reason why it is not implemented in neatvi? The outcome is that I continue to see some part of the editing session when I quit neatvi, instead of just being back to where I was before launching it.

Neatvi restores terminal state but not terminal contents.

Would it be using too much memory if it would restore terminal contents?