diff --git a/cava.c b/cava.c index 5d4359a..6c5658f 100644 --- a/cava.c +++ b/cava.c @@ -767,11 +767,11 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co if (output_mode == OUTPUT_NCURSES) ch = getch(); #endif - /* - // disabled key controls in non-curses mode, caused garbage on screen + +#ifndef _MSC_VER if (output_mode == OUTPUT_NONCURSES) - ch = fgetc(stdin); - */ + read(0, &ch, sizeof(ch)); +#endif switch (ch) { case 65: // key up @@ -815,6 +815,8 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co should_quit = 1; } + ch = 0; + if (should_reload) { reloadConf = true; diff --git a/output/terminal_noncurses.c b/output/terminal_noncurses.c index 431346d..4a20eea 100644 --- a/output/terminal_noncurses.c +++ b/output/terminal_noncurses.c @@ -42,10 +42,15 @@ int setecho(int fd, int onoff) { if (tcgetattr(fd, &t) == -1) return -1; - if (onoff == 0) + if (onoff == 0) { t.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON); - else + t.c_cc[VTIME] = 0; + t.c_cc[VMIN] = 0; + } else { t.c_lflag |= (ECHO | ECHOE | ECHOK | ECHONL | ICANON); + t.c_cc[VTIME] = 0; + t.c_cc[VMIN] = 1; + } if (tcsetattr(fd, TCSANOW, &t) == -1) return -1;