void displayLine(int offset, int max) { int i; PRINTW(("%08lX ", (int) (base + offset))); for (i = offset; i < offset + lineLength; i++) { if (i > offset) MAXATTRPRINTW(bufferAttr[i] & MARKED, (((i - offset) % blocSize) ? " " : " ")); if (i < max) { ATTRPRINTW( #ifdef HAVE_COLORS (!colored ? 0 : buffer[i] == 0 ? COLOR_PAIR(1) : buffer[i] < ' ' ? COLOR_PAIR(2) : buffer[i] >= 127 ? COLOR_PAIR(3) : 0) | #endif bufferAttr[i], ("%02X", buffer[i])); } else PRINTW((" ")); } PRINTW((" ")); for (i = offset; i < offset + lineLength; i++) { if (i >= max) PRINTW((" ")); else if (buffer[i] >= ' ' && buffer[i] < 127) ATTRPRINTW(bufferAttr[i], ("%c", buffer[i])); else ATTRPRINTW(bufferAttr[i], (".")); } }
/* * Display the given line. If it is tagged, highlight the name. */ static void show_line(VIEW * vp, unsigned j) { RING *gbl = vp->gbl; char bfr[BUFSIZ]; if (FILE_VISIBLE(vp, j)) { int line = (int) FILE2ROW(vp, j); int trimmed = FALSE; move(line, 0); ded2s(gbl, (int) j, bfr, sizeof(bfr)); if (gbl->Xbase < (int) strlen(bfr)) { int adj = gbl->cmdcol[CCOL_NAME]; int col = adj - gbl->Xbase; int len = COLS - col; #if defined(HAVE_HAS_COLORS) int end = gbl->cmdcol[CCOL_NAME] + gENTRY(j).z_namlen; #endif if (col < 0) { adj -= col; col = 0; len = COLS; } #if defined(HAVE_HAS_COLORS) if (end > COLS + gbl->Xbase) end = COLS + gbl->Xbase; #endif PRINTW("%.*s", COLS, &bfr[gbl->Xbase]); if (len > 0) { /* filename is visible */ if (gFLAG(j)) { trimmed = trim_at(line); move(line, col); (void) standout(); PRINTW("%.*s", len, &bfr[adj]); (void) standend(); } #if defined(HAVE_HAS_COLORS) else if (has_colors() && end > adj) { trimmed = trim_at(line); move(line, col); dedcolor(&(gENTRY(j))); PRINTW("%.*s", end - adj, &bfr[adj]); dedcolor((FLIST *) 0); } #endif /* HAVE_HAS_COLORS */ } } if (!trimmed) (void) trim_at(line); } }
/* * Display the marker which precedes the workspace */ void showMARK(int col) { int marks, units; int y, x; char value[20]; getyx(stdscr, y, x); move(mark_W, 0); marks = COLS; units = (col % 10); col /= 10; while (marks > 0) { int ys, xs; int limit = ((marks > 10) ? 10 : marks) - units; int first; if (limit <= 0) break; getyx(stdscr, ys, xs); addchnstr(bar_ruler + units, limit); FORMAT(value, "%d", ++col); first = 10 - units - (int) strlen(value); if (first < limit) { move(ys, xs + first); PRINTW("%.*s", limit - first, value); } marks -= (10 - units); units = 0; } move(y, x); }
void display(void) { int i; for (i = 0; i < nbBytes; i += lineLength) { move(i / lineLength, 0); displayLine(i, nbBytes); } for (; i < page; i += lineLength) { int j; move(i / lineLength, 0); for (j = 0; j < colsUsed; j++) printw(" "); /* cleanup the line */ move(i / lineLength, 0); PRINTW(("%08lX", (int) (base + i))); } attrset(NORMAL); move(LINES - 1, 0); for (i = 0; i < colsUsed; i++) printw("-"); move(LINES - 1, 0); if (isReadOnly) i = '%'; else if (edited) i = '*'; else i = '-'; printw("-%c%c %s --0x%llX", i, i, baseName, base + cursor); if (MAX(fileSize, lastEditedLoc)) printw("/0x%llX", getfilesize()); if (mode == bySector) printw("--sector %lld", (base + cursor) / SECTOR_SIZE); move(cursor / lineLength, computeCursorXCurrentPos()); }
static void IgnorePage(int infile) { static time_t last; time_t now = time((time_t *) 0); if (now != last) { last = now; move(LINES - 1, 0); (void) standout(); PRINTW("---line %d ...skipping", infile); (void) standend(); PRINTW(" "); clrtoeol(); refresh(); } }
static int typeline(int y, int skip) { int found; if ((found = (UsePattern && GOT_REGEX(ToFind, Text))) != 0) HadPattern = TRUE; if (!skip) { move(y, 0); Tlen -= Shift; if (Tlen > COLS) Tlen = COLS; if (found) { (void) standout(); if (Tlen > 0) PRINTW("%.*s", Tlen, Text + Shift); else addstr(" "); (void) standend(); } else if (Tlen > 0) { int now = Shift, j; while (Tlen > 0) { for (j = now; j < now + Tlen; j++) { if (Over[j] != Over[now]) break; } if (Over[now]) (void) standout(); PRINTW("%.*s", (j - now), Text + now); if (Over[now]) (void) standend(); Tlen -= (j - now); now = j; } } clrtoeol(); } typeinit(); return (++y); }
static int FinishPage(RING * gbl, int inlist, int infile, int y) { int shown = FALSE; int foo; off_t length = 0; while (y < LINES - 1) y = typeline(y, FALSE); move(LINES - 1, 0); (void) standout(); PRINTW("---lines %d to %d", TopOfPage(infile, &foo) + 1, infile); if (inlist >= 0) { int oldy, oldx; int save = gbl->AT_opt; getyx(stdscr, oldy, oldx); (void) standend(); gbl->AT_opt = TRUE; shown = reshow(gbl, (unsigned) inlist); gbl->AT_opt = save; gbl->mrkfile = -1; markC(gbl, TRUE); (void) standout(); move(oldy, oldx); } if ((length = MaxP()) != 0) { off_t num = ftell(InFile); PRINTW(": %.1f%%", ((double) num * 100.) / (double) length); } PRINTW("---"); (void) standend(); PRINTW(" "); clrtoeol(); return shown; }
void displayCentered(char *msg, int line) { clr_line(line); move(line, (COLS - strlen(msg)) / 2); PRINTW(("%s", msg)); }