ref: 9c3b92e63a835e77cd3fffbb5fbd5cfbcc0b7965
parent: 22c9cc85c773471cf13a86a8cff9eab8efab1de6
author: cancel <cancel@cancel.fm>
date: Sun Dec 2 12:23:33 EST 2018
Change to show '+' when cursor over major grid separator
--- a/tui_main.c
+++ b/tui_main.c
@@ -161,16 +161,25 @@
}
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 cursor_x) {
- (void)gbuffer;
- (void)ruler_y;
- (void)ruler_x;
+ Usz field_w, Usz ruler_spacing_y, Usz ruler_spacing_x,
+ Usz cursor_y, Usz cursor_x) {
if (cursor_y >= field_h || cursor_x >= field_w)
return;
Glyph beneath = gbuffer[cursor_y * field_w + cursor_x];
- char displayed = beneath == '.' ? '@' : beneath;
- chtype ch = (chtype)(displayed | (A_reverse | A_bold | fg_bg(C_yellow, C_natural)));
+ char displayed;
+ 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);
waddchnstr(win, &ch, 1);
}