diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-02-08 10:01:22 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-02-08 10:01:22 +0000 |
commit | a9a0039be4fafb1d6772a1c844a95eb744d922a0 (patch) | |
tree | 6dbf337ccd9c1d44837f0b28ecfacb6d50ef0682 /tty.c | |
parent | 5aaf64062929a4b43ab58a8d3072d5e126e15424 (diff) | |
parent | cb80901d333d91fa1fc56d3eb33b520d7fb28d9d (diff) | |
download | rtmux-a9a0039be4fafb1d6772a1c844a95eb744d922a0.tar.gz rtmux-a9a0039be4fafb1d6772a1c844a95eb744d922a0.tar.bz2 rtmux-a9a0039be4fafb1d6772a1c844a95eb744d922a0.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 55 |
1 files changed, 12 insertions, 43 deletions
@@ -439,32 +439,36 @@ tty_putcode_ptr2(struct tty *tty, enum tty_code_code code, const void *a, void tty_puts(struct tty *tty, const char *s) { + size_t size = EVBUFFER_LENGTH(tty->event->output); + if (*s == '\0') return; + bufferevent_write(tty->event, s, strlen(s)); + log_debug("%s (%zu): %s", tty->path, size, s); if (tty_log_fd != -1) write(tty_log_fd, s, strlen(s)); - log_debug("%s: %s", tty->path, s); } void tty_putc(struct tty *tty, u_char ch) { + size_t size = EVBUFFER_LENGTH(tty->event->output); const char *acs; if (tty->cell.attr & GRID_ATTR_CHARSET) { acs = tty_acs_get(tty, ch); if (acs != NULL) { bufferevent_write(tty->event, acs, strlen(acs)); - log_debug("%s: %s", tty->path, acs); + log_debug("%s (%zu): %s", tty->path, size, acs); } else { bufferevent_write(tty->event, &ch, 1); - log_debug("%s: %c", tty->path, ch); + log_debug("%s (%zu): %c", tty->path, size, ch); } } else { bufferevent_write(tty->event, &ch, 1); - log_debug("%s: %c", tty->path, ch); + log_debug("%s (%zu): %c", tty->path, size, ch); } if (ch >= 0x20 && ch != 0x7f) { @@ -491,11 +495,13 @@ tty_putc(struct tty *tty, u_char ch) void tty_putn(struct tty *tty, const void *buf, size_t len, u_int width) { + size_t size = EVBUFFER_LENGTH(tty->event->output); + bufferevent_write(tty->event, buf, len); + log_debug("%s (%zu): %.*s", tty->path, size, (int)len, (char *)buf); if (tty_log_fd != -1) write(tty_log_fd, buf, len); - log_debug("%s: %.*s", tty->path, (int)len, (char *)buf); tty->cx += width; } @@ -998,17 +1004,6 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) return; } - /* - * If this line wrapped naturally (ctx->num is nonzero) and we are not - * using margins, don't do anything - the cursor can just be moved - * to the last cell and wrap naturally. - */ - if ((!tty_use_margin(tty) || - tty_pane_full_width(tty, ctx)) && - ctx->num != 0 && - !(tty->term->flags & TERM_EARLYWRAP)) - return; - tty_attributes(tty, &grid_default_cell, wp); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); @@ -1164,8 +1159,6 @@ void tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; - struct screen *s = wp->screen; - u_int cx, width; if (ctx->xoff + ctx->ocx > tty->sx - 1 && ctx->ocy == ctx->orlower) { if (tty_pane_full_width(tty, ctx)) @@ -1174,31 +1167,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) tty_margin_off(tty); } - /* Is the cursor in the very last position? */ - width = ctx->cell->data.width; - if (ctx->ocx > wp->sx - width) { - if (!tty_pane_full_width(tty, ctx)) { - /* - * The pane doesn't fill the entire line, the linefeed - * will already have happened, so just move the cursor. - */ - if (ctx->ocy != wp->yoff + wp->screen->rlower) - tty_cursor_pane(tty, ctx, 0, ctx->ocy + 1); - else - tty_cursor_pane(tty, ctx, 0, ctx->ocy); - } else if (tty->cy != ctx->yoff + ctx->ocy || - tty->cx < tty->sx) { - /* - * The cursor isn't in the last position already, so - * move as far right as possible and redraw the last - * cell to move into the last position. - */ - cx = screen_size_x(s) - ctx->last_cell.data.width; - tty_cursor_pane(tty, ctx, cx, ctx->ocy); - tty_cell(tty, &ctx->last_cell, wp); - } - } else - tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); + tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_cell(tty, ctx->cell, wp); } |