aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-07-21 17:13:58 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-07-21 18:01:58 +0200
commit679552d6db9771ddbf29bd02eb8392b3f319d4cb (patch)
tree2af606eb8fe1423908366313cdd5fbcdc9c46f45 /view.c
parent38f00e3e8a50e1690dcb78cf1eca8b6befb7173b (diff)
downloadvis-679552d6db9771ddbf29bd02eb8392b3f319d4cb.tar.gz
vis-679552d6db9771ddbf29bd02eb8392b3f319d4cb.tar.xz
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.
Diffstat (limited to 'view.c')
-rw-r--r--view.c10
1 files changed, 5 insertions, 5 deletions
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;