diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-08 15:57:49 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-08 15:57:49 +0000 |
commit | 06ddd3dcf8ad5685e7120be93681ee666e4689fc (patch) | |
tree | b45e641093de7d4f4ca626500fcd9e0e911149b2 /screen-write.c | |
parent | 5e01b6d663abc086847c9bec145edeb9cd91530a (diff) | |
download | rtmux-06ddd3dcf8ad5685e7120be93681ee666e4689fc.tar.gz rtmux-06ddd3dcf8ad5685e7120be93681ee666e4689fc.tar.bz2 rtmux-06ddd3dcf8ad5685e7120be93681ee666e4689fc.zip |
Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/screen-write.c b/screen-write.c index d9b523c4..4e66b076 100644 --- a/screen-write.c +++ b/screen-write.c @@ -610,13 +610,20 @@ screen_write_mousemode(struct screen_write_ctx *ctx, int state) /* Line feed (down with scroll). */ void -screen_write_linefeed(struct screen_write_ctx *ctx) +screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) { - struct screen *s = ctx->s; - struct tty_ctx ttyctx; + struct screen *s = ctx->s; + struct grid_line *gl; + struct tty_ctx ttyctx; screen_write_initctx(ctx, &ttyctx); + gl = &s->grid->linedata[s->grid->hsize + s->cy]; + if (wrapped) + gl->flags |= GRID_LINE_WRAPPED; + else + gl->flags &= ~GRID_LINE_WRAPPED; + if (s->cy == s->rlower) grid_view_scroll_region_up(s->grid, s->rupper, s->rlower); else if (s->cy < screen_size_y(s) - 1) @@ -782,10 +789,10 @@ screen_write_cell( insert = 1; } - /* Check this will fit on the current line; scroll if not. */ + /* Check this will fit on the current line and wrap if not. */ if (s->cx > screen_size_x(s) - width) { screen_write_carriagereturn(ctx); - screen_write_linefeed(ctx); + screen_write_linefeed(ctx, 1); } /* Sanity checks. */ |