aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-12-17 08:25:10 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2018-05-26 11:31:43 +0200
commitbb7381765c435ac37e133f7fcc14a07823539050 (patch)
treef0902c3c714dca97607000e464b52df37aa44e01 /src/utils.c
parenta5cc46cd550b335b0de6ce7658e0c1ca5068255e (diff)
downloadcalcurse-bb7381765c435ac37e133f7fcc14a07823539050.tar.gz
calcurse-bb7381765c435ac37e133f7fcc14a07823539050.zip
Scrollbar and right window border (corrected)
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 is always highlighted: - when APP or TOD is deselected - in configuration windows where borders otherwise are not The patch moves the scrollbar parameters (except highlight) from arguments of draw_scrollbar() to the function itself. The highlight argument was 1; instead it is set higher in the call hierarchy (wins_update_panels()) and passed on down. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/utils.c b/src/utils.c
index 2879de7..495b8fc 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -574,8 +574,7 @@ long min2sec(unsigned minutes)
* Display a scroll bar when there are so many items that they
* can not be displayed inside the corresponding panel.
*/
-void
-draw_scrollbar(struct scrollwin *sw)
+void draw_scrollbar(struct scrollwin *sw, int hilt)
{
int y = (conf.compact_panels ? 1 : 3);
int h = sw->h - (conf.compact_panels ? 2 : 4);
@@ -584,20 +583,14 @@ draw_scrollbar(struct scrollwin *sw)
int sbar_y = y + sw->line_off * (h - sbar_h) / (sw->line_num - h);
int sbar_x = sw->w - 1;
- /* which scrollwin am I? */
- enum win swid = -1;
- if (strcmp(sw->label, _("TODO")) == 0)
- swid = TOD;
- else if (strcmp(sw->label, _("Appointments")) == 0)
- swid = APP;
- /*
- * Redraw the vertical right border.
- * For APP and TOD this is done as part of the move up/down.
- */
- if (swid == -1)
- mvwvline(sw->win, y, sbar_x, ACS_VLINE, h);
+ /* Redraw part of the border. */
+ if (hilt)
+ custom_apply_attr(sw->win, ATTR_HIGHEST);
+ mvwvline(sw->win, y, sbar_x, ACS_VLINE, h);
+ if (hilt)
+ custom_remove_attr(sw->win, ATTR_HIGHEST);
- int hilt = swid == wins_slctd();
+ /* Draw the scrollbar. */
if (hilt)
custom_apply_attr(sw->win, ATTR_HIGHEST);
wattron(sw->win, A_REVERSE);