Browse Source

Fix '+' not highlighted red in tui

master
cancel 6 years ago
parent
commit
09d8618cf9
  1. 9
      tui_main.c

9
tui_main.c

@ -65,7 +65,7 @@ typedef enum {
} Glyph_class; } Glyph_class;
static Glyph_class glyph_class_of(Glyph glyph) { static Glyph_class glyph_class_of(Glyph glyph) {
if (glyph == '.' || glyph == '+') if (glyph == '.')
return Glyph_class_grid; return Glyph_class_grid;
if (glyph >= '0' && glyph <= '9') if (glyph >= '0' && glyph <= '9')
return Glyph_class_numeric; return Glyph_class_numeric;
@ -93,7 +93,7 @@ static Glyph_class glyph_class_of(Glyph glyph) {
return Glyph_class_unknown; return Glyph_class_unknown;
} }
static chtype chtype_of_cell(Glyph g, Mark m) { static int term_attrs_of_cell(Glyph g, Mark m) {
Glyph_class gclass = glyph_class_of(g); Glyph_class gclass = glyph_class_of(g);
int attr = A_normal; int attr = A_normal;
switch (gclass) { switch (gclass) {
@ -132,7 +132,7 @@ static chtype chtype_of_cell(Glyph g, Mark m) {
if (m & Mark_flag_haste_input) { if (m & Mark_flag_haste_input) {
attr = A_bold | fg_bg(C_cyan, C_natural); attr = A_bold | fg_bg(C_cyan, C_natural);
} }
return (chtype)((int)g | attr); return attr;
} }
typedef struct { typedef struct {
@ -313,11 +313,12 @@ void draw_field(WINDOW* win, int term_h, int term_w, int pos_y, int pos_x,
for (Usz x = 0; x < num_x; ++x) { for (Usz x = 0; x < num_x; ++x) {
Glyph g = gline[x]; Glyph g = gline[x];
Mark m = mline[x]; Mark m = mline[x];
int attrs = term_attrs_of_cell(g, m);
if (g == '.') { if (g == '.') {
if (use_y_ruler && x % ruler_spacing_x == 0) if (use_y_ruler && x % ruler_spacing_x == 0)
g = '+'; g = '+';
} }
buffer[x] = chtype_of_cell(g, m); buffer[x] = (chtype)((int)g | attrs);
} }
wmove(win, pos_y + (int)y, pos_x); wmove(win, pos_y + (int)y, pos_x);
waddchnstr(win, buffer, (int)num_x); waddchnstr(win, buffer, (int)num_x);

Loading…
Cancel
Save