From dfcb588029945e5f42dd2b68990ea6110f8c0730 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 2 Oct 2026 14:16:42 +0000 Subject: [PATCH] Only skip collecting text except for right margin when autowrap is off, from Jang-Ho Hwang. --- screen-write.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/screen-write.c b/screen-write.c index 675960beb..62327a49f 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.296 2026/10/02 12:53:26 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.297 2026/10/02 14:16:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2664,6 +2664,10 @@ screen_write_collect_add(struct screen_write_ctx *ctx, * Don't need to check that the attributes and whatnot are still the * same - input_parse will end the collection when anything that isn't * a plain character is encountered. + * + * Without wrapping, collect up to but not including the last column. + * Leave that cell to screen_write_cell so repeated writes overwrite it + * and the cursor remains at the right edge. */ collect = 1; @@ -2673,7 +2677,8 @@ screen_write_collect_add(struct screen_write_ctx *ctx, collect = 0; else if (gc->attr & GRID_ATTR_CHARSET) collect = 0; - else if (~s->mode & MODE_WRAP) + else if ((~s->mode & MODE_WRAP) && + s->cx + ctx->item->used >= sx - 1) collect = 0; else if (s->mode & MODE_INSERT) collect = 0;