MANIFEST       |    2 
 XTerm.ad       |    3 -
 button.c       |   16 ++++--
 charproc.c     |   38 +++++++++++++++
 fontutils.c    |  137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 linedata.c     |    3 -
 main.h         |    4 -
 menu.c         |   37 ++++++++++++++-
 menu.h         |    6 ++
 ptyx.h         |    6 +-
 screen.c       |   33 ++++++++-----
 scrollbar.c    |    5 +-
 trace.c        |    4 -
 util.c         |   90 +++++++++++++++++++++++--------------
 version.h      |    4 -
 xterm.h        |   10 +++-
 xterm.log.html |   53 +++++++++++++++++++++-
 xterm.man      |   32 ++++++++++++-
 18 files changed, 407 insertions(+), 76 deletions(-)

New commits:
commit 2ddbf56f023b3133b4b3a6274273747be0fce979
Author: Julien Cristau <[email protected]>
Date:   Sun Oct 4 15:29:38 2009 +0200

    Import xterm 249

diff --git a/MANIFEST b/MANIFEST
index 603e76f..83163f5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-247, version xterm-247
+MANIFEST for xterm-249, version xterm-249
 
--------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/XTerm.ad b/XTerm.ad
index f186e66..5670bdb 100644
--- a/XTerm.ad
+++ b/XTerm.ad
@@ -1,4 +1,4 @@
-! $XTermId: XTerm.ad,v 1.89 2009/08/15 15:58:44 tom Exp $
+! $XTermId: XTerm.ad,v 1.90 2009/09/27 22:02:30 tom Exp $
 
 *saveLines: 1024
 
@@ -88,6 +88,7 @@
 *fontMenu*font-linedrawing*Label: Line-Drawing Characters
 *fontMenu*font-doublesize*Label: Doublesized Characters
 *fontMenu*font-loadable*Label: VT220 Soft Fonts
+*fontMenu*font-packed*Label:   Packed Font
 *fontMenu*render-font*Label:   TrueType Fonts
 *fontMenu*utf8-mode*Label:     UTF-8
 *fontMenu*utf8-title*Label:    UTF-8 Titles
diff --git a/button.c b/button.c
index 41019b0..877b209 100644
--- a/button.c
+++ b/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.352 2009/09/11 09:13:53 tom Exp $ */
+/* $XTermId: button.c,v 1.355 2009/10/01 09:06:20 tom Exp $ */
 
 /*
  * Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -2427,7 +2427,7 @@ ResizeSelection(TScreen * screen GCC_UNUSED, int rows, 
int cols)
 Bool
 iswide(int i)
 {
-    return (i == HIDDEN_CHAR) || ((i >= FIRST_WIDECHAR) && my_wcwidth(i) == 2);
+    return (i == HIDDEN_CHAR) || (WideCells(i) == 2);
 }
 
 #define isWideCell(row, col) iswide((int)XTERM_CELL(row, col))
@@ -2624,12 +2624,16 @@ okPosition(TScreen * screen,
           LineData ** ld,
           CELL * cell)
 {
-    if (cell->col > (LastTextCol(screen, *ld, cell->row) + 1)) {
+    Boolean result = True;
+
+    if (cell->row >= screen->max_row) {
+       result = False;
+    } else if (cell->col > (LastTextCol(screen, *ld, cell->row) + 1)) {
        cell->col = 0;
        *ld = GET_LINEDATA(screen, ++cell->row);
-       return False;
+       result = False;
     }
-    return True;
+    return result;
 }
 
 static void
@@ -2637,7 +2641,7 @@ trimLastLine(TScreen * screen,
             LineData ** ld,
             CELL * last)
 {
-    if (screen->cutNewline) {
+    if (screen->cutNewline && last->row < screen->max_row) {
        last->col = 0;
        *ld = GET_LINEDATA(screen, ++last->row);
     } else {
diff --git a/charproc.c b/charproc.c
index 79b973f..6e7b7b6 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.972 2009/09/10 09:03:49 tom Exp $ */
+/* $XTermId: charproc.c,v 1.974 2009/09/27 22:37:54 tom Exp $ */
 
 /*
 
@@ -328,6 +328,7 @@ static XtActionsRec actionsList[] = {
 #endif
 #if OPT_BOX_CHARS
     { "set-font-linedrawing",  HandleFontBoxChars },
+    { "set-font-packed",       HandleFontPacked },
 #endif
 #if OPT_DABBREV
     { "dabbrev-expand",                HandleDabbrevExpand },
@@ -532,6 +533,7 @@ static XtResource resources[] =
 
 #if OPT_BOX_CHARS
     Bres(XtNforceBoxChars, XtCForceBoxChars, screen.force_box_chars, False),
+    Bres(XtNforcePackedFont, XtCForcePackedFont, screen.force_packed, True),
     Bres(XtNshowMissingGlyphs, XtCShowMissingGlyphs, screen.force_all_chars, 
False),
 #endif
 
@@ -5497,6 +5499,7 @@ VTInitialize(Widget wrequest,
 
 #if OPT_BOX_CHARS
     init_Bres(screen.force_box_chars);
+    init_Bres(screen.force_packed);
     init_Bres(screen.force_all_chars);
 #endif
     init_Bres(screen.free_bold_box);
@@ -7389,6 +7392,39 @@ HandleBlinking(XtPointer closure, XtIntervalId * id 
GCC_UNUSED)
 }
 #endif /* OPT_BLINK_CURS || OPT_BLINK_TEXT */
 
