]> git.deb.at Git - pkg/abook.git/blobdiff - list.c
- code cleanups and minor fixes
[pkg/abook.git] / list.c
diff --git a/list.c b/list.c
index d3a53c36f423c50b49e757145e8014a7727cbf8b..b208054d7cdfa71991a570d914f7c5273784fb3a 100644 (file)
--- a/list.c
+++ b/list.c
@@ -82,17 +82,17 @@ void
 refresh_list()
 {
        int i, line;
-       
+
        werase(list);
 
        ui_print_number_of_items();
-       
-       if(items < 1) {
+
+       if(list_is_empty()) {
                refresh();
                wrefresh(list);
                return;
        }
-       
+
        if(curitem < 0)
                curitem = 0;
 
@@ -110,6 +110,11 @@ refresh_list()
                print_list_line(i, line, i == curitem);
         }
 
+       if(opt_get_bool(BOOL_SHOW_CURSOR)) {
+               wmove(list, curitem - first_list_item, 0);
+               /* need to call refresh() to update the cursor positions */
+               refresh();
+       }
         wrefresh(list);
 }
 
@@ -127,7 +132,7 @@ print_list_line(int i, int line, int highlight)
 
        if(selected[i])
                mvwaddch(list, line, 0, '*' );
-       
+
        mvwaddnstr(list, line, NAMEPOS, database[i][NAME],
                bytes2width(database[i][NAME], NAMELEN));
        if(opt_get_bool(BOOL_SHOW_ALL_EMAILS))
@@ -150,22 +155,20 @@ print_list_line(int i, int line, int highlight)
        if(highlight)
                wstandend(list);
 }
-       
+
 
 void
 list_headerline()
 {
-#ifdef A_BOLD
+#if defined(A_BOLD) && defined(A_NORMAL)
        attrset(A_BOLD);
-#else
-       /* hmm, maybe something here */
 #endif
        mvaddstr(2, NAMEPOS, abook_fields[NAME].name);
        mvaddstr(2, EMAILPOS, abook_fields[EMAIL].name);
        if(extra_column > 0)
                mvaddnstr(2, EXTRAPOS, abook_fields[extra_column].name,
                                COLS-EXTRAPOS);
-#ifdef A_BOLD
+#if defined(A_BOLD) && defined(A_NORMAL)
        attrset(A_NORMAL);
 #endif
 }
@@ -198,10 +201,10 @@ page_up()
 {
        if(curitem < 1)
                return;
-       
+
        curitem = curitem == first_list_item ?
                ((curitem -= LIST_LINES) < 0 ? 0 : curitem) : first_list_item;
-       
+
        refresh_list();
 }
 
@@ -264,7 +267,7 @@ goto_home()
 {
        if(items > 0)
                curitem = 0;
-       
+
        refresh_list();
 }