src/terminal_functions.c
/*
 * A method to get rid of canonical mode of the terminal, and instead, goto
 * raw mode. 
 */
A method to get rid of canonical mode of the terminal, and instead, goto
raw mode.
A method to get rid of canonical mode of the terminal and instead goto raw mode .
void enable_raw_mode()
{
    if(tcgetattr(STDIN_FILENO, &editor.orig_terminal)==-1)
        error("tcgetattr failed, cannot disable canonical mode");
    atexit(disable_raw_mode);
    termios raw = editor.orig_terminal; 
    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)
        error("tcsetattr failed, cannot apply modifications to termios"); 
}
void enable_raw_mode ( ) { if ( tcgetattr ( STDIN_FILENO , & editor . orig_terminal ) == -1 ) error ( " " ) ; atexit ( disable_raw_mode ) ; termios raw = editor . orig_terminal ; 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 ) error ( " " ) ; }
A method to get rid of canonical mode of the terminal, and instead, goto
 raw mode.
A method to get rid of canonical mode of the terminal and instead goto raw mode .