Previous versions of XTerm were unable to show combining characters
actually attached to doublewidth characters.  The attached patch
(against #144) should rectify this.

-- 
Robert
diff -X X -ruN xterm-144/button.c xterm-144-fixed/button.c
--- xterm-144/button.c  Fri Aug 18 11:01:41 2000
+++ xterm-144-fixed/button.c    Mon Sep  4 10:32:58 2000
@@ -1500,7 +1500,7 @@
 #if OPT_WIDE_CHARS
 int iswide(int i)
 {
-    return my_wcwidth(i) == 2;
+  return (i == HIDDEN_CHAR) || (my_wcwidth(i) == 2);
 }
 #endif
 
diff -X X -ruN xterm-144/charproc.c xterm-144-fixed/charproc.c
--- xterm-144/charproc.c        Wed Aug 23 23:27:39 2000
+++ xterm-144-fixed/charproc.c  Mon Sep  4 10:27:10 2000
@@ -2723,6 +2723,10 @@
                        need_wrap = 1;
                }
 
+               if (width_here == width_available) {
+                       need_wrap = 1;
+               }
+
                if (chars_chomped != (len - offset)) {
                        need_wrap = 1;
                }
@@ -2878,7 +2882,7 @@
                                CurCursorX(screen, screen->cur_row, screen->cur_col),
                                CursorY(screen, screen->cur_row),
                                curXtermChrSet(screen->cur_row),
-                               PAIRED_CHARS(str, str2), len);
+                               PAIRED_CHARS(str, str2), len, 0);
 
                        resetXtermGC(screen, flags, False);
 
@@ -5053,20 +5057,21 @@
                x = CurCursorX(screen, screen->cur_row, screen->cur_col),
                y = CursorY(screen, screen->cur_row),
                curXtermChrSet(screen->cur_row),
-               PAIRED_CHARS(&clo, &chi), 1);
+               PAIRED_CHARS(&clo, &chi), 1, 0);
 
 #if OPT_WIDE_CHARS
        if (c1l || c1h) {
+               int base = clo | (chi << 8);
                drawXtermText(screen, flags, currentGC,
                              x, y,
                              curXtermChrSet(screen->cur_row),
-                             PAIRED_CHARS(&c1l, &c1h), 1);
+                             PAIRED_CHARS(&c1l, &c1h), 1, iswide(base));
 
                if (c2l || c2h)
                        drawXtermText(screen, flags, currentGC,
                                      x, y,
                                      curXtermChrSet(screen->cur_row),
-                                     PAIRED_CHARS(&c2l, &c2h), 1);
+                                     PAIRED_CHARS(&c2l, &c2h), 1, iswide(base));
        }
 #endif
 
@@ -5159,20 +5164,21 @@
                x = CurCursorX(screen, screen->cursor_row, screen->cursor_col),
                y = CursorY(screen, screen->cursor_row),
                curXtermChrSet(screen->cursor_row),
-               PAIRED_CHARS(&clo, &chi), 1);
+               PAIRED_CHARS(&clo, &chi), 1, 0);
 
 #if OPT_WIDE_CHARS
        if (c1l || c1h) {
+               int base = clo | (chi << 8);
                drawXtermText (screen, flags, currentGC,
                                x, y,
                                curXtermChrSet(screen->cur_row),
-                               PAIRED_CHARS(&c1l, &c1h), 1);
+                               PAIRED_CHARS(&c1l, &c1h), 1, iswide(base));
 
                if (c2l || c2h)
                        drawXtermText (screen, flags, currentGC,
                                        x, y,
                                        curXtermChrSet(screen->cur_row),
-                                       PAIRED_CHARS(&c2l, &c2h), 1);
+                                       PAIRED_CHARS(&c2l, &c2h), 1, iswide(base));
        }
 #endif
        screen->cursor_state = OFF;
