/* Updates the status bar */ static void update_status_win(enum win_refresh dorefresh) { int pos; int attr; attr = hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR); /* Print white background */ swin_wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) swin_mvwprintw(status_win, 0, pos, " "); /* Show the user which window is focused */ if (focus == GDB) swin_mvwprintw(status_win, 0, WIDTH - 1, "*"); else if (focus == CGDB || focus == CGDB_STATUS_BAR) swin_mvwprintw(status_win, 0, WIDTH - 1, " "); swin_wattroff(status_win, attr); /* Print the regex that the user is looking for Forward */ if (sbc_kind == SBC_REGEX && regex_direction_cur) { if_display_message("/", dorefresh, WIDTH - 1, "%s", ibuf_get(regex_cur)); swin_curs_set(1); } /* Regex backwards */ else if (sbc_kind == SBC_REGEX) { if_display_message("?", dorefresh, WIDTH - 1, "%s", ibuf_get(regex_cur)); swin_curs_set(1); } /* A colon command typed at the status bar */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) { const char *command = ibuf_get(cur_sbc); if (!command) command = ""; if_display_message(":", dorefresh, WIDTH - 1, "%s", command); swin_curs_set(1); } /* Default: Current Filename */ else { /* Print filename */ const char *filename = source_current_file(src_viewer); if (filename) { if_display_message("", dorefresh, WIDTH - 1, "%s", filename); } } if (dorefresh == WIN_REFRESH) swin_wrefresh(status_win); else swin_wnoutrefresh(status_win); }
/* Updates the status bar */ static void update_status_win(void) { int pos; char filename[FSUTIL_PATH_MAX]; int attr; if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1) return; /* Update the tty status bar */ if (tty_win_on) { wattron(tty_status_win, attr); for (pos = 0; pos < WIDTH; pos++) mvwprintw(tty_status_win, 0, pos, " "); mvwprintw(tty_status_win, 0, 0, (char *) tgdb_tty_name(tgdb)); wattroff(tty_status_win, attr); } /* Print white background */ wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) mvwprintw(status_win, 0, pos, " "); if (tty_win_on) wattron(tty_status_win, attr); /* Show the user which window is focused */ if (focus == GDB) mvwprintw(status_win, 0, WIDTH - 1, "*"); else if (focus == TTY && tty_win_on) mvwprintw(tty_status_win, 0, WIDTH - 1, "*"); else if (focus == CGDB || focus == CGDB_STATUS_BAR) mvwprintw(status_win, 0, WIDTH - 1, " "); wattroff(status_win, attr); if (tty_win_on) wattroff(tty_status_win, attr); /* Print the regex that the user is looking for Forward */ if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX && regex_direction_cur) { if_display_message("/", WIDTH - 1, "%s", ibuf_get(regex_cur)); curs_set(1); } /* Regex backwards */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX) { if_display_message("?", WIDTH - 1, "%s", ibuf_get(regex_cur)); curs_set(1); } /* A colon command typed at the status bar */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) { char *command = ibuf_get(cur_sbc); if (!command) command = ""; if_display_message(":", WIDTH - 1, "%s", command); curs_set(1); } /* Default: Current Filename */ else { /* Print filename */ if (src_win != NULL && source_current_file(src_win, filename) != NULL) if_display_message("", WIDTH - 1, "%s", filename); } wrefresh(status_win); }