Hey Nicholas, please check this over for me.
This patch is intended to fix the wide-chars wrapping thing. I've
attached a simple script to illustrate the problem, and a patch.
The patch is two parts: one is to let wrapping occur when the final wide
character "overlaps" the end of the line; the other is to make sure that
character actually gets placed at the correct location (first position
of the _pane_ - wasn't working if the pane wasn't on the left).
I don't know this code all that terrifically well, so please look it
over to make sure it makes sense.
--
Micah J. Cowan
http://micah.cowan.name/
? .deps
? Makefile
? Makefile.in
? aclocal.m4
? autom4te.cache
? config.log
? config.status
? configure
? cscope.out
? etc
? patches
? wide-wrap.diff
Index: screen-write.c
===================================================================
RCS file: /cvsroot/tmux/tmux/screen-write.c,v
retrieving revision 1.93
diff -u -p -r1.93 screen-write.c
--- screen-write.c 15 Feb 2011 15:10:47 -0000 1.93
+++ screen-write.c 5 Mar 2011 01:48:51 -0000
@@ -1012,8 +1012,10 @@ screen_write_cell(struct screen_write_ct
* 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 @@ screen_write_cell(struct screen_write_ct
}
/* 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. */
Index: tty.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tty.c,v
retrieving revision 1.203
diff -u -p -r1.203 tty.c
--- tty.c 15 Feb 2011 15:24:00 -0000 1.203
+++ tty.c 5 Mar 2011 01:48:51 -0000
@@ -892,11 +892,19 @@ tty_cmd_cell(struct tty *tty, const stru
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 @@ tty_cmd_cell(struct tty *tty, const stru
} 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);
}
#msg='Hï½
ï½ï½ï½ï¼ ï½ï½ï½ï½ï½ï¼'
msg='ããã«ã¡ã¯ãä¸çï¼'
chr=.
foo() {
echo $msg$msg$msg$msg$msg$chr$msg$msg
}
foo
echo
printf ' '; foo
echo
foo
echo
printf ' '; foo
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users