From 8a924ff760ce97164f45fa6ea537f23e233e393a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 16 Jun 2026 09:28:17 +0000 Subject: [PATCH] Allow rectangle selection to extend past end of current line to behave the same as vi with virtualedit=block set. From Mark Kelly in GitHub issue 5227. --- usr.bin/tmux/window-copy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index f9dd292d614..64667753e11 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.406 2026/06/13 20:39:11 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.407 2026/06/16 09:28:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -5403,8 +5403,12 @@ window_copy_update_cursor(struct window_mode_entry *wme, u_int cx, u_int cy) u_int maxx; int allow_onemore; - allow_onemore = (data->screen.sel != NULL && data->rectflag); - if (cy < screen_size_y(s)) { + /* + * Allow rectangle selection to extend past end of current line to + * behave the same as vi with virtualedit=block set. + */ + if (!data->rectflag && cy < screen_size_y(s)) { + allow_onemore = (data->screen.sel != NULL && data->rectflag); py = screen_hsize(data->backing) + cy - data->oy; maxx = window_copy_cursor_limit(wme, py, allow_onemore); if (cx > maxx)