=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/status.c,v retrieving revision 1.16 retrieving revision 1.17 diff -c -r1.16 -r1.17 *** src/usr.bin/tmux/status.c 2009/07/21 18:40:30 1.16 --- src/usr.bin/tmux/status.c 2009/07/26 21:13:47 1.17 *************** *** 1,4 **** ! /* $OpenBSD: status.c,v 1.16 2009/07/21 18:40:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: status.c,v 1.17 2009/07/26 21:13:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 645,651 **** struct screen_write_ctx ctx; struct session *s = c->session; struct screen old_status; ! size_t i, size, left, len, offset, n; char ch; struct grid_cell gc; --- 645,651 ---- struct screen_write_ctx ctx; struct session *s = c->session; struct screen old_status; ! size_t i, size, left, len, off, n; char ch; struct grid_cell gc; *************** *** 653,659 **** return (0); memcpy(&old_status, &c->status, sizeof old_status); screen_init(&c->status, c->tty.sx, 1, 0); ! offset = 0; len = strlen(c->prompt_string); if (len > c->tty.sx) --- 653,659 ---- return (0); memcpy(&old_status, &c->status, sizeof old_status); screen_init(&c->status, c->tty.sx, 1, 0); ! off = 0; len = strlen(c->prompt_string); if (len > c->tty.sx) *************** *** 674,680 **** if (c->prompt_index < left) size = strlen(c->prompt_buffer); else { ! offset = c->prompt_index - left - 1; if (c->prompt_index == strlen(c->prompt_buffer)) left--; size = left; --- 674,680 ---- if (c->prompt_index < left) size = strlen(c->prompt_buffer); else { ! off = c->prompt_index - left + 1; if (c->prompt_index == strlen(c->prompt_buffer)) left--; size = left; *************** *** 687,713 **** screen_write_putc(&ctx, &gc, '*'); } else { screen_write_puts(&ctx, &gc, ! "%.*s", (int) left, c->prompt_buffer + offset); } for (i = len + size; i < c->tty.sx; i++) screen_write_putc(&ctx, &gc, ' '); - } ! /* Draw a fake cursor. */ ! screen_write_cursormove(&ctx, len + c->prompt_index - offset, 0); ! if (c->prompt_index == strlen(c->prompt_buffer)) ! ch = ' '; ! else { ! if (c->prompt_flags & PROMPT_HIDDEN) ! ch = '*'; ! else ! ch = c->prompt_buffer[c->prompt_index]; } - if (ch == '\0') - ch = ' '; - gc.attr ^= GRID_ATTR_REVERSE; - screen_write_putc(&ctx, &gc, ch); screen_write_stop(&ctx); --- 687,713 ---- screen_write_putc(&ctx, &gc, '*'); } else { screen_write_puts(&ctx, &gc, ! "%.*s", (int) left, c->prompt_buffer + off); } for (i = len + size; i < c->tty.sx; i++) screen_write_putc(&ctx, &gc, ' '); ! /* Draw a fake cursor. */ ! screen_write_cursormove(&ctx, len + c->prompt_index - off, 0); ! if (c->prompt_index == strlen(c->prompt_buffer)) ! ch = ' '; ! else { ! if (c->prompt_flags & PROMPT_HIDDEN) ! ch = '*'; ! else ! ch = c->prompt_buffer[c->prompt_index]; ! } ! if (ch == '\0') ! ch = ' '; ! gc.attr ^= GRID_ATTR_REVERSE; ! screen_write_putc(&ctx, &gc, ch); } screen_write_stop(&ctx);