mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix hierbox line characters WRT item visibility
Hierarchical listboxes draw items with upper-left corner, lower-left corner, or horizontal border characters to indicate whether a given item is the first item in a listbox, the last, or any other, respectively. However, the wrong character can be drawn if there are invisible items: if an item is the first (or last) visible item but there is an invisible item before (or after) it, it will be drawn with a horizontal border character, not a corner. This patch fixes that problem using traverse_listbox_items_list in display_listbox_item to ignore invisible items when determining whether an item is either the first or the last among its siblings.
This commit is contained in:
parent
f1dee0d04f
commit
66e1baec77
@ -401,18 +401,26 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset)
|
||||
case BI_LEAF:
|
||||
case BI_SEPARATOR:
|
||||
{
|
||||
struct listbox_item *root = data->box->ops->get_root(item);
|
||||
const struct listbox_item *const prev;
|
||||
|
||||
if (root) {
|
||||
if (item == root->child.prev) {
|
||||
str[1] = BORDER_SDLCORNER;
|
||||
}
|
||||
prev = traverse_listbox_items_list(item, data->box,
|
||||
-1, 1, NULL, NULL);
|
||||
|
||||
if (item == prev) {
|
||||
/* There is no visible item before @item, so it
|
||||
* must be the first item in the listbox. */
|
||||
str[1] = BORDER_SULCORNER;
|
||||
} else {
|
||||
LIST_OF(struct listbox_item) *p = data->box->items;
|
||||
const struct listbox_item *const next;
|
||||
|
||||
if (p->next == item) {
|
||||
str[1] = BORDER_SULCORNER;
|
||||
} else if (p->prev == item) {
|
||||
next == traverse_listbox_items_list(item,
|
||||
data->box, 1, 1, NULL, NULL);
|
||||
|
||||
if (item == next
|
||||
|| item->depth != next->depth) {
|
||||
/* There is no visible item after @item
|
||||
* at the same depth, so it must be the
|
||||
* last in its folder. */
|
||||
str[1] = BORDER_SDLCORNER;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user