Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv3377

Modified Files:
        screen-write.c tty.c 
Log Message:
Fix to properly wrap wide characters.


Index: tty.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tty.c,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- tty.c       19 Mar 2011 23:32:01 -0000      1.205
+++ tty.c       24 Mar 2011 17:03:29 -0000      1.206
@@ -892,11 +892,19 @@
        struct window_pane      *wp = ctx->wp;
        struct screen           *s = wp->screen;
        u_int                    cx;
+       u_int                    width;
+       const struct grid_cell  *gc = ctx->cell;
+       const struct grid_utf8  *gu = ctx->utf8;
+
+       if (gc->flags & GRID_FLAG_UTF8)
+               width = gu->width;
+       else
+               width = 1;
 
        tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
 
        /* Is the cursor in the very last position? */
-       if (ctx->ocx > wp->sx - ctx->last_width) {
+       if (ctx->ocx > wp->sx - width) {
                if (wp->xoff != 0 || wp->sx != tty->sx) {
                        /*
                         * The pane doesn't fill the entire line, the linefeed
@@ -906,10 +914,10 @@
                } else if (tty->cx < tty->sx) {
                        /*
                         * The cursor isn't in the last position already, so
-                        * move as far left as possinble and redraw the last
+                        * move as far left as possible and redraw the last
                         * cell to move into the last position.
                         */
-                       cx = screen_size_x(s) - ctx->last_width;
+                       cx = screen_size_x(s) - width;
                        tty_cursor_pane(tty, ctx, cx, ctx->ocy);
                        tty_cell(tty, &ctx->last_cell, &ctx->last_utf8);
                }

Index: screen-write.c
===================================================================
RCS file: /cvsroot/tmux/tmux/screen-write.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- screen-write.c      19 Mar 2011 23:30:37 -0000      1.94
+++ screen-write.c      24 Mar 2011 17:03:29 -0000      1.95
@@ -1012,8 +1012,10 @@
         * If this is a wide character and there is no room on the screen, for
         * the entire character, don't print it.
         */
-       if (width > 1 && (width > screen_size_x(s) ||
-           (s->cx != screen_size_x(s) && s->cx > screen_size_x(s) - width)))
+       if (!(s->mode & MODE_WRAP)
+           && (width > 1 && (width > screen_size_x(s) ||
+               (s->cx != screen_size_x(s)
+                && s->cx > screen_size_x(s) - width))))
                return;
 
        /*
@@ -1045,8 +1047,8 @@
        }
 
        /* Sanity checks. */
-       if (((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - 1)
-           || s->cy > screen_size_y(s) - 1)
+       if (((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width)
+           || s->cy > screen_size_y(s) - width)
                return;
 
        /* Handle overwriting of UTF-8 characters. */


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to