// Draw the modeline
move(0, 0);
+
if(with_colors) {
attron(COLOR_PAIR(1));
} else {
move(0, 0);
+ // There must be a more elegant way of moving the cursor at a
+ // location met during display
+
+ int cursor_x = 0;
+
if(title) {
addstr(title);
addstr(" ");
+ cursor_x += strlen(title) + 1;
}
- printw("%d/%d ", nb_printed_lines, nb_lines);
+ sprintf(buffer, "%d/%d ", nb_printed_lines, nb_lines);
+ addstr(buffer);
+ cursor_x += strlen(buffer);
addnstr(pattern, cursor_position);
-
- // Now we print the cursor. All that mess to have reverse video with
- // and without color.
-
- if(with_colors) {
- attroff(COLOR_PAIR(1));
- attron(COLOR_PAIR(3));
- } else {
- attroff(A_REVERSE);
- }
+ cursor_x += cursor_position;
if(pattern[cursor_position]) {
- addnstr(&pattern[cursor_position], 1);
+ addstr(pattern + cursor_position);
} else {
addstr(" ");
}
- if(with_colors) {
- attroff(COLOR_PAIR(3));
- attron(COLOR_PAIR(1));
- } else {
- attron(A_REVERSE);
- }
-
- if(pattern[cursor_position]) {
- addstr(pattern + cursor_position + 1);
- }
-
- // Finished printing the cursor
-
if(use_regexp) {
addstr(" [regexp]");
}
+ move(0, cursor_x);
+
if(with_colors) {
attroff(COLOR_PAIR(1));
} else {
noecho();
// Hide the cursor
- curs_set(0);
+ // curs_set(0);
// So that the arrow keys work
keypad(stdscr, TRUE);
color_fg_highlight < 0 || color_bg_highlight >= COLORS ||
color_bg_highlight < 0 || color_bg_highlight >= COLORS) {
echo();
- curs_set(1);
+ // curs_set(1);
endwin();
cerr << "Color numbers have to be between 0 and " << COLORS - 1 << "." << endl;
exit(1);
}
else if(key == KEY_DOWN ||
- key == '\014') { // ^N
+ key == '\016') { // ^N
motion = 1;
}
else if(key == KEY_UP ||
- key == '\016') { // ^P
+ key == '\020') { // ^P
motion = -1;
}
} while(key != '\n' && key != KEY_ENTER && key != '\007'); // ^G
echo();
- curs_set(1);
+ // curs_set(1);
endwin();
//////////////////////////////////////////////////////////////////////