const int buffer_size = 1024;
const int nb_lines_max = 100000;
-void build_display(int *screen_line, int *line, int nb_lines, char **lines, char *regexp) {
+void refresh_screen(int *screen_line, int *line, int nb_lines, char **lines, char *regexp, int noblink) {
char buffer[buffer_size];
int maxx = getmaxx(stdscr);
int maxy = min(buffer_size-2, getmaxy(stdscr));
- // clear(); // Cleaning the window
+ if(!noblink) {
+ clear();
+ }
use_default_colors();
k++;
}
- while(k < maxx - 1) {
- buffer[k++] = ' ';
+ if(noblink) {
+ while(k < maxx - 1) {
+ buffer[k++] = ' ';
+ }
}
buffer[k++] = '\n';
buffer[k++] = '\0';
y++;
}
- { // Erase the rest of the window. That's slightly ugly.
+ if(noblink) { // Erase the rest of the window. That's slightly ugly.
int k = 0;
while(k < maxx - 1) {
buffer[k++] = ' ';
int main(int argc, char **argv) {
char buffer[buffer_size];
char *lines[nb_lines_max];
+ int noblink = 1;
char *file_name;
char stdin_name[] = "/dev/stdin";
int line = 0, screen_line = 0;
- build_display(&screen_line, &line, nb_lines, lines, regexp);
+ refresh_screen(&screen_line, &line, nb_lines, lines, regexp, noblink);
do {
line++;
}
- build_display(&screen_line, &line, nb_lines, lines, regexp);
+ refresh_screen(&screen_line, &line, nb_lines, lines, regexp, noblink);
} while(key != '\n' && key != KEY_ENTER && key != '\a');
echo();