diff --git a/src/list_window.c b/src/list_window.c
index 215a531dd4907a8bcba373c084db1c7706182f55..93bed86667db070332e3da3bb344dca1b28fa57e 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
#include "list_window.h"
#include "config.h"
#include "options.h"
+#include "charset.h"
#include "support.h"
#include "command.h"
#include "colors.h"
lw->w = w;
lw->cols = width;
lw->rows = height;
- lw->clear = 1;
return lw;
}
lw->selected = 0;
lw->xoffset = 0;
lw->start = 0;
- lw->clear = 1;
}
void
else
lw->start = 0;
}
-
- lw->repaint = lw->clear = 1;
}
void
lw->selected = n;
}
-void
+static void
list_window_next(struct list_window *lw, unsigned length)
{
if (lw->selected + 1 < length)
lw->selected = 0;
}
-void
+static void
list_window_previous(struct list_window *lw, unsigned length)
{
if (lw->selected > 0)
lw->selected = length - 1;
}
-void
+static void
list_window_first(struct list_window *lw)
{
lw->xoffset = 0;
lw->selected = 0;
}
-void
+static void
list_window_last(struct list_window *lw, unsigned length)
{
lw->xoffset = 0;
lw->selected = 0;
}
-void
+static void
list_window_next_page(struct list_window *lw, unsigned length)
{
if (lw->rows < 2)
list_window_last(lw, length);
}
-void
+static void
list_window_previous_page(struct list_window *lw)
{
if (lw->rows < 2)
int show_cursor = !(lw->flags & LW_HIDE_CURSOR);
if (show_cursor) {
- if (lw->selected < lw->start) {
+ if (lw->selected < lw->start)
lw->start = lw->selected;
- lw->clear=1;
- }
- if (lw->selected >= lw->start + lw->rows) {
+ if (lw->selected >= lw->start + lw->rows)
lw->start = lw->selected - lw->rows + 1;
- lw->clear=1;
- }
}
for (i = 0; i < lw->rows; i++) {
label = callback(lw->start + i, &highlight, callback_data);
wmove(lw->w, i, 0);
- if( lw->clear && (!fill || !label) )
- wclrtoeol(lw->w);
if (label) {
int selected = lw->start + i == lw->selected;
- size_t len = my_strlen(label);
+ unsigned len = utf8_width(label);
- if( highlight )
+ if (highlight)
colors_use(lw->w, COLOR_LIST_BOLD);
else
colors_use(lw->w, COLOR_LIST);
- if( show_cursor && selected )
+ if (show_cursor && selected)
wattron(lw->w, A_REVERSE);
//waddnstr(lw->w, label, lw->cols);
waddstr(lw->w, label);
- if( fill && len<lw->cols )
+ if (fill && len < lw->cols)
whline(lw->w, ' ', lw->cols-len);
- if( selected )
+ if (selected)
wattroff(lw->w, A_REVERSE);
- }
- }
- lw->clear=0;
+ if (!fill && len < lw->cols)
+ wclrtoeol(lw->w);
+ } else
+ wclrtoeol(lw->w);
+ }
}
int
return 0;
}
- lw->repaint = 1;
return 1;
}
return 0;
}
- lw->repaint = lw->clear = 1;
return 1;
}