Skip to content

Commit

Permalink
Fix alignment of transliterated text
Browse files Browse the repository at this point in the history
Compute length after transliteration.

Fixes #1195
  • Loading branch information
koutcher committed Jun 8, 2022
1 parent f52f003 commit 508da92
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ draw_chars(struct view *view, enum line_type type, const char *string, int lengt
if (max_width <= 0)
return VIEW_MAX_LEN(view) <= 0;

len = utf8_length(&string, length, skip, &col, max_width, &trimmed, use_tilde, opt_tab_size);
if (length == -1)
length = strlen(string);

if (opt_iconv_out != ICONV_NONE) {
string = encoding_iconv(opt_iconv_out, string, len);
string = encoding_iconv(opt_iconv_out, string, length);
if (!string)
return VIEW_MAX_LEN(view) <= 0;
}

len = utf8_length(&string, length, skip, &col, max_width, &trimmed, use_tilde, opt_tab_size);

set_view_attr(view, type);
if (len > 0)
waddnstr(view->win, string, len);
Expand Down

0 comments on commit 508da92

Please sign in to comment.