Skip to content

Commit 449fe3d

Browse files
proskiPavel Roskin
authored and
Pavel Roskin
committed
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
1 parent ca0809d commit 449fe3d

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/display.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,18 @@ static void
187187
redraw_display_separator(bool clear)
188188
{
189189
if (display_sep) {
190-
chtype separator = opt_line_graphics ? ACS_VLINE : '|';
190+
chtype separator = (opt_line_graphics == GRAPHIC_DEFAULT) ? ACS_VLINE : '|';
191191

192192
if (clear)
193193
wclear(display_sep);
194194
wbkgd(display_sep, separator + get_line_attr(NULL, LINE_TITLE_BLUR));
195+
196+
if (opt_line_graphics == GRAPHIC_UTF_8) {
197+
int lineno = 0;
198+
199+
while (mvwaddstr(display_sep, lineno++, 0, "│") == OK);
200+
}
201+
195202
wnoutrefresh(display_sep);
196203
}
197204
}

src/draw.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ draw_lineno_custom(struct view *view, struct view_column *column, unsigned int l
314314
unsigned long digits3 = MIN(9,MAX(3,column->width));
315315
int max = MIN(VIEW_MAX_LEN(view), digits3);
316316
char *text = NULL;
317-
chtype separator = opt_line_graphics ? ACS_VLINE : '|';
317+
chtype separator = ACS_VLINE;
318318
struct line_number_options *opts = &column->opt.line_number;
319319
int interval = opts->interval > 0 ? opts->interval : 5;
320320

@@ -332,7 +332,17 @@ draw_lineno_custom(struct view *view, struct view_column *column, unsigned int l
332332
draw_chars(view, LINE_LINE_NUMBER, text, -1, max, true);
333333
else
334334
draw_space(view, LINE_LINE_NUMBER, max, digits3);
335-
return draw_graphic(view, LINE_DEFAULT, &separator, 1, true);
335+
336+
switch (opt_line_graphics) {
337+
case GRAPHIC_ASCII:
338+
return draw_chars(view, LINE_DEFAULT, "| ", -1, 2, false);
339+
case GRAPHIC_DEFAULT:
340+
return draw_graphic(view, LINE_DEFAULT, &separator, 1, true);
341+
case GRAPHIC_UTF_8:
342+
return draw_chars(view, LINE_DEFAULT, "│ ", -1, 2, false);
343+
}
344+
345+
return false;
336346
}
337347

338348
bool

0 commit comments

Comments
 (0)