-void draw_all_windows (struct WinMeta * win_meta) {
-// Draw all windows and their borders.
- int y, x;
- for (y = 0; y < win_meta->height; y++)
- for (x = 0; x < win_meta->width; x++)
- mvaddch(y, x, ' ');
- if (win_meta->chain_start) {
- int n_wins = 1;
- struct Win * win_p = win_meta->chain_start;
+extern void draw_scroll_hint (struct Frame * frame, uint16_t pos, uint32_t dist, char dir) {
+// Draw scroll hint into frame at pos (row or col dependend on dir), mark distance of dist cells into dir.
+ char more[] = "more";
+ char unit_cols[] = "columns";
+ char unit_rows[] = "lines";
+ uint16_t dsc_space = frame->size.x;
+ char * unit = unit_rows;
+ if ('<' == dir || '>' == dir) {
+ dsc_space = frame->size.y;
+ unit = unit_cols; }
+ char * scrolldsc = malloc((4 * sizeof(char)) + strlen(more) + strlen(unit) + 10); // 10 = uint32 max strlen
+ sprintf(scrolldsc, " %d %s %s ", dist, more, unit);
+ char offset = 1, q;
+ if (dsc_space > strlen(scrolldsc) + 1)
+ offset = (dsc_space - strlen(scrolldsc)) / 2;
+ chtype symbol;
+ for (q = 0; q < dsc_space; q++) {
+ if (q >= offset && q < strlen(scrolldsc) + offset)
+ symbol = scrolldsc[q - offset] | A_REVERSE;
+ else
+ symbol = dir | A_REVERSE;
+ if ('<' == dir || '>' == dir)
+ mvwaddch(frame->curses_win, q, pos, symbol);
+ else
+ mvwaddch(frame->curses_win, pos, q, symbol); }
+ free(scrolldsc); }
+
+extern void draw_all_windows (struct WinMeta * wmeta) {
+// Draw pad with all windows and their borders, plus scrolling hints.
+ erase();
+ wnoutrefresh(wmeta->screen);
+ werase(wmeta->pad.curses_win);
+ if (wmeta->chain_start) {
+ uint16_t n_wins = 1, i, y;
+ struct Win * win_p = wmeta->chain_start;