From 679552d6db9771ddbf29bd02eb8392b3f319d4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 21 Jul 2015 17:13:58 +0200 Subject: ui: further separate curses related user interface code By now ui-curses.[hc] are the only files dealing directly with curses related functions. Integration of a proper mainloop is still pending. --- view.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'view.c') diff --git a/view.c b/view.c index 78a54f4..eb858d9 100644 --- a/view.c +++ b/view.c @@ -167,7 +167,7 @@ static bool view_addch(View *view, Cell *cell) { int t = w == 0 ? SYNTAX_SYMBOL_TAB : SYNTAX_SYMBOL_TAB_FILL; strncpy(cell->data, view->symbols[t]->symbol, sizeof(cell->data)-1); if (view->symbols[t]->color) - cell->attr = view->symbols[t]->color->attr | (cell->attr & A_REVERSE); + cell->attr = view->symbols[t]->color->attr; view->line->cells[view->col] = *cell; view->line->len += cell->len; view->line->width += cell->width; @@ -215,7 +215,7 @@ static bool view_addch(View *view, Cell *cell) { if (cell->data[0] == ' ') { strncpy(cell->data, view->symbols[SYNTAX_SYMBOL_SPACE]->symbol, sizeof(cell->data)-1); if (view->symbols[SYNTAX_SYMBOL_SPACE]->color) - cell->attr = view->symbols[SYNTAX_SYMBOL_SPACE]->color->attr | (cell->attr & A_REVERSE); + cell->attr = view->symbols[SYNTAX_SYMBOL_SPACE]->color->attr; } @@ -304,7 +304,7 @@ static size_t view_cursor_update(View *view) { view_draw(view); /* clear active highlighting */ cursor->pos = pos_match; view_cursor_sync(view); - cursor->line->cells[cursor->col].attr |= A_REVERSE; + cursor->line->cells[cursor->col].selected = true; cursor->pos = pos; view_cursor_sync(view); view->ui->draw_text(view->ui, view->topline); @@ -374,7 +374,7 @@ void view_draw(View *view) { regmatch_t match[syntax ? LENGTH(syntax->rules) : 1][1], *matched = NULL; memset(match, 0, sizeof match); /* default and current curses attributes to use */ - int default_attrs = COLOR_PAIR(0) | A_NORMAL, attrs = default_attrs; + int default_attrs = 0, attrs = default_attrs; /* start from known multibyte state */ mbstate_t mbstate = { 0 }; @@ -468,7 +468,7 @@ void view_draw(View *view) { cell.attr = attrs; if (sel.start <= pos && pos < sel.end) - cell.attr |= A_REVERSE; + cell.selected = true; if (!view_addch(view, &cell)) break; -- cgit v1.2.3