diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2017-12-08 21:09:50 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2017-12-10 14:33:31 +0100 |
commit | 9e060b96c2c5997342a06b9958db0bf470646a96 (patch) | |
tree | ad78ccd19676abe6fd58602b5f72ce914a111d86 /src/wins.c | |
parent | e733d09ea02897e7013a0745223b777ae5981fd5 (diff) | |
download | calcurse-9e060b96c2c5997342a06b9958db0bf470646a96.tar.gz calcurse-9e060b96c2c5997342a06b9958db0bf470646a96.zip |
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>
Diffstat (limited to 'src/wins.c')
-rw-r--r-- | src/wins.c | 35 |
1 files changed, 21 insertions, 14 deletions
@@ -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(); } |