Commit f7bc2e61 f7bc2e6134814c15ca726854fe2b826b55498ea9 by Sergey Poznyakoff

(top_of_page,cursor,page_map,page_size)

(page_avail,page_map): Hide as static
(fill_page_map): Reset cursor if it points past the last
message.
1 parent 201b6c41
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
18 18
19 #include "mail.h" 19 #include "mail.h"
20 20
21 size_t top_of_page = 1; /* Number of the topmost message on the page */ 21 static size_t top_of_page = 1; /* Number of the topmost message on the page */
22 size_t cursor; /* Number of current message */ 22 static size_t cursor; /* Number of current message */
23 23
24 size_t *page_map; /* Array of message numbers. page_map[N] holds 24 static size_t *page_map; /* Array of message numbers. page_map[N] holds
25 number of the message occupying Nth line on 25 number of the message occupying Nth line on
26 the screen */ 26 the screen */
27 unsigned page_size; /* Capacity of page_map */ 27 static unsigned page_size; /* Capacity of page_map */
28 unsigned page_avail; /* First non-used entry in page map. Can be 28 static unsigned page_avail; /* First non-used entry in page map. Can be
29 equal to page_size */ 29 equal to page_size */
30 30
31 /* Auxiliary function: Store number of message from mspec into page_map */ 31 /* Auxiliary function: Store number of message from mspec into page_map */
32 static int 32 static int
...@@ -46,6 +46,8 @@ fill_page_map () ...@@ -46,6 +46,8 @@ fill_page_map ()
46 util_range_msg (top_of_page, page_size, 46 util_range_msg (top_of_page, page_size,
47 MSG_COUNT|MSG_NODELETED|MSG_SILENT, _fill_map, 47 MSG_COUNT|MSG_NODELETED|MSG_SILENT, _fill_map,
48 &page_avail); 48 &page_avail);
49 if (cursor >= page_avail)
50 cursor = page_avail - 1;
49 } 51 }
50 52
51 /* Check if the page_map is valid. If not, fill it. 53 /* Check if the page_map is valid. If not, fill it.
......