Display combining characters at the end of the current string in set_hline
without waiting for the next non zero width character. This way combining
characters at the end of the document are displayed.

Signed-off-by: Fabienne Ducroquet <fabi...@gmail.com>
---
 features.conf                |  2 --
 src/document/html/renderer.c | 51 ++++++++++++++++++++++++++++----------------
 2 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/features.conf b/features.conf
index 365b84d..20bb8ab 100644
--- a/features.conf
+++ b/features.conf
@@ -707,8 +707,6 @@ CONFIG_UTF8=yes
 #   HTML forms, HTML links, HTML document titles, plain text, menus,
 #   dialog boxes, or keymaps.
 #
-# - Combining characters at the end of the document do not take effect.
-#
 # Default: disabled
 
 CONFIG_COMBINE=yes
diff --git a/src/document/html/renderer.c b/src/document/html/renderer.c
index b7b358b..a55f62a 100644
--- a/src/document/html/renderer.c
+++ b/src/document/html/renderer.c
@@ -425,6 +425,35 @@ move_comb_x_y(struct part *part, int xf, int yf, int xt, 
int yt)
 # define move_comb_x_y(part, xf, yf, xt, yt) ((void) 0)
 #endif
 
+#ifdef CONFIG_COMBINE
+static void
+put_combined(struct part *part, int x)
+{
+       struct document *document = part->document;
+
+       if (document->combi_length) {
+               if (document->comb_x != -1) {
+                       unicode_val_T prev = get_combined(document->combi, 
document->combi_length + 1);
+
+                       assert_comb_x_y_ok(document);
+                       if_assert_failed prev = UCS_NO_CHAR;
+
+                       /* Make sure the combined character is not considered as
+                        * a space. */
+                       if (x)
+                               part->spaces[x - 1] = 0;
+
+                       if (prev != UCS_NO_CHAR)
+                               document->data[document->comb_y]
+                                       .chars[document->comb_x].data = prev;
+               }
+               document->combi_length = 0;
+       }
+}
+#else
+# define put_combined(part, x) ((void) 0)
+#endif
+
 #ifdef CONFIG_UTF8
 /* First possibly do the format change and then find out what coordinates
  * to use since sub- or superscript might change them */
@@ -564,24 +593,7 @@ good_char:
 
 #ifdef CONFIG_COMBINE
                                if (wcwidth((wchar_t)data)) {
-                                       if (document->combi_length) {
-                                               if (document->comb_x != -1) {
-                                                       unicode_val_T prev = 
get_combined(document->combi, document->combi_length + 1);
-
-                                                       
assert_comb_x_y_ok(document);
-                                                       if_assert_failed prev = 
UCS_NO_CHAR;
-
-                                                       /* Make sure the 
combined character is not considered as
-                                                        * a space. */
-                                                       if (x)
-                                                               part->spaces[x 
- 1] = 0;
-
-                                                       if (prev != UCS_NO_CHAR)
-                                                               
document->data[document->comb_y]
-                                                                       
.chars[document->comb_x].data = prev;
-                                               }
-                                               document->combi_length = 0;
-                                       }
+                                       put_combined(part, x);
                                        document->combi[0] = data;
                                } else {
                                        if (document->combi_length < 
(UCS_MAX_LENGTH_COMBINED - 1)) {
@@ -611,6 +623,9 @@ good_char:
 #endif
                                copy_screen_chars(&POS(x++, y), schar, 1);
                        } /* while chars < end */
+
+                       /* Display any trailing combining characters. */
+                       put_combined(part, x);
                } else { /* not UTF-8 */
                        for (; charslen > 0; charslen--, x++, chars++) {
                                part->char_width[x] = 1;
-- 
2.8.0.rc3

-- 
http://lists.linuxfromscratch.org/listinfo/elinks-dev
Unsubscribe: See the above information page

Reply via email to