From 5e31308da09eca0969c02ef1b01ab08785d64a71 Mon Sep 17 00:00:00 2001 From: Marco Migliori Date: Tue, 16 May 2017 18:37:29 +0200 Subject: [PATCH] text direction mark --- src/document/html/renderer.c | 4 +++- src/intl/charsets.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c index 813de8df..82965111 100644 --- a/src/document/html/renderer.c +++ b/src/document/html/renderer.c @@ -640,7 +640,9 @@ good_char: #endif /* CONFIG_COMBINE */ part->spaces[x] = (data == UCS_SPACE); - if (unicode_to_cell(data) == 2) { + if (unicode_to_cell(data) == 0) + continue; + else if (unicode_to_cell(data) == 2) { schar->data = (unicode_val_T)data; part->char_width[x] = 2; copy_screen_chars(&POS(x++, y), schar, 1); diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 1c364550..5b30c855 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -605,12 +605,13 @@ invalid_arg: * libc version of wcwidth, and instead use a hardcoded mapping. * * @return 2 for double-width glyph, 1 for others. - * TODO: May be extended to return 0 for zero-width glyphs - * (like composing, maybe unprintable too). + * 0 for unprintable glyphs (like 0x200e: "LEFT-TO-RIGHT MARK") */ NONSTATIC_INLINE int unicode_to_cell(unicode_val_T c) { + if (c == 0x200e || c == 0x200f) + return 0; if (c >= 0x1100 && (c <= 0x115f /* Hangul Jamo */ || c == 0x2329