+void
+RestartBlinking(TScreen * screen GCC_UNUSED)
+{
+#if OPT_BLINK_CURS || OPT_BLINK_TEXT
+    if (screen->blink_timer == 0) {
+       Bool resume = False;
+
+#if OPT_BLINK_CURS
+       if (DoStartBlinking(screen)) {
+           resume = True;
+       }
+#endif
+#if OPT_BLINK_TEXT
+       if (!resume) {
+           int row;
+
+           for (row = screen->max_row; row >= 0; row--) {
+               LineData *ld = getLineData(screen, ROW2INX(screen, row));
+               if (LineTstBlinked(ld)) {
+                   if (LineHasBlinking(screen, ld)) {
+                       resume = True;
+                       break;
+                   }
+               }
+           }
+       }
+#endif
+       if (resume)
+           StartBlinking(screen);
+    }
+#endif
+}
+
 /*
  * Implement soft or hard (full) reset of the VTxxx emulation.  There are a
  * couple of differences from real DEC VTxxx terminals (to avoid breaking
diff --git a/fontutils.c b/fontutils.c
index 9eb94a2..904b56c 100644
--- a/fontutils.c
+++ b/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.307 2009/08/07 23:22:32 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.314 2009/09/30 09:37:45 tom Exp $ */
 
 /************************************************************
 
@@ -158,6 +158,37 @@ compatibleWideCounts(XFontStruct * wfs, XFontStruct * wbfs)
 }
 #endif /* OPT_WIDE_CHARS */
 
