+ /* Decide on alignment (vertical/horizontal?), thereby hint text space. */
+ char * more = "more";
+ uint16_t dsc_space = frame->size.x;
+ if ('<' == dir || '>' == dir)
+ {
+ dsc_space = frame->size.y;
+ } /* vv-- 10 = max strlen for uint16_t */
+ char scrolldsc[1 + strlen(more) + 1 + 10 + 1 + strlen(unit) + 1 + 1];
+ sprintf(scrolldsc, " %d %s %s ", dist, more, unit);
+
+ /* Decide on offset of the description text inside the scroll hint line. */
+ uint16_t dsc_offset = 1;
+ if (dsc_space > strlen(scrolldsc) + 1)
+ {
+ dsc_offset = (dsc_space - strlen(scrolldsc)) / 2;
+ }
+
+ /* Draw scroll hint line as dir symbols bracketing description text. */
+ uint16_t draw_offset = 0;
+ if ('>' == dir)
+ {
+ draw_offset = frame->size.x - 1;
+ }
+ else if ('v' == dir)
+ {
+ draw_offset = frame->size.y - 1;
+ }
+ uint16_t q = 0;
+ for (; q < dsc_space; q++)
+ {
+ chtype symbol = dir | A_REVERSE;
+ if (q >= dsc_offset && q < strlen(scrolldsc) + dsc_offset)
+ {
+ symbol = scrolldsc[q - dsc_offset] | A_REVERSE;
+ }
+ if ('<' == dir || '>' == dir)
+ {
+ mvwaddch(wm->padframe.curses_win,
+ start.y + q, start.x + draw_offset, symbol);
+ }
+ else
+ {
+ mvwaddch(wm->padframe.curses_win,
+ start.y + draw_offset, start.x + q, symbol);
+ }
+ }
+}
+
+
+static void padscroll_hint(struct WinMeta * wm, char dir, uint16_t dist)
+{
+ struct yx_uint16 start;
+ start.y = 0;
+ start.x = wm->pad_offset;
+ scroll_hint(wm, &wm->padframe, dir, dist, "columns", start);
+}
+
+
+
+static void winscroll_hint(struct WinMeta * wm, struct Win * w, char dir,
+ uint16_t dist)
+{
+ char * unit = "lines";
+ if ('<' == dir || '>' == dir)
+ {
+ unit = "columns";
+ }
+ struct yx_uint16 start = w->start;
+ scroll_hint(wm, &w->frame, dir, dist, unit, start);