Skip to content

Commit 06ba0f3

Browse files
proskiPavel Roskin
authored and
Pavel Roskin
committed
Fix vertical lines in Putty with UTF-8 graphics
Use the UTF-8 vertical line character in the UTF-8 mode. 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, use space as background in the UTF-8 mode, then output the vertical line character on every line. For the line number separator, imitate the graph drawing code. Use draw_graphic() in the DEFAULT mode only, draw_chars() otherwise. Closes #981
1 parent ca0809d commit 06ba0f3

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

src/display.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,30 @@ static void
187187
redraw_display_separator(bool clear)
188188
{
189189
if (display_sep) {
190-
chtype separator = opt_line_graphics ? ACS_VLINE : '|';
190+
chtype separator;
191+
192+
switch (opt_line_graphics) {
193+
case GRAPHIC_ASCII:
194+
separator = '|';
195+
break;
196+
case GRAPHIC_DEFAULT:
197+
separator = ACS_VLINE;
198+
break;
199+
case GRAPHIC_UTF_8:
200+
separator = ' ';
201+
break;
202+
}
191203

192204
if (clear)
193205
wclear(display_sep);
194206
wbkgd(display_sep, separator + get_line_attr(NULL, LINE_TITLE_BLUR));
207+
208+
if (opt_line_graphics == GRAPHIC_UTF_8) {
209+
int lineno = 0;
210+
211+
while (mvwaddstr(display_sep, lineno++, 0, "│") == OK);
212+
}
213+
195214
wnoutrefresh(display_sep);
196215
}
197216
}

src/draw.c

+10-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,15 @@ 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+
}
336344
}
337345

338346
bool

0 commit comments

Comments
 (0)