From 831735d7990dede6325b3034ffe35085b471a6ab Mon Sep 17 00:00:00 2001 From: cancel <cancel@cancel.fm> Date: Wed, 1 Jan 2020 17:49:41 +0900 Subject: [PATCH] Add fancy corner/side drawing for grid rulers --- tui_main.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/tui_main.c b/tui_main.c index 95ce430..086b2be 100644 --- a/tui_main.c +++ b/tui_main.c @@ -523,10 +523,32 @@ void draw_glyphs_grid(WINDOW* win, int draw_y, int draw_x, int draw_h, Mark m = m_row[ix]; chtype ch; if (g == '.') { - if (use_y_ruler && (ix + offset_x) % ruler_spacing_x == 0) - ch = '+'; - else - ch = bullet; + ch = bullet; + if (use_y_ruler && (ix + offset_x) % ruler_spacing_x == 0) { + bool top = iy + offset_y == 0; + bool bot = iy + offset_y + 1 == field_h; + bool left = ix + offset_x == 0; + bool right = ix + offset_x + 1 == field_w; + if (top && left) { + ch = ACS_ULCORNER; + } else if (top && right) { + ch = ACS_URCORNER; + } else if (bot && left) { + ch = ACS_LLCORNER; + } else if (bot && right) { + ch = ACS_LRCORNER; + } else if (top) { + ch = ACS_TTEE; + } else if (bot) { + ch = ACS_BTEE; + } else if (left) { + ch = ACS_LTEE; + } else if (right) { + ch = ACS_RTEE; + } else { + ch = '+'; + } + } } else { ch = (chtype)g; }