summaryrefslogtreecommitdiff
path: root/src/fruits/cmsrv
diff options
context:
space:
mode:
Diffstat (limited to 'src/fruits/cmsrv')
-rw-r--r--src/fruits/cmsrv/ui.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/fruits/cmsrv/ui.c b/src/fruits/cmsrv/ui.c
index e5d0798..4f1ece4 100644
--- a/src/fruits/cmsrv/ui.c
+++ b/src/fruits/cmsrv/ui.c
@@ -83,9 +83,11 @@ static void render_log(struct cmsrv_ui *ui)
u32 size = ui->log.messages.count;
u32 index = (size > max_height) ? size - max_height : 0;
for (u32 i = index; i < size; i++) {
+ u32 x = 1;
+ u32 y = (i - index) + 1;
// We can't use putnstr here to control the width because lots of
// these messages will have wide characters.
- ncplane_putstr_yx(n, (i - index) + 1, 1, al_array_at(ui->log.messages, i));
+ ncplane_putstr_yx(n, y, x, al_array_at(ui->log.messages, i));
}
for (u32 i = 0; i < index; i++) {
al_free(al_array_at(ui->log.messages, i));
@@ -113,10 +115,7 @@ static void layout_lists(struct cmsrv_ui *ui, struct ncplane *parent)
static void erase_lists(struct cmsrv_ui *ui)
{
struct ncplane *n = ui->lists.n;
- if (n) {
- ncplane_erase(n);
- //notcurses_render(ui->nc);
- }
+ if (n) ncplane_erase(n);
}
static void putnwstr_maxwidth_yx(struct ncplane *n, u32 y, u32 x, u32 maxwidth, wstr *w)
@@ -147,13 +146,13 @@ static void render_lists(struct cmsrv_ui *ui)
s32 size = (s32)list->entries.count;
s32 end = MIN(index + entries_per_list, size);
for (s32 j = index; j < end; j++) {
- struct lia_list_entry *entry = al_array_at(list->entries, j);
- u32 y = i + (j - index) + 1;
u32 x = 1;
+ u32 y = i + (j - index) + 1;
if (j == list->current) {
ncplane_putchar_yx(n, y, 1, '>');
x += 2;
}
+ struct lia_list_entry *entry = al_array_at(list->entries, j);
#ifdef CAMU_HAVE_PORTAL
struct camu_resource *resource = (struct camu_resource *)entry->opaque;
if (resource->type == CAMU_RESOURCE_PORTAL) {
@@ -215,6 +214,7 @@ void cmsrv_ui_render(struct cmsrv_ui *ui)
erase_log(ui);
erase_lists(ui);
erase_nodes(ui);
+ // If erasing is broken first assume it could be a screen bug.
if (ui->pending_layout) {
layout_log(ui, stdplane);
layout_lists(ui, stdplane);