Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'

* refs/remotes/tmux-openbsd/master:
  Correctly skip padding at end of line, GitHub issue 5411.
This commit is contained in:
tmux update bot
2026-07-29 20:04:07 +00:00
4 changed files with 30 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: grid-reader.c,v 1.10 2026/05/17 13:12:21 nicm Exp $ */
/* $OpenBSD: grid-reader.c,v 1.11 2026/07/29 17:42:56 nicm Exp $ */
/*
* Copyright (c) 2020 Anindya Mukherjee <anindya49@hotmail.com>
@@ -54,11 +54,8 @@ grid_reader_cursor_right(struct grid_reader *gr, int wrap, int all, int onemore)
px = gr->gd->sx;
else if (onemore)
px = grid_reader_line_length(gr);
else {
px = grid_reader_line_length(gr);
if (px != 0)
px--;
}
else
px = grid_line_limit(gr->gd, gr->cy);
if (wrap && gr->cx >= px && gr->cy < gr->gd->hsize + gr->gd->sy - 1) {
grid_reader_cursor_start_of_line(gr, 0);

22
grid.c
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: grid.c,v 1.154 2026/07/20 11:16:33 nicm Exp $ */
/* $OpenBSD: grid.c,v 1.155 2026/07/29 17:42:56 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1681,6 +1681,26 @@ grid_line_length(struct grid *gd, u_int py)
return (px);
}
/* Get last position on line, not including padding. */
u_int
grid_line_limit(struct grid *gd, u_int py)
{
struct grid_cell gc;
u_int px;
px = grid_line_length(gd, py);
if (px == 0)
return (0);
px--;
while (px > 0) {
grid_get_cell(gd, px, py, &gc);
if (~gc.flags & GRID_FLAG_PADDING)
break;
px--;
}
return (px);
}
/* Check if character is in set. */
int
grid_in_set(struct grid *gd, u_int px, u_int py, const char *set)

3
tmux.h
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1417 2026/07/29 14:06:32 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1418 2026/07/29 17:42:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3510,6 +3510,7 @@ void grid_reflow(struct grid *, u_int);
void grid_wrap_position(struct grid *, u_int, u_int, u_int *, u_int *);
void grid_unwrap_position(struct grid *, u_int *, u_int *, u_int, u_int);
u_int grid_line_length(struct grid *, u_int);
u_int grid_line_limit(struct grid *, u_int);
int grid_in_set(struct grid *, u_int, u_int, const char *);
/* grid-reader.c */

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: window-copy.c,v 1.423 2026/07/21 11:52:13 nicm Exp $ */
/* $OpenBSD: window-copy.c,v 1.424 2026/07/29 17:42:56 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -6215,16 +6215,13 @@ static u_int
window_copy_cursor_limit(struct window_mode_entry *wme, u_int py,
int allow_onemore)
{
struct window_copy_mode_data *data = wme->data;
struct options *oo = wme->wp->window->options;
u_int len;
len = window_copy_find_length(wme, py);
if (allow_onemore ||
options_get_number(oo, "mode-keys") != MODEKEY_VI)
return (len);
if (len == 0)
return (0);
return (len - 1);
return (window_copy_find_length(wme, py));
return (grid_line_limit(data->backing->grid, py));
}
static void