Scrollbar and right window border

When a scrollbar is on display in APP or TOD windows, the right
vertical border (outside the scrollbar) is not highlighted
when the window is selected.

The scrollbar itself is always highlighted:
- when APP or TOD is deselected
- in configuration windows where borders otherwise are not

The patch moves the scrollbar parameters from arguments of
draw_scrollbar() to the function itself.

The highlight argument to draw_scrollbar() was always 1.
Instead call circumstances are figured out and highlight set
accordingly.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen
2017-12-08 21:09:50 +01:00
committed by Lukas Fleischer
parent e733d09ea0
commit 9e060b96c2
3 changed files with 49 additions and 23 deletions

View File

@@ -357,25 +357,32 @@ void wins_scrollwin_draw_deco(struct scrollwin *sw, int hilt)
/* Display a scrolling window. */
void wins_scrollwin_display(struct scrollwin *sw)
{
int inner_y = (conf.compact_panels ? 1 : 3);
int inner_x = 1;
int inner_y = sw->y + (conf.compact_panels ? 1 : 3);
int inner_x = sw->x + 1;
int inner_h = sw->h - (conf.compact_panels ? 2 : 4);
int inner_w = sw->w - 2;
if (sw->line_num > inner_h) {
int sbar_h = MAX(inner_h * inner_h / sw->line_num, 1);
int sbar_y = inner_y + sw->line_off * (inner_h - sbar_h) / (sw->line_num - inner_h);
int sbar_x = sw->w - 1;
draw_scrollbar(sw->win, sbar_y, sbar_x, sbar_h, inner_y,
inner_y + inner_h - 1, 1);
}
if (sw->line_num > inner_h)
draw_scrollbar(sw);
wmove(win[STA].p, 0, 0);
wnoutrefresh(sw->win);
pnoutrefresh(sw->inner, sw->line_off, 0, sw->y + inner_y,
sw->x + inner_x, sw->y + inner_y + inner_h - 1,
sw->x + inner_x + inner_w - 1);
/*
(sw->line_off, 0): upper left corner in pad to display;
scrolling is achieved by in/decreasing sw->line_off
between 0 and line_num - inner.h
(Y,X)=(inner_y,inner_x): upper left corner in screen window
(Y,X) + (inner_h - 1,inner_w - 1): lower right corner in screen window
|-inner_w-|
(Y,X)-> +---------+ -
| | |
| (pad) | inner_h
| | |
+---------+ <- -
*/
pnoutrefresh(sw->inner, sw->line_off, 0, inner_y, inner_x,
inner_y + inner_h - 1, inner_x + inner_w - 1);
wins_doupdate();
}