Skip to content

Commit

Permalink
Fix vertical lines in Putty with UTF-8 graphics
Browse files Browse the repository at this point in the history
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
  • Loading branch information
proski authored and Pavel Roskin committed Jan 16, 2020
1 parent ca0809d commit 449fe3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 449fe3d

Please sign in to comment.