lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.4dev.20] Scroll indicators on menu


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.20] Scroll indicators on menu
Date: Wed, 2 May 2001 03:55:23 -0400
User-agent: Mutt/1.2.5i

This patch enables scroll indicators on the menus - shown if there is
a part of menu before/after the visible area.

Enjoy,
Ilya

--- src/LYStrings.c     2001/05/02 06:54:12     1.2
+++ src/LYStrings.c     2001/05/02 07:40:52
@@ -3703,6 +3703,10 @@ PUBLIC int LYhandlePopupList ARGS9(
     char buffer[MAX_LINE];
     char *popup_status_msg = NULL;
     CONST char **Cptr = NULL;
+#define CAN_SCROLL_DOWN        1
+#define CAN_SCROLL_UP  2
+#define CAN_SCROLL     4
+    int can_scroll = 0, can_scroll_was = 0;
 
     orig_choice = cur_choice;
     if (cur_choice < 0)
@@ -3815,6 +3819,8 @@ PUBLIC int LYhandlePopupList ARGS9(
      *  This is really fun, when the length is 4, it means 0 to 4, or 5.
      */
     length = (bottom - top) - 2;
+    if (length <= num_choices)
+       can_scroll = CAN_SCROLL;
 
     /*
      *  Move the window down if it's too high.
@@ -3900,6 +3906,25 @@ redraw:
      */
     while (cmd != LYK_ACTIVATE) {
        int row = ((i + 1) - window_offset);
+
+       /* Show scroll indicators. */
+       if (can_scroll) {
+           can_scroll = ((window_offset ? CAN_SCROLL_UP : 0)
+                         | (num_choices - window_offset >= length
+                            ? CAN_SCROLL_DOWN : 0));
+           if (~can_scroll & can_scroll_was) { /* Need to redraw */
+               LYbox(form_window, !numbered);
+               can_scroll_was = 0;
+           }
+           if (can_scroll & ~can_scroll_was & CAN_SCROLL_UP) {
+               wmove(form_window, 1, Lnum + width + 3);
+               waddch(form_window, ACS_UARROW);
+           }
+           if (can_scroll & ~can_scroll_was & CAN_SCROLL_DOWN) {
+               wmove(form_window, length, Lnum + width + 3);
+               waddch(form_window, ACS_DARROW);
+           }
+       }
 
        /*
         *  Unreverse cur choice.

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]