diff -X X -ruN xterm-144/screen.c xterm-144-fixed/screen.c
--- xterm-144/screen.c  Wed Aug 23 23:30:19 2000
+++ xterm-144-fixed/screen.c    Mon Sep  4 10:37:08 2000
@@ -986,7 +986,7 @@
                   x = drawXtermText(screen, flags, gc, x, y,
                        cs,
                        PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)),
-                       col - lastind);
+                       col - lastind, 0);
  
  if_OPT_WIDE_CHARS(screen, 
                   {
@@ -997,17 +997,20 @@
                        Char *comb2h = BUF_COM2H(screen->visbuf, row + topline);
                        for (i = lastind ; i < col; i++) {
                                int my_x = CurCursorX(screen, row + topline, i);
+                               int base = chars[i] | (widec[i] << 8);
                                int comb1 = comb1l[i] | (comb1h[i] << 8);
                                int comb2 = comb2l[i] | (comb2h[i] << 8);
- 
+
+                               if (iswide(base)) my_x = CurCursorX(screen, row + 
+topline, i-1);
+
                                if (comb1 != 0) {
                                        drawXtermText(screen, flags, gc, my_x, y, cs,
-                                                     PAIRED_CHARS(comb1l+i, 
comb1h+i), 1);
+                                                     PAIRED_CHARS(comb1l+i, 
+comb1h+i), 1, iswide(base));
                                }
  
                                if (comb2 != 0) {
                                        drawXtermText(screen, flags, gc, my_x, y, cs,
-                                                     PAIRED_CHARS(comb2l+i, 
comb2h+i), 1);
+                                                     PAIRED_CHARS(comb2l+i, 
+comb2h+i), 1, iswide(base));
                                }
                        }
                   })
@@ -1056,7 +1059,7 @@
           drawXtermText(screen, flags, gc, x, y,
                cs,
                PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)),
-               col - lastind);
+               col - lastind, 0);
 
 if_OPT_WIDE_CHARS(screen,         {
                        int i;
@@ -1066,17 +1069,20 @@
                        Char *comb2h = BUF_COM2H(screen->visbuf, row + topline);
                        for (i = lastind ; i < col; i++) {
                                int my_x = CurCursorX(screen, row + topline, i);
+                               int base = chars[i] | (widec[i] << 8);
                                int comb1 = comb1l[i] | (comb1h[i] << 8);
                                int comb2 = comb2l[i] | (comb2h[i] << 8);
 
+                               if (iswide(base)) my_x = CurCursorX(screen, row + 
+topline, i-1);
+
                                if (comb1 != 0) {
                                        drawXtermText(screen, flags, gc, my_x, y, cs,
-                                                     PAIRED_CHARS(comb1l+i, 
comb1h+i), 1);
+                                                     PAIRED_CHARS(comb1l+i, 
+comb1h+i), 1, iswide(base));
                                }
 
                                if (comb2 != 0) {
                                        drawXtermText(screen, flags, gc, my_x, y, cs,
-                                                     PAIRED_CHARS(comb2l+i, 
comb2h+i), 1);
+                                                     PAIRED_CHARS(comb2l+i, 
+comb2h+i), 1, iswide(base));
                                }
                        }
           })
diff -X X -ruN xterm-144/util.c xterm-144-fixed/util.c
--- xterm-144/util.c    Mon Aug 14 01:27:41 2000
+++ xterm-144-fixed/util.c      Mon Sep  4 10:37:32 2000
@@ -1383,7 +1383,8 @@
        int y,
        int chrset,
        PAIRED_CHARS(Char *text, Char *text2),
