From 449fe3dd3e9abcb741a46b0f85de127f65a80c86 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 12 Jan 2020 19:01:27 -0800 Subject: [PATCH] Fix vertical lines in Putty with UTF-8 graphics Putty doesn't show VT100 line drawing characters in the UTF-8 mode by default. Putty 0.70 and older doesn't even have that option. For the vertical display separator, output the vertical line character on every line. For the line number separator, use code similar to the graph drawing code. Use draw_graphic() in the DEFAULT mode only, draw_chars() otherwise. Closes #981 --- src/display.c | 9 ++++++++- src/draw.c | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/display.c b/src/display.c index a23d41a8c..5b9cea77c 100644 --- a/src/display.c +++ b/src/display.c @@ -187,11 +187,18 @@ static void redraw_display_separator(bool clear) { if (display_sep) { - chtype separator = opt_line_graphics ? ACS_VLINE : '|'; + chtype separator = (opt_line_graphics == GRAPHIC_DEFAULT) ? ACS_VLINE : '|'; if (clear) wclear(display_sep); wbkgd(display_sep, separator + get_line_attr(NULL, LINE_TITLE_BLUR)); + + if (opt_line_graphics == GRAPHIC_UTF_8) { + int lineno = 0; + + while (mvwaddstr(display_sep, lineno++, 0, "│") == OK); + } + wnoutrefresh(display_sep); } } diff --git a/src/draw.c b/src/draw.c index e5b651fed..01fb3dbe6 100644 --- a/src/draw.c +++ b/src/draw.c @@ -314,7 +314,7 @@ draw_lineno_custom(struct view *view, struct view_column *column, unsigned int l unsigned long digits3 = MIN(9,MAX(3,column->width)); int max = MIN(VIEW_MAX_LEN(view), digits3); char *text = NULL; - chtype separator = opt_line_graphics ? ACS_VLINE : '|'; + chtype separator = ACS_VLINE; struct line_number_options *opts = &column->opt.line_number; int interval = opts->interval > 0 ? opts->interval : 5; @@ -332,7 +332,17 @@ draw_lineno_custom(struct view *view, struct view_column *column, unsigned int l draw_chars(view, LINE_LINE_NUMBER, text, -1, max, true); else draw_space(view, LINE_LINE_NUMBER, max, digits3); - return draw_graphic(view, LINE_DEFAULT, &separator, 1, true); + + switch (opt_line_graphics) { + case GRAPHIC_ASCII: + return draw_chars(view, LINE_DEFAULT, "| ", -1, 2, false); + case GRAPHIC_DEFAULT: + return draw_graphic(view, LINE_DEFAULT, &separator, 1, true); + case GRAPHIC_UTF_8: + return draw_chars(view, LINE_DEFAULT, "│ ", -1, 2, false); + } + + return false; } bool