mirror of
https://github.com/tmux/tmux.git
synced 2026-10-16 16:44:30 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Check the column when looking up search marks in case the cursor is past the last column, GitHub issue 5756 from Alejandro Pacheco. Redraw the client after an OSC 11 background change, GitHub issue 5752 from Ilya Pozdnyakov.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tty-keys.c,v 1.219 2026/10/14 13:03:47 nicm Exp $ */
|
||||
/* $OpenBSD: tty-keys.c,v 1.220 2026/10/16 12:01:33 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -1785,8 +1785,12 @@ tty_keys_colours1(struct tty *tty, const char *buf, size_t len, size_t *size,
|
||||
|
||||
n = tty_keys_colours(tty, buf, len, size, &tty->fg, &tty->bg);
|
||||
if (n == 0) {
|
||||
if (tty->bg != bg)
|
||||
if (tty->bg != bg) {
|
||||
server_client_update_theme_colours(c);
|
||||
if (tty->flags & TTY_OPENED)
|
||||
tty_invalidate(tty);
|
||||
server_redraw_client(c);
|
||||
}
|
||||
session_theme_changed(c->session);
|
||||
}
|
||||
return (n);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: window-copy.c,v 1.438 2026/10/13 23:17:42 nicm Exp $ */
|
||||
/* $OpenBSD: window-copy.c,v 1.439 2026/10/16 12:17:03 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -91,6 +91,8 @@ static int window_copy_last_regex(struct grid *, u_int, u_int, u_int,
|
||||
int);
|
||||
static int window_copy_search_mark_at(struct window_copy_mode_data *,
|
||||
u_int, u_int, u_int *);
|
||||
static int window_copy_search_mark_at_cursor(
|
||||
struct window_copy_mode_data *, u_int *, int *);
|
||||
static int window_copy_grow_searchpos(struct window_copy_mode_data *,
|
||||
u_int, u_int, u_int);
|
||||
static void window_copy_search_set_index(struct window_copy_mode_data *,
|
||||
@@ -5125,6 +5127,8 @@ window_copy_search_mark_at(struct window_copy_mode_data *data, u_int px,
|
||||
struct screen *s = data->backing;
|
||||
struct grid *gd = s->grid;
|
||||
|
||||
if (px >= gd->sx)
|
||||
return (-1);
|
||||
if (py < gd->hsize - data->oy)
|
||||
return (-1);
|
||||
if (py > gd->hsize - data->oy + gd->sy - 1)
|
||||
@@ -5133,6 +5137,23 @@ window_copy_search_mark_at(struct window_copy_mode_data *data, u_int px,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the search mark position of the cursor. If the cursor is after the last
|
||||
* column, use the last cell and set after.
|
||||
*/
|
||||
static int
|
||||
window_copy_search_mark_at_cursor(struct window_copy_mode_data *data,
|
||||
u_int *at, int *after)
|
||||
{
|
||||
u_int cx = data->cx, cy, sx = screen_size_x(data->backing);
|
||||
|
||||
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
||||
*after = (cx >= sx);
|
||||
if (*after)
|
||||
cx = sx - 1;
|
||||
return (window_copy_search_mark_at(data, cx, cy, at));
|
||||
}
|
||||
|
||||
static u_int
|
||||
window_copy_clip_width(u_int width, u_int b, u_int sx, u_int sy)
|
||||
{
|
||||
@@ -5452,20 +5473,20 @@ window_copy_match_at_cursor(struct window_copy_mode_data *data)
|
||||
{
|
||||
struct grid *gd = data->backing->grid;
|
||||
struct grid_cell gc;
|
||||
u_int at, start, end, cy, px, py;
|
||||
u_int at, start, end, px, py;
|
||||
u_int sx = screen_size_x(data->backing);
|
||||
char *buf = NULL;
|
||||
size_t len = 0;
|
||||
int after;
|
||||
|
||||
if (data->searchmark == NULL)
|
||||
return (NULL);
|
||||
|
||||
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
||||
if (window_copy_search_mark_at(data, data->cx, cy, &at) != 0)
|
||||
if (window_copy_search_mark_at_cursor(data, &at, &after) != 0)
|
||||
return (NULL);
|
||||
if (data->searchmark[at] == 0) {
|
||||
/* Allow one position after the match. */
|
||||
if (at == 0 || data->searchmark[--at] == 0)
|
||||
if (after || at == 0 || data->searchmark[--at] == 0)
|
||||
return (NULL);
|
||||
}
|
||||
window_copy_match_start_end(data, at, &start, &end);
|
||||
@@ -5505,7 +5526,7 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy,
|
||||
struct window_pane *wp = wme->wp;
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
u_int mark, start, end, cy, cursor, current;
|
||||
int inv = 0, found = 0;
|
||||
int inv = 0, found = 0, after;
|
||||
int keys;
|
||||
|
||||
cy = screen_hsize(data->backing) - data->oy + data->cy;
|
||||
@@ -5540,16 +5561,16 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy,
|
||||
if (mark == 0)
|
||||
return;
|
||||
|
||||
if (window_copy_search_mark_at(data, data->cx, cy, &cursor) == 0) {
|
||||
if (window_copy_search_mark_at_cursor(data, &cursor, &after) == 0) {
|
||||
keys = options_get_number(wp->window->options, "mode-keys");
|
||||
if (cursor != 0 &&
|
||||
if ((after || cursor != 0) &&
|
||||
keys == MODEKEY_EMACS &&
|
||||
data->searchdirection) {
|
||||
if (data->searchmark[cursor - 1] == mark) {
|
||||
if (!after)
|
||||
cursor--;
|
||||
if (data->searchmark[cursor] == mark)
|
||||
found = 1;
|
||||
}
|
||||
} else if (data->searchmark[cursor] == mark)
|
||||
} else if (!after && data->searchmark[cursor] == mark)
|
||||
found = 1;
|
||||
if (found) {
|
||||
window_copy_match_start_end(data, cursor, &start, &end);
|
||||
|
||||
Reference in New Issue
Block a user