-       Cardinal len)
+       Cardinal len,
+       int on_wide)
 {
        int real_length = len;
 #if OPT_WIDE_CHARS
@@ -1479,14 +1480,14 @@
                                        x = drawXtermText(screen, flags, gc2,
                                                x, y, 0,
                                                PAIRED_CHARS(text++, text2++),
-                                               1);
+                                               1, on_wide);
                                        x += FontWidth(screen);
                                }
                        } else {
                                x = drawXtermText(screen, flags, gc2,
                                        x, y, 0,
                                        PAIRED_CHARS(text, text2),
-                                       len);
+                                       len, on_wide);
                                x += len * FontWidth(screen);
                        }
 
@@ -1511,7 +1512,7 @@
                                temp[n++] = *text++;
                                temp[n++] = ' ';
                        }
-                       x = drawXtermText(screen, flags, gc, x, y, 0, 
PAIRED_CHARS(temp, wide), n);
+                       x = drawXtermText(screen, flags, gc, x, y, 0, 
+PAIRED_CHARS(temp, wide), n, on_wide);
                        free(temp);
                        if_OPT_WIDE_CHARS(screen,{
                                free(wide);
@@ -1558,7 +1559,7 @@
                        adj = (FontWidth(screen) - width) / 2;
                        (void)drawXtermText(screen, flags, gc, x + adj, y,
                                            chrset,
-                                           PAIRED_CHARS(text++, text2++), 1);
+                                           PAIRED_CHARS(text++, text2++), 1, 
+on_wide);
                        x += FontWidth(screen);
                }
                screen->fnt_prop = True;
@@ -1580,7 +1581,7 @@
                        static Cardinal slen;
                        Cardinal n;
                        int ch = text[0] | (text2[0] << 8);
-                       int wideness = (iswide(ch)!=0) && (screen->fnt_dwd!=NULL);
+                       int wideness = (on_wide || iswide(ch)!=0) && 
+(screen->fnt_dwd!=NULL);
                        unsigned char *endtext = text + len;
                        if (slen < len) {
                                slen = (len + 1) * 2;
@@ -1669,7 +1670,7 @@
                }
 #if OPT_BOX_CHARS
 #define DrawX(col) x + (col * (screen->fnt_wide))
-#define DrawSegment(first,last) (void)drawXtermText(screen, flags, gc, DrawX(first), 
y, chrset, PAIRED_CHARS(text+first, text2+first), last-first)
+#define DrawSegment(first,last) (void)drawXtermText(screen, flags, gc, DrawX(first), 
+y, chrset, PAIRED_CHARS(text+first, text2+first), last-first, on_wide)
        } else {        /* fill in missing box-characters */
                XFontStruct *font = (flags & BOLD)
                                  ? screen->fnt_bold
@@ -1684,7 +1685,7 @@
                        if (text2 != 0)
                                ch |= (text2[last] << 8);
                        isMissing = xtermMissingChar(ch,
-                                       (iswide(ch) && screen->fnt_dwd)
+                                       ((on_wide || iswide(ch)) && screen->fnt_dwd)
                                        ? screen->fnt_dwd
                                        : font);
 #else
diff -X X -ruN xterm-144/xterm.h xterm-144-fixed/xterm.h
--- xterm-144/xterm.h   Tue Aug 15 02:27:00 2000
+++ xterm-144-fixed/xterm.h     Mon Sep  4 10:15:47 2000
@@ -707,7 +707,7 @@
 extern int AddToRefresh (TScreen *screen);
 extern int HandleExposure (TScreen *screen, XEvent *event);
 extern int char2lower(int ch);
-extern int drawXtermText (TScreen *screen, unsigned flags, GC gc, int x, int y, int 
chrset, PAIRED_CHARS(Char *text, Char *text2), Cardinal len);
+extern int drawXtermText (TScreen *screen, unsigned flags, GC gc, int x, int y, int 
+chrset, PAIRED_CHARS(Char *text, Char *text2), Cardinal len, int on_wide);
 extern void ChangeAnsiColors (XtermWidget tw);
 extern void ChangeColors (XtermWidget tw, ScrnColors *pNew);
 extern void ClearRight (TScreen *screen, int n);

Reply via email to