aboutsummaryrefslogtreecommitdiffstats
path: root/src/list_window.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-25 17:40:29 +0200
committerMax Kellermann <max@duempel.org>2008-09-25 17:40:29 +0200
commit9e27391e321912878f7cddaa92f2c8201c6e91de (patch)
treed4177ec184712f13cdf4d3276a03c981c073e225 /src/list_window.c
parent0fd4d0c99d31b69356c289d3bb1dcd791b898028 (diff)
downloadmpd-9e27391e321912878f7cddaa92f2c8201c6e91de.tar.gz
mpd-9e27391e321912878f7cddaa92f2c8201c6e91de.tar.xz
mpd-9e27391e321912878f7cddaa92f2c8201c6e91de.zip
list_window: removed property "clear"
Without clearing previous screen contents, there may be corruptions, make this mandatory and optimize screen clearing.
Diffstat (limited to 'src/list_window.c')
-rw-r--r--src/list_window.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/list_window.c b/src/list_window.c
index 5a4ccf36d..e69f6ac04 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -41,7 +41,6 @@ list_window_init(WINDOW *w, unsigned width, unsigned height)
lw->w = w;
lw->cols = width;
lw->rows = height;
- lw->clear = 1;
return lw;
}
@@ -60,7 +59,6 @@ list_window_reset(struct list_window *lw)
lw->selected = 0;
lw->xoffset = 0;
lw->start = 0;
- lw->clear = 1;
}
void
@@ -95,7 +93,7 @@ list_window_center(struct list_window *lw, unsigned rows, unsigned n)
lw->start = 0;
}
- lw->repaint = lw->clear = 1;
+ lw->repaint = 1;
}
void
@@ -172,15 +170,11 @@ list_window_paint(struct list_window *lw,
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++) {
@@ -189,8 +183,6 @@ list_window_paint(struct list_window *lw,
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;
@@ -211,10 +203,12 @@ list_window_paint(struct list_window *lw,
if (selected)
wattroff(lw->w, A_REVERSE);
- }
- }
- lw->clear=0;
+ if (!fill && len < lw->cols)
+ wclrtoeol(lw->w);
+ } else
+ wclrtoeol(lw->w);
+ }
}
int
@@ -359,7 +353,7 @@ list_window_scroll_cmd(struct list_window *lw, unsigned rows, command_t cmd)
return 0;
}
- lw->repaint = lw->clear = 1;
+ lw->repaint = 1;
return 1;
}