Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv17921

Modified Files:
        screen-write.c 
Log Message:
Ensure we overwrite wide characters properly, and never overwrite characters we 
weren't overlapping.
Fixes "disappearing wide characters" glitch.


Index: screen-write.c
===================================================================
RCS file: /cvsroot/tmux/tmux/screen-write.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- screen-write.c      5 Apr 2010 05:11:43 -0000       1.89
+++ screen-write.c      16 Jun 2010 18:09:23 -0000      1.90
@@ -23,7 +23,7 @@
 #include "tmux.h"
 
 void   screen_write_initctx(struct screen_write_ctx *, struct tty_ctx *, int);
-void   screen_write_overwrite(struct screen_write_ctx *);
+void   screen_write_overwrite(struct screen_write_ctx *, u_int);
 int    screen_write_combine(
            struct screen_write_ctx *, const struct utf8_data *);
 
@@ -1020,7 +1020,7 @@
                return;
 
        /* Handle overwriting of UTF-8 characters. */
-       screen_write_overwrite(ctx);
+       screen_write_overwrite(ctx, width);
 
        /*
         * If the new character is UTF-8 wide, fill in padding cells. Have
@@ -1123,12 +1123,11 @@
  * by the same character.
  */
 void
-screen_write_overwrite(struct screen_write_ctx *ctx)
+screen_write_overwrite(struct screen_write_ctx *ctx, u_int width)
 {
        struct screen           *s = ctx->s;
        struct grid             *gd = s->grid;
        const struct grid_cell  *gc;
-       const struct grid_utf8  *gu;
        u_int                    xx;
 
        gc = grid_view_peek_cell(gd, s->cx, s->cy);
@@ -1148,30 +1147,17 @@
 
                /* Overwrite the character at the start of this padding. */
                grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
+       }
 
-               /* Overwrite following padding cells. */
-               xx = s->cx;
-               while (++xx < screen_size_x(s)) {
-                       gc = grid_view_peek_cell(gd, xx, s->cy);
-                       if (!(gc->flags & GRID_FLAG_PADDING))
-                               break;
-                       grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
-               }
-       } else if (gc->flags & GRID_FLAG_UTF8) {
-               gu = grid_view_peek_utf8(gd, s->cx, s->cy);
-               if (gu->width > 1) {
-                       /*
-                        * An UTF-8 wide cell; overwrite following padding
-                        * cells only.
-                        */
-                       xx = s->cx;
-                       while (++xx < screen_size_x(s)) {
-                               gc = grid_view_peek_cell(gd, xx, s->cy);
-                               if (!(gc->flags & GRID_FLAG_PADDING))
-                                       break;
-                               grid_view_set_cell(
-                                   gd, xx, s->cy, &grid_default_cell);
-                       }
-               }
+       /*
+        * Overwrite any padding cells that belong to a UTF-8 character
+        * we'll be overwriting with the current character.
+        */
+       xx = s->cx + width - 1;
+       while (++xx < screen_size_x(s)) {
+               gc = grid_view_peek_cell(gd, xx, s->cy);
+               if (!(gc->flags & GRID_FLAG_PADDING))
+                       break;
+               grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
        }
 }


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to