Browse Source

Change to show '+' when cursor over major grid separator

master
cancel 6 years ago
parent
commit
9c3b92e63a
  1. 23
      tui_main.c

23
tui_main.c

@ -161,16 +161,25 @@ void tui_cursor_move_relative(Tui_cursor* tc, Usz field_h, Usz field_w,
} }
void draw_tui_cursor(WINDOW* win, Glyph const* gbuffer, Usz field_h, void draw_tui_cursor(WINDOW* win, Glyph const* gbuffer, Usz field_h,
Usz field_w, Usz ruler_y, Usz ruler_x, Usz cursor_y, Usz field_w, Usz ruler_spacing_y, Usz ruler_spacing_x,
Usz cursor_x) { Usz cursor_y, Usz cursor_x) {
(void)gbuffer;
(void)ruler_y;
(void)ruler_x;
if (cursor_y >= field_h || cursor_x >= field_w) if (cursor_y >= field_h || cursor_x >= field_w)
return; return;
Glyph beneath = gbuffer[cursor_y * field_w + cursor_x]; Glyph beneath = gbuffer[cursor_y * field_w + cursor_x];
char displayed = beneath == '.' ? '@' : beneath; char displayed;
chtype ch = (chtype)(displayed | (A_reverse | A_bold | fg_bg(C_yellow, C_natural))); if (beneath == '.') {
if (ruler_spacing_y != 0 && ruler_spacing_x != 0 &&
(cursor_y % ruler_spacing_y) == 0 &&
(cursor_x % ruler_spacing_x) == 0) {
displayed = '+';
} else {
displayed = '@';
}
} else {
displayed = beneath;
}
chtype ch =
(chtype)(displayed | (A_reverse | A_bold | fg_bg(C_yellow, C_natural)));
wmove(win, (int)cursor_y, (int)cursor_x); wmove(win, (int)cursor_y, (int)cursor_x);
waddchnstr(win, &ch, 1); waddchnstr(win, &ch, 1);
} }

Loading…
Cancel
Save