+#if OPT_BOX_CHARS
+static void
+setupPackedFonts(XtermWidget xw)
+{
+    TScreen *screen = TScreenOf(xw);
+    Bool value = False;
+
+#if OPT_RENDERFONT
+#define MIXED(name) screen->name[fontnum].map.mixed
+    if (xw->misc.render_font) {
+       int fontnum = screen->menu_font_number;
+
+       screen->allow_packing = (Boolean) (MIXED(renderFontNorm)
+                                          || MIXED(renderFontBold)
+                                          || MIXED(renderFontItal)
+#if OPT_RENDERWIDE
+                                          || MIXED(renderWideNorm)
+                                          || MIXED(renderWideBold)
+                                          || MIXED(renderWideItal)
+#endif
+           );
+#undef MIXED
+    }
+#endif /* OPT_RENDERFONT */
+
+    value = screen->allow_packing;
+
+    SetItemSensitivity(fontMenuEntries[fontMenu_font_packedfont].widget, 
value);
+}
+#endif
+
 /*
  * Returns the fields from start to stop in a dash- separated string.  This
  * function will modify the source, putting '\0's in the appropiate place and
@@ -1090,7 +1121,11 @@ xtermLoadFont(XtermWidget xw,
        }
     });
 
-    screen->fnt_prop = proportional;
+#if OPT_BOX_CHARS
+    screen->allow_packing = proportional;
+    setupPackedFonts(xw);
+#endif
+    screen->fnt_prop = (Boolean) (proportional && !(screen->force_packed));
     screen->fnt_boxes = True;
 
 #if OPT_BOX_CHARS
@@ -1438,6 +1473,87 @@ xtermSetCursorBox(TScreen * screen)
 
 #if OPT_RENDERFONT
 
+#if OPT_TRACE > 1
+static FcChar32
+xtermXftFirstChar(XftFont * xft)
+{
+    FcChar32 map[FC_CHARSET_MAP_SIZE];
+    FcChar32 next;
+    FcChar32 first;
+    int i;
+
+    first = FcCharSetFirstPage(xft->charset, map, &next);
+    for (i = 0; i < FC_CHARSET_MAP_SIZE; i++)
+       if (map[i]) {
+           FcChar32 bits = map[i];
+           first += i * 32;
+           while (!(bits & 0x1)) {
+               bits >>= 1;
+               first++;
+           }
+           break;
+       }
+    return first;
+}
+
+static FcChar32
+xtermXftLastChar(XftFont * xft)
+{
+    FcChar32 this, last, next;
+    FcChar32 map[FC_CHARSET_MAP_SIZE];
+    int i;
+    last = FcCharSetFirstPage(xft->charset, map, &next);
+    while ((this = FcCharSetNextPage(xft->charset, map, &next)) != 
FC_CHARSET_DONE)
+       last = this;
+    last &= ~0xff;
+    for (i = FC_CHARSET_MAP_SIZE - 1; i >= 0; i--)
+       if (map[i]) {
+           FcChar32 bits = map[i];
+           last += i * 32 + 31;
+           while (!(bits & 0x80000000)) {
+               last--;
+               bits <<= 1;
+           }
+           break;
+       }
+    return (long) last;
+}
+
+static void
+dumpXft(XtermWidget xw, XTermXftFonts * data)
+{
+    XftFont *xft = data->font;
+    TScreen *screen = TScreenOf(xw);
+    VTwin *win = WhichVWin(screen);
+
+    FcChar32 c;
+    FcChar32 first = xtermXftFirstChar(xft);
+    FcChar32 last = xtermXftLastChar(xft);
+    unsigned count = 0;
+    unsigned outside = 0;
+
+    TRACE(("dumpXft {{\n"));
+    TRACE(("   data range %#6x..%#6x\n", first, last));
+    for (c = first; c <= last; ++c) {
+       if (FcCharSetHasChar(xft->charset, c)) {
+           int width = my_wcwidth((int) c);
+           XGlyphInfo extents;
+
+           XftTextExtents32(XtDisplay(xw), xft, &c, 1, &extents);
+           TRACE(("%#6x  %2d  %.1f\n", c, width,
+                  ((double) extents.width) / win->f_width));
+           if (extents.width > win->f_width)
+               ++outside;
+           ++count;
+       }
+    }
+    TRACE(("}} %u total, %u outside\n", count, outside));
+}
+#define DUMP_XFT(xw, data) dumpXft(xw, data)
+#else
+#define DUMP_XFT(xw, data)     /* nothing */
+#endif
+
 static void
 checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * xft)
 {
@@ -1449,6 +1565,8 @@ checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * 
xft)
     data->map.max_width = (Dimension) xft->max_advance_width;
 
     for (c = 32; c < 256; ++c) {
+       if (c >= 128 && c < 159)
+           continue;
        if (FcCharSetHasChar(xft->charset, c)) {
            XGlyphInfo extents;
 
@@ -1805,6 +1923,19 @@ xtermComputeFontInfo(XtermWidget xw,
            setRenderFontsize(screen, win, norm, NULL);
            setRenderFontsize(screen, win, bold, "bold");
            setRenderFontsize(screen, win, ital, "ital");
+#if OPT_BOX_CHARS
+           setupPackedFonts(xw);
+
+           if (screen->force_packed) {
+               XTermXftFonts *use = &(screen->renderFontNorm[fontnum]);
+               win->f_height = use->font->ascent + use->font->descent;
+               win->f_width = use->map.min_width;
+               TRACE(("...packed TrueType font %dx%d\n",
+                      win->f_height,
+                      win->f_width));
+           }
+#endif
+           DUMP_XFT(xw, &(screen->renderFontNorm[fontnum]));
        }
     }
     /*
@@ -1813,7 +1944,7 @@ xtermComputeFontInfo(XtermWidget xw,
     if (!xw->misc.render_font || IsIconWin(screen, win))
 #endif /* OPT_RENDERFONT */
     {
-       if (is_double_width_font(font)) {
+       if (is_double_width_font(font) && !(screen->fnt_prop)) {
            win->f_width = (font->min_bounds.width);
        } else {
            win->f_width = (font->max_bounds.width);
diff --git a/linedata.c b/linedata.c
index 9896a44..e097b40 100644
--- a/linedata.c
+++ b/linedata.c
@@ -1,4 +1,4 @@
-/* $XTermId: linedata.c,v 1.71 2009/08/09 00:34:16 tom Exp $ */
+/* $XTermId: linedata.c,v 1.72 2009/09/28 23:58:59 tom Exp $ */
 
 /************************************************************
 
@@ -61,6 +61,7 @@ getLineData(TScreen * screen, int row)
 #endif
     }
     if (row >= 0) {
+       assert(row <= screen->max_row);
        result = (LineData *) scrnHeadAddr(screen, buffer, (unsigned) row);
        if (result != 0) {
 #if 1                          /* FIXME - these should be done in 
setupLineData, etc. */
diff --git a/main.h b/main.h
index 8b0fe3a..8e18d4c 100644
--- a/main.h
+++ b/main.h
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.42 2009/03/28 17:39:51 tom Exp $ */
+/* $XTermId: main.h,v 1.43 2009/10/02 00:02:26 tom Exp $ */
 
 /*
  * Copyright 2000-2008,2009 by Thomas E. Dickey
@@ -104,7 +104,7 @@
 #endif
 
 #ifndef DEF_ALLOW_WINDOW
-#define DEF_ALLOW_WINDOW       True
+#define DEF_ALLOW_WINDOW       False
 #endif
 
 #if OPT_BLINK_TEXT
diff --git a/menu.c b/menu.c
index 19a1bb9..79377b3 100644
--- a/menu.c
+++ b/menu.c
@@ -1,4 +1,4 @@
-/* $XTermId: menu.c,v 1.252 2009/07/03 15:01:14 tom Exp $ */
+/* $XTermId: menu.c,v 1.253 2009/09/27 22:36:07 tom Exp $ */
 
 /*
 
@@ -177,6 +177,7 @@ static void do_cursorblink     PROTO_XT_CALLBACK_ARGS;
 
 #if OPT_BOX_CHARS
 static void do_font_boxchars   PROTO_XT_CALLBACK_ARGS;
+static void do_font_packed     PROTO_XT_CALLBACK_ARGS;
 #endif
 
 #if OPT_DEC_CHRSET
@@ -351,6 +352,7 @@ MenuEntry fontMenuEntries[] = {
     { "line1",         NULL,           NULL },
 #if OPT_BOX_CHARS
     { "font-linedrawing",do_font_boxchars,NULL },
+    { "font-packed",   do_font_packed,NULL },
 #endif
 #if OPT_DEC_CHRSET
     { "font-doublesize",do_font_doublesize,NULL },
@@ -713,6 +715,10 @@ domenu(Widget w,
            SetItemSensitivity(
                                  
fontMenuEntries[fontMenu_font_boxchars].widget,
                                  True);
+           update_font_packed();
+           SetItemSensitivity(
+                                 
fontMenuEntries[fontMenu_font_packedfont].widget,
+                                 True);
 #endif
 #if OPT_DEC_SOFTFONT           /* FIXME: not implemented */
            update_font_loadable();
@@ -1496,6 +1502,16 @@ do_font_boxchars(Widget gw GCC_UNUSED,
     update_font_boxchars();
     Redraw();
 }
+
+static void
+do_font_packed(Widget gw GCC_UNUSED,
+              XtPointer closure GCC_UNUSED,
+              XtPointer data GCC_UNUSED)
+{
+    ToggleFlag(term->screen.force_packed);
+    update_font_packed();
+    SetVTFont(term, term->screen.menu_font_number, True, NULL);
+}
 #endif
 
 #if OPT_DEC_SOFTFONT
@@ -2250,6 +2266,16 @@ HandleFontBoxChars(Widget w,
     handle_vt_toggle(do_font_boxchars, term->screen.force_box_chars,
                     params, *param_count, w);
 }
+
+void
+HandleFontPacked(Widget w,
+                XEvent * event GCC_UNUSED,
+                String * params,
+                Cardinal *param_count)
+{
+    handle_vt_toggle(do_font_packed, term->screen.force_packed,
+                    params, *param_count, w);
+}
 #endif
 
 #if OPT_DEC_SOFTFONT
@@ -3176,6 +3202,15 @@ update_font_boxchars(void)
                   fontMenu_font_boxchars,
                   term->screen.force_box_chars);
 }
+
+void
+update_font_packed(void)
+{
+    UpdateCheckbox("update_font_packed",
+                  fontMenuEntries,
+                  fontMenu_font_packedfont,
+                  term->screen.force_packed);
+}
 #endif
 
 #if OPT_DEC_SOFTFONT
diff --git a/menu.h b/menu.h
index ff056ee..20295fb 100644
--- a/menu.h
+++ b/menu.h
@@ -1,4 +1,4 @@
-/* $XTermId: menu.h,v 1.114 2009/05/02 14:35:39 Ovidiu.Gheorghioiu Exp $ */
+/* $XTermId: menu.h,v 1.116 2009/09/27 22:33:36 tom Exp $ */
 
 /*
 
@@ -90,6 +90,7 @@ extern void HandleDeleteIsDEL      PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontBoxChars     PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontDoublesize   PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontLoading      PROTO_XT_ACTIONS_ARGS;
+extern void HandleFontPacked       PROTO_XT_ACTIONS_ARGS;
 extern void HandleHardReset        PROTO_XT_ACTIONS_ARGS;
 extern void HandleHpFunctionKeys   PROTO_XT_ACTIONS_ARGS;
 extern void HandleJumpscroll       PROTO_XT_ACTIONS_ARGS;
@@ -257,6 +258,7 @@ typedef enum {
     fontMenu_line1,
 #if OPT_BOX_CHARS
     fontMenu_font_boxchars,
+    fontMenu_font_packedfont,
 #endif
 #if OPT_DEC_CHRSET
     fontMenu_font_doublesize,
@@ -427,8 +429,10 @@ extern void update_font_doublesize(void);
 
 #if OPT_BOX_CHARS
 extern void update_font_boxchars(void);
+extern void update_font_packed(void);
 #else
 #define update_font_boxchars() /* nothing */
+#define update_font_packed() /* nothing */
 #endif
 
 #if OPT_DEC_SOFTFONT
diff --git a/ptyx.h b/ptyx.h
index ee99a3e..4e015e6 100644
--- a/ptyx.h
+++ b/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.627 2009/09/10 08:50:02 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.629 2009/09/29 23:55:23 tom Exp $ */
 
 /*
  * Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -1540,9 +1540,11 @@ typedef struct {
 
        Boolean         fnt_prop;       /* true if proportional fonts   */
        Boolean         fnt_boxes;      /* true if font has box-chars   */
+       Boolean         force_packed;   /* true to override proportional */
 #if OPT_BOX_CHARS
        Boolean         force_box_chars;/* true if we assume that       */
-       Boolean         force_all_chars;/* true to outline missing chars*/
+       Boolean         force_all_chars;/* true to outline missing chars */
+       Boolean         allow_packing;  /* true to allow packed-fonts   */
 #endif
        Dimension       fnt_wide;
        Dimension       fnt_high;
diff --git a/screen.c b/screen.c
index d1d8363..20ef3b0 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.396 2009/08/30 00:06:07 tom Exp $ */
+/* $XTermId: screen.c,v 1.403 2009/10/01 00:30:19 tom Exp $ */
 
 /*
  * Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -704,7 +704,8 @@ ScrnClearCells(XtermWidget xw, int row, int col, unsigned 
len)
     if_OPT_WIDE_CHARS(screen, {
        int kl;
        int kr;
-       if (DamagedCells(screen, len, &kl, &kr, INX2ROW(screen, row), col)
+
+       if (DamagedCells(screen, len, &kl, &kr, row, col)
            && kr >= kl) {
            ClearCells(xw, flags, (unsigned) (kr - kl + 1), row, kl);
        }
@@ -755,6 +756,10 @@ ScrnWriteText(XtermWidget xw,
 
     (void) cur_fg_bg;
 
+    if (real_width + (unsigned) screen->cur_col > (unsigned) MaxCols(screen)) {
+       real_width = (unsigned) (MaxCols(screen) - screen->cur_col);
+    }
+
     if (avail <= 0)
        return;
     if (length > (unsigned) avail)
@@ -1156,7 +1161,7 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
     assert(last > (int) n);
 
     if_OPT_WIDE_CHARS(screen, {
-       int xx = INX2ROW(screen, screen->cur_row);
+       int xx = screen->cur_row;
        int kl;
        int kr = screen->cur_col;
        if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
@@ -1220,7 +1225,7 @@ ScrnDeleteChar(XtermWidget xw, unsigned n)
        int kl;
        int kr;
        if (DamagedCells(screen, n, &kl, &kr,
-                        INX2ROW(screen, screen->cur_row),
+                        screen->cur_row,
                         screen->cur_col))
            ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
     });
@@ -1647,13 +1652,15 @@ ClearBufRows(XtermWidget xw,
 
     TRACE(("ClearBufRows %d..%d\n", first, last));
     for (row = first; row <= last; row++) {
-       LineData *ld = getLineData(screen, ROW2INX(screen, row));
-       if_OPT_DEC_CHRSET({
-           /* clearing the whole row resets the doublesize characters */
-           SetLineDblCS(ld, CSET_SWL);
-       });
-       LineClrWrapped(ld);
-       ClearCells(xw, 0, len, row, 0);
+       LineData *ld = getLineData(screen, row);
+       if (ld != 0) {
+           if_OPT_DEC_CHRSET({
+               /* clearing the whole row resets the doublesize characters */
+               SetLineDblCS(ld, CSET_SWL);
+           });
+           LineClrWrapped(ld);
+           ClearCells(xw, 0, len, row, 0);
+       }
     }
 }
 
@@ -1777,8 +1784,8 @@ ScreenResize(XtermWidget xw,
 
                    if (amount < 0) {
                        /* move line-data from visible-buffer to save-buffer */
-                       saveEditBufLines(screen, dst, -amount);
-                       move_up = -amount;
+                       saveEditBufLines(screen, dst, (unsigned) -amount);
+                       move_up = (unsigned) -amount;
                        move_down_by = amount;
                    } else {
                        move_down_by = 0;
diff --git a/scrollbar.c b/scrollbar.c
index 85ce150..5a81efb 100644
--- a/scrollbar.c
+++ b/scrollbar.c
@@ -1,4 +1,4 @@
-/* $XTermId: scrollbar.c,v 1.143 2009/08/09 17:23:47 tom Exp $ */
+/* $XTermId: scrollbar.c,v 1.144 2009/09/26 14:56:42 tom Exp $ */
 
 /*
  * Copyright 2000-2008,2009 by Thomas E. Dickey
@@ -374,6 +374,9 @@ WindowScroll(XtermWidget xw, int top)
     ScrnRefresh(xw, refreshtop, 0, lines, MaxCols(screen), False);
 
     ScrollBarDrawThumb(screen->scrollWidget);
+#if OPT_BLINK_CURS || OPT_BLINK_TEXT
+    RestartBlinking(screen);
+#endif
 }
 
 #ifdef SCROLLBAR_RIGHT
diff --git a/trace.c b/trace.c
index dd16945..f5306f1 100644
--- a/trace.c
+++ b/trace.c
@@ -1,4 +1,4 @@
-/* $XTermId: trace.c,v 1.102 2009/07/03 13:57:08 tom Exp $ */
+/* $XTermId: trace.c,v 1.103 2009/09/28 09:09:41 tom Exp $ */
 
 /************************************************************
 
@@ -255,7 +255,7 @@ visibleIChar(IChar * buf, unsigned len)
     static unsigned used;
 
     if (buf != 0) {
-       unsigned limit = ((len + 1) * 6) + 1;
+       unsigned limit = ((len + 1) * 8) + 1;
        char *dst;
 
        if (limit > used) {
diff --git a/util.c b/util.c
index 4a740b6..02fcb6a 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.489 2009/09/10 09:22:43 tom Exp $ */
+/* $XTermId: util.c,v 1.503 2009/10/01 09:01:21 tom Exp $ */
 
 /*
  * Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -649,6 +649,10 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
           screen->cur_col,
           len, visibleIChar(str, len)));
 
+    if (cells + (unsigned) screen->cur_col > (unsigned) MaxCols(screen)) {
+       cells = (unsigned) (MaxCols(screen) - screen->cur_col);
+    }
+
     if (ScrnHaveSelection(screen)
        && ScrnIsLineInSelection(screen, INX2ROW(screen, screen->cur_row))) {
        ScrnDisownSelection(xw);
@@ -744,7 +748,7 @@ InsertLine(XtermWidget xw, int n)
     int scrolltop;
     int scrollheight;
 
-    if (!ScrnIsLineInMargins(screen, INX2ROW(screen, screen->cur_row)))
+    if (!ScrnIsLineInMargins(screen, screen->cur_row))
        return;
 
     TRACE(("InsertLine count=%d\n", n));
@@ -753,7 +757,12 @@ InsertLine(XtermWidget xw, int n)
        HideCursor();
 
     if (ScrnHaveSelection(screen)
-       && ScrnAreLinesInSelection(screen, screen->top_marg, screen->bot_marg)) 
{
+       && ScrnAreLinesInSelection(screen,
+                                  INX2ROW(screen, screen->top_marg),
+                                  INX2ROW(screen, screen->cur_row - 1))
+       && ScrnAreLinesInSelection(screen,
+                                  INX2ROW(screen, screen->cur_row),
+                                  INX2ROW(screen, screen->bot_marg))) {
        ScrnDisownSelection(xw);
     }
 
@@ -820,7 +829,7 @@ DeleteLine(XtermWidget xw, int n)
                                          && !screen->whichBuf
                                          && screen->cur_row == 0);
 
-    if (!ScrnIsLineInMargins(screen, INX2ROW(screen, screen->cur_row)))
+    if (!ScrnIsLineInMargins(screen, screen->cur_row))
        return;
 
     TRACE(("DeleteLine count=%d\n", n));
@@ -828,14 +837,17 @@ DeleteLine(XtermWidget xw, int n)
     if (screen->cursor_state)
        HideCursor();
 
+    if (n > (i = screen->bot_marg - screen->cur_row + 1)) {
+       n = i;
+    }
     if (ScrnHaveSelection(screen)
-       && ScrnAreLinesInSelection(screen, screen->top_marg, screen->bot_marg)) 
{
+       && ScrnAreLinesInSelection(screen,
+                                  INX2ROW(screen, screen->cur_row),
+                                  INX2ROW(screen, screen->cur_row + n - 1))) {
        ScrnDisownSelection(xw);
     }
 
     screen->do_wrap = False;
-    if (n > (i = screen->bot_marg - screen->cur_row + 1))
-       n = i;
     if (screen->jumpscroll) {
        if (screen->scroll_amt >= 0 && screen->cur_row == screen->top_marg) {
            if (screen->refresh_amt + n > MaxRows(screen))
@@ -847,8 +859,25 @@ DeleteLine(XtermWidget xw, int n)
                FlushScroll(xw);
        }
     }
-    if (!screen->scroll_amt) {
 
+    /* adjust screen->buf */
+    if (n > 0) {
+       if (scroll_all_lines)
+           ScrnDeleteLine(xw,
+                          screen->saveBuf_index,
+                          screen->bot_marg + screen->savelines,
+                          0,
+                          (unsigned) n);
+       else
+           ScrnDeleteLine(xw,
+                          screen->visbuf,
+                          screen->bot_marg,
+                          screen->cur_row,
+                          (unsigned) n);
+    }
+
+    /* repaint the screen, as needed */
+    if (!screen->scroll_amt) {
        shift = INX2ROW(screen, 0);
        bot = screen->max_row - shift;
        scrollheight = i - n;
@@ -876,6 +905,14 @@ DeleteLine(XtermWidget xw, int n)
            }
        }
        vertical_copy_area(xw, scrolltop + n, scrollheight, n);
+       if (shift > 0 && refreshheight > 0) {
+           int rows = refreshheight;
+           if (rows > shift)
+               rows = shift;
+           ScrnUpdate(xw, refreshtop, 0, rows, MaxCols(screen), True);
+           refreshtop += shift;
+           refreshheight -= shift;
+       }
        if (refreshheight > 0) {
            ClearCurBackground(xw,
                               (int) refreshtop * FontHeight(screen) + 
screen->border,
@@ -884,21 +921,6 @@ DeleteLine(XtermWidget xw, int n)
                               (unsigned) Width(screen));
        }
     }
-    /* adjust screen->buf */
-    if (n > 0) {
-       if (scroll_all_lines)
-           ScrnDeleteLine(xw,
-                          screen->saveBuf_index,
-                          screen->bot_marg + screen->savelines,
-                          0,
-                          (unsigned) n);
-       else
-           ScrnDeleteLine(xw,
-                          screen->visbuf,
-                          screen->bot_marg,
-                          screen->cur_row,
-                          (unsigned) n);
-    }
 }
 
 /*
@@ -1069,7 +1091,7 @@ ClearAbove(XtermWidget xw)
            if (screen->scroll_amt)
                FlushScroll(xw);
            if ((height = screen->cur_row + top) > screen->max_row)
-               height = screen->max_row;
+               height = screen->max_row + 1;
            if ((height -= top) > 0) {
                ClearCurBackground(xw,
                                   top * FontHeight(screen) + screen->border,
@@ -1081,8 +1103,7 @@ ClearAbove(XtermWidget xw)
        ClearBufRows(xw, 0, screen->cur_row - 1);
     }
 
-    if (INX2ROW(screen, screen->cur_row) <= screen->max_row)
-       ClearLeft(xw);
+    ClearLeft(xw);
 }
 
 /*
@@ -2909,16 +2930,16 @@ drawXtermText(XtermWidget xw,
                            ? WhichVFontData(screen, fnts[fBold])
                            : WhichVFontData(screen, fnts[fNorm]));
 
-       xtermFillCells(xw, flags, gc, x, y, len);
-
        while (len--) {
+           int cells = WideCells(*text);
 #if OPT_BOX_CHARS
+#if OPT_WIDE_CHARS
+           if (*text == HIDDEN_CHAR) {
+               ++text;
+               continue;
+           } else
+#endif
            if (IsXtermMissingChar(screen, *text, font)) {
-
-               width = 1;
-               if_OPT_WIDE_CHARS(screen, {
-                   width = my_wcwidth((wchar_t) (*text)) * FontWidth(screen);
-               });
                adj = 0;
            } else
 #endif
@@ -2935,7 +2956,10 @@ drawXtermText(XtermWidget xw,
                    width = XTextWidth(font->fs, temp, 1);
                });
                adj = (FontWidth(screen) - width) / 2;
+               if (adj < 0)
+                   adj = 0;
            }
+           xtermFillCells(xw, flags, gc, x, y, (Cardinal) cells);
            x = drawXtermText(xw,
                              flags | NOBACKGROUND | CHARBYCHAR,
                              gc, x + adj, y, chrset,
diff --git a/version.h b/version.h
index 8895fb8..c19c391 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.304 2009/09/09 23:42:14 tom Exp $ */
+/* $XTermId: version.h,v 1.305 2009/10/01 21:12:56 tom Exp $ */
 
 /*
  * These definitions are used to build the string that's printed in response to
@@ -6,7 +6,7 @@
  * version of X to which this version of xterm has been built.  The number in
  * parentheses is my patch number (Thomas E. Dickey).
  */
-#define XTERM_PATCH   248
+#define XTERM_PATCH   249
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm"
diff --git a/xterm.h b/xterm.h
index a820427..a732c96 100644
--- a/xterm.h
+++ b/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.582 2009/09/10 09:01:22 tom Exp $ */
+/* $XTermId: xterm.h,v 1.585 2009/10/01 09:04:48 tom Exp $ */
 
 /************************************************************
 
@@ -396,6 +396,7 @@ extern char **environ;
 #define XtNfontStyle           "fontStyle"
 #define XtNfontWarnings                "fontWarnings"
 #define XtNforceBoxChars       "forceBoxChars"
+#define XtNforcePackedFont     "forcePackedFont"
 #define XtNformatOtherKeys     "formatOtherKeys"
 #define XtNfreeBoldBox         "freeBoldBox"
 #define XtNhighlightColor      "highlightColor"
@@ -555,6 +556,7 @@ extern char **environ;
 #define XtCFontStyle           "FontStyle"
 #define XtCFontWarnings                "FontWarnings"
 #define XtCForceBoxChars       "ForceBoxChars"
+#define XtCForcePackedFont     "ForcePackedFont"
 #define XtCFormatOtherKeys     "FormatOtherKeys"
 #define XtCFreeBoldBox         "FreeBoldBox"
 #define XtCHighlightColorMode  "HighlightColorMode"
@@ -742,7 +744,10 @@ extern void ReadLineButton             
PROTO_XT_ACTIONS_ARGS;
 #if OPT_WIDE_CHARS
 extern Bool iswide(int  /* i */);
 #define FIRST_WIDECHAR 256
-#define isWide(n) ((int) (n) >= FIRST_WIDECHAR && iswide(n))
+#define WideCells(n) (((IChar)(n) >= FIRST_WIDECHAR) ? my_wcwidth((wchar_t) 
(n)) : 1)
+#define isWide(n)    (((IChar)(n) >= FIRST_WIDECHAR) && iswide(n))
+#else
+#define WideCells(n) 1
 #endif
 
 /* cachedCgs.c */
@@ -771,6 +776,7 @@ extern int VTInit (XtermWidget /* xw */);
 extern int v_write (int  /* f */, Char * /* d */, unsigned  /* len */);
 extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name 
*/, Bool  /* justprobe */);
 extern void HideCursor (void);
+extern void RestartBlinking(TScreen * /* screen */);
 extern void ShowCursor (void);
 extern void SwitchBufPtrs (TScreen * /* screen */);
 extern void ToggleAlternate (XtermWidget /* xw */);
diff --git a/xterm.log.html b/xterm.log.html
index 1cc906e..7fecb92 100644
--- a/xterm.log.html
+++ b/xterm.log.html
@@ -20,7 +20,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   *
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.790 2009/09/11 23:10:00 tom Exp $
+  $XTermId: xterm.log.html,v 1.802 2009/10/02 00:16:00 tom Exp $
   -->
 <HTML>
 <HEAD>
@@ -45,6 +45,7 @@ Most of these are summarized in the XFree86 CHANGELOG
 is the latest version of this file.
 
 <UL>
+<LI><A HREF="#xterm_249">Patch #249 - 2009/10/1</A>
 <LI><A HREF="#xterm_248">Patch #248 - 2009/9/11</A>
 <LI><A HREF="#xterm_247">Patch #247 - 2009/8/30</A>
 <LI><A HREF="#xterm_246">Patch #246 - 2009/8/16</A>
@@ -296,6 +297,56 @@ is the latest version of this file.
 <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
 </UL>
 
+<H1><A NAME="xterm_249">Patch #249 - 2009/10/1</A></H1>
+<ul>
+       <li>change default for <code>allowWindowOps</code> resource to false.
+           <!-- on the other hand, gnome-terminal, pterm and rxvt-unicode
+               leave most of the related functionality enabled ;-) -->
+
+       <li>add limit-checks for result of visual_width() function,
+           needed from <a href="#xterm_242">patch #242</a> and
+           exposed by #244 changes (Debian #548321).
+
+       <li>improve limit-checks in select/paste.
+
+       <li>fix a remaining bug from 
+           <a href="#xterm_230">patch #230</a>
+           changes for displaying multi-column
+           characters in a proportional font (report by Chris Jones).
+
+       <li>add new resource forcePackedFont and menu entry "Packed Font" to
+           control whether to use the font's minimum (default) or maximum
+           width when those differ.  The workaround which xterm uses to
+           accommodate proportional fonts is not necessary with certain
+           fonts such as unifont which happen to store a mixture of
+           multicolumn glyphs (report by Chris Jones).
+
+       <li>fix an (old) bug which did not restart the timer for blinking text
+           if the only blinking text was temporarily scrolled out of view,
+           e.g., using the scrollbar.
+
+       <li>fix an (old) flaw in the delete-line operation where the text which
+           is scrolled into view while the display is scrolled up was not
+           repainted.
+
+       <li>improve delete-line and insert-line operations, retaining selection
+           when the selection does not intersect the deleted/inserted lines.
+
+       <li>fix an (old) off-by-one error when an application cleared above the
+           cursor position while the display was scrolled up, that would leave
+           an extra line of text uncleared.
+
+       <li>fix a similar problem where the double-size attribute would not be
+           reset when clearing the screen while the display was scrolled up.
+
+       <li>fix an indexing error which would occur if an application cleared
+           a line while the display was scrolled up and was also in UTF-8 mode
+           (Redhat #524503).
+           The error was from <a href="#xterm_228">patch #228</a>
+           but more visible after
+           changes from <a href="#xterm_244">patch #244</a>.


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to