diff options
author | Andrés <andmarti@gmail.com> | 2021-03-14 09:20:37 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-03-14 09:20:37 -0300 |
commit | e2ab6de106528c1674686e0081a541df99afc574 (patch) | |
tree | f35172d2bc9c8a27728c31911fe5b12b9c233f54 /src/tui.c | |
parent | c4372c31ce07f6fce8b41486f6b8ba2956965a96 (diff) |
added new underline_grid config value to show a nicer grid
Diffstat (limited to 'src/tui.c')
-rw-r--r-- | src/tui.c | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -845,9 +845,10 @@ void ui_show_content(WINDOW * win, int mxrow, int mxcol) { // Clean format #ifdef USECOLORS + if ((*p) && (*p)->cellerror) { // cellerror ui_set_ucolor(win, &ucolors[CELL_ERROR], ucolors[CELL_ERROR].bg != DEFAULT_COLOR ? DEFAULT_COLOR : col % 2 == 0 ? ucolors[GRID_PAIR].bg : ucolors[GRID_ODD].bg); - } else if ((*p) && (*p)->v < 0) { // cell negative + } else if ((*p) && (*p)->v < 0) { // cell negative ui_set_ucolor(win, &ucolors[CELL_NEGATIVE], ucolors[CELL_NEGATIVE].bg != DEFAULT_COLOR ? DEFAULT_COLOR : col % 2 == 0 ? ucolors[GRID_PAIR].bg : ucolors[GRID_ODD].bg); } else if ((*p) && (*p)->expr) { ui_set_ucolor(win, &ucolors[EXPRESSION], ucolors[EXPRESSION].bg != DEFAULT_COLOR ? DEFAULT_COLOR : col % 2 == 0 ? ucolors[GRID_PAIR].bg : ucolors[GRID_ODD].bg); @@ -948,7 +949,6 @@ void ui_show_content(WINDOW * win, int mxrow, int mxcol) { } - // repaint a blank cell, because of in range, or because we have a coloured empty cell! if ( !(*p) || (( !((*p)->flags & is_valid) && !(*p)->label ) && !((*p)->cellerror == CELLERROR)) ) { if ( (currow == row && curcol == col) || @@ -966,6 +966,15 @@ void ui_show_content(WINDOW * win, int mxrow, int mxcol) { #endif } + #ifdef USECOLORS + if (has_colors() && atoi(get_conf_value("underline_grid"))) { + attr_t attr; + short color; + wattr_get(win, &attr, &color, NULL); + wattr_set(win, attr | A_UNDERLINE, color, NULL); + } + #endif + // new implementation for wide char support cchar_t cht[fieldlen]; wchar_t w; @@ -979,19 +988,28 @@ void ui_show_content(WINDOW * win, int mxrow, int mxcol) { i+= wcwidth(w); } - // we print text and number + // we print text and number } else { pad_and_align(text, num, fwidth[col], align, (*p)->pad, out); if (col == mxcol && wcswidth(out, wcslen(out)) > fwidth[col]) out[ count_width_widestring(out, fwidth[col]) ] = L'\0'; + #ifdef USECOLORS + if (has_colors() && atoi(get_conf_value("underline_grid"))) { + attr_t attr; + short color; + wattr_get(win, &attr, &color, NULL); + wattr_set(win, attr | A_UNDERLINE, color, NULL); + } + #endif + mvwprintw(win, row + 1 - offscr_sc_rows - q_row_hidden, c, "%ls", out); wclrtoeol(win); } // clean format #ifndef USECOLORS - wattroff(win, A_REVERSE); + wattroff(win, A_REVERSE); #endif } } |