aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-09 17:32:06 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-09 17:32:06 +0000
commit97eb537f38f732f86a046e6fee9116c55c1ff706 (patch)
tree708fa32f751b2f0775c97400e30ef74002e1885b /screen-write.c
parent37b0bcd7c15b6dac69ac8cb1c0d9d6a4fd5c54c0 (diff)
downloadrtmux-97eb537f38f732f86a046e6fee9116c55c1ff706.tar.gz
rtmux-97eb537f38f732f86a046e6fee9116c55c1ff706.tar.bz2
rtmux-97eb537f38f732f86a046e6fee9116c55c1ff706.zip
Sync OpenBSD patchset 227:
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.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/screen-write.c b/screen-write.c
index 8754610d..aa4abf2f 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.66 2009-07-30 21:14:04 tcunha Exp $ */
+/* $Id: screen-write.c,v 1.67 2009-08-09 17:32:06 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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. */