mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 13:04:22 +00:00
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:
@@ -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>
|
* 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;
|
px = gr->gd->sx;
|
||||||
else if (onemore)
|
else if (onemore)
|
||||||
px = grid_reader_line_length(gr);
|
px = grid_reader_line_length(gr);
|
||||||
else {
|
else
|
||||||
px = grid_reader_line_length(gr);
|
px = grid_line_limit(gr->gd, gr->cy);
|
||||||
if (px != 0)
|
|
||||||
px--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wrap && gr->cx >= px && gr->cy < gr->gd->hsize + gr->gd->sy - 1) {
|
if (wrap && gr->cx >= px && gr->cy < gr->gd->hsize + gr->gd->sy - 1) {
|
||||||
grid_reader_cursor_start_of_line(gr, 0);
|
grid_reader_cursor_start_of_line(gr, 0);
|
||||||
|
|||||||
22
grid.c
22
grid.c
@@ -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>
|
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -1681,6 +1681,26 @@ grid_line_length(struct grid *gd, u_int py)
|
|||||||
return (px);
|
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. */
|
/* Check if character is in set. */
|
||||||
int
|
int
|
||||||
grid_in_set(struct grid *gd, u_int px, u_int py, const char *set)
|
grid_in_set(struct grid *gd, u_int px, u_int py, const char *set)
|
||||||
|
|||||||
3
tmux.h
3
tmux.h
@@ -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>
|
* 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_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);
|
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_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 *);
|
int grid_in_set(struct grid *, u_int, u_int, const char *);
|
||||||
|
|
||||||
/* grid-reader.c */
|
/* grid-reader.c */
|
||||||
|
|||||||
@@ -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>
|
* 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,
|
window_copy_cursor_limit(struct window_mode_entry *wme, u_int py,
|
||||||
int allow_onemore)
|
int allow_onemore)
|
||||||
{
|
{
|
||||||
|
struct window_copy_mode_data *data = wme->data;
|
||||||
struct options *oo = wme->wp->window->options;
|
struct options *oo = wme->wp->window->options;
|
||||||
u_int len;
|
|
||||||
|
|
||||||
len = window_copy_find_length(wme, py);
|
|
||||||
if (allow_onemore ||
|
if (allow_onemore ||
|
||||||
options_get_number(oo, "mode-keys") != MODEKEY_VI)
|
options_get_number(oo, "mode-keys") != MODEKEY_VI)
|
||||||
return (len);
|
return (window_copy_find_length(wme, py));
|
||||||
if (len == 0)
|
return (grid_line_limit(data->backing->grid, py));
|
||||||
return (0);
|
|
||||||
return (len - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user