From 4cd020caf92777aa0810667f26ce52b092060af3 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 May 2024 09:32:37 +0000 Subject: [PATCH] Revert part of the change for GitHub issue 3675 because it does not work correctly, it was intended to skip lines that are already being searched as part of a previous wrapped line but in fact is skipping all lines except the last in wrapped lines. Also revert the search-wrapped-lines option (I didn't realize it was intended to work around this). --- usr.bin/tmux/options-table.c | 10 +--------- usr.bin/tmux/tmux.1 | 10 +--------- usr.bin/tmux/window-copy.c | 23 +++++------------------ 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 98c226d26af..760fadf61e8 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.173 2024/05/14 07:52:19 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.174 2024/05/14 09:32:37 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -384,14 +384,6 @@ const struct options_table_entry options_table[] = { .text = "Maximum number of commands to keep in history." }, - { .name = "search-wrapped-lines", - .type = OPTIONS_TABLE_FLAG, - .scope = OPTIONS_TABLE_SERVER, - .default_num = 1, - .text = "Whether to include full wrapped lines when searching for " - "text in copy mode." - }, - { .name = "set-clipboard", .type = OPTIONS_TABLE_CHOICE, .scope = OPTIONS_TABLE_SERVER, diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 3bd92c46852..aa61246b0cf 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.943 2024/05/14 07:52:19 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.944 2024/05/14 09:32:37 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -3795,14 +3795,6 @@ each client. .It Ic prompt-history-limit Ar number Set the number of history items to save in the history file for each type of command prompt. -.It Xo Ic search-wrapped-lines -.Op Ic on | off -.Xc -Defines how -.Nm -handles wrapped lines when searching in copy mode. -When disabled, lines are truncated and searching is faster, but matches may be -missed. .It Xo Ic set-clipboard .Op Ic on | external | off .Xc diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 85c981f7d68..cacf9f1f178 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.349 2024/05/14 07:40:39 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.350 2024/05/14 09:32:37 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3614,13 +3614,10 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap, int direction, int regex) { - u_int i, px, sx, ssize = 1; - int wrapped, found = 0, cflags = REG_EXTENDED; - char *sbuf; - regex_t reg; - struct grid_line *gl; - - wrapped = options_get_number(global_options, "search-wrapped-lines"); + u_int i, px, sx, ssize = 1; + int found = 0, cflags = REG_EXTENDED; + char *sbuf; + regex_t reg; if (regex) { sbuf = xmalloc(ssize); @@ -3637,11 +3634,6 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, if (direction) { for (i = fy; i <= endline; i++) { - gl = grid_get_line(gd, i); - if (!wrapped && - i != endline && - gl->flags & GRID_LINE_WRAPPED) - continue; if (regex) { found = window_copy_search_lr_regex(gd, &px, &sx, i, fx, gd->sx, ®); @@ -3655,11 +3647,6 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, } } else { for (i = fy + 1; endline < i; i--) { - gl = grid_get_line(gd, i - 1); - if (!wrapped && - i != endline && - gl->flags & GRID_LINE_WRAPPED) - continue; if (regex) { found = window_copy_search_rl_regex(gd, &px, &sx, i - 1, 0, fx + 1, ®); -- 2.20.1