version 1.20, 2017/11/03 17:11:20 |
version 1.21, 2018/02/05 06:51:41 |
|
|
int preview; |
int preview; |
char *search; |
char *search; |
char *filter; |
char *filter; |
|
int no_matches; |
}; |
}; |
|
|
struct mode_tree_item { |
struct mode_tree_item { |
|
|
TAILQ_INIT(&mtd->children); |
TAILQ_INIT(&mtd->children); |
|
|
mtd->buildcb(mtd->modedata, mtd->sort_type, &tag, mtd->filter); |
mtd->buildcb(mtd->modedata, mtd->sort_type, &tag, mtd->filter); |
if (TAILQ_EMPTY(&mtd->children)) |
mtd->no_matches = TAILQ_EMPTY(&mtd->children); |
|
if (mtd->no_matches) |
mtd->buildcb(mtd->modedata, mtd->sort_type, &tag, NULL); |
mtd->buildcb(mtd->modedata, mtd->sort_type, &tag, NULL); |
|
|
mode_tree_free_items(&mtd->saved); |
mode_tree_free_items(&mtd->saved); |
|
|
u_int w, h, i, j, sy, box_x, box_y; |
u_int w, h, i, j, sy, box_x, box_y; |
char *text, *start, key[7]; |
char *text, *start, key[7]; |
const char *tag, *symbol; |
const char *tag, *symbol; |
size_t size; |
size_t size, n; |
int keylen; |
int keylen; |
|
|
if (mtd->line_size == 0) |
if (mtd->line_size == 0) |
|
|
screen_write_cursormove(&ctx, 0, h); |
screen_write_cursormove(&ctx, 0, h); |
screen_write_box(&ctx, w, sy - h); |
screen_write_box(&ctx, w, sy - h); |
|
|
xasprintf(&text, " %s (sort: %s) ", mti->name, |
xasprintf(&text, " %s (sort: %s)", mti->name, |
mtd->sort_list[mtd->sort_type]); |
mtd->sort_list[mtd->sort_type]); |
if (w - 2 >= strlen(text)) { |
if (w - 2 >= strlen(text)) { |
screen_write_cursormove(&ctx, 1, h); |
screen_write_cursormove(&ctx, 1, h); |
screen_write_puts(&ctx, &gc0, "%s", text); |
screen_write_puts(&ctx, &gc0, "%s", text); |
|
|
|
if (mtd->no_matches) |
|
n = (sizeof "no matches") - 1; |
|
else |
|
n = (sizeof "active") - 1; |
|
if (mtd->filter != NULL && w - 2 >= strlen(text) + 10 + n + 2) { |
|
screen_write_puts(&ctx, &gc0, " (filter: "); |
|
if (mtd->no_matches) |
|
screen_write_puts(&ctx, &gc, "no matches"); |
|
else |
|
screen_write_puts(&ctx, &gc0, "active"); |
|
screen_write_puts(&ctx, &gc0, ") "); |
|
} |
} |
} |
free(text); |
free(text); |
|
|