Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for tmux 1.6: Stop searching forward at the end of the buffer.
From 6bccc3fc7362967ea7d4c296a22793f7f3a2c6d8 Mon Sep 17 00:00:00 2001
From: Przemyslaw Pawelczyk <przemoc@gmail.com>
Date: Sat, 18 Feb 2012 23:51:38 +0100
Subject: [PATCH] Stop searching forward at the end of the buffer.
Requested-by: Jacobo de Vera <devel@jacobodevera.com>
---
window-copy.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/window-copy.c b/window-copy.c
index 4f25f3f..76292d3 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1041,7 +1041,7 @@ window_copy_search_down(struct window_pane *wp, const char *searchstr)
struct grid_cell gc;
size_t searchlen;
u_int i, first, fx, fy, px;
- int utf8flag, n, wrapped;
+ int utf8flag, n;
if (*searchstr == '\0')
return;
@@ -1064,9 +1064,8 @@ window_copy_search_down(struct window_pane *wp, const char *searchstr)
fy++;
} else
fx++;
- n = wrapped = 0;
+ n = 0;
-retry:
sgd = ss.grid;
for (i = fy + 1; i < gd->hsize + gd->sy; i++) {
first = 0;
@@ -1078,12 +1077,6 @@ retry:
break;
}
}
- if (!n && !wrapped) {
- fx = 0;
- fy = 0;
- wrapped = 1;
- goto retry;
- }
screen_free(&ss);
}
--
1.7.9
@przemoc

This comment has been minimized.

Copy link
Owner Author

@przemoc przemoc commented Dec 13, 2015

Just for the record: I created this patch as an answer to question on Unix.SX by Jacobo de Vera. He made the change configurable and sent the new patch to tmux-users ML. It went into svn repo and is available since version 1.7. Nowadays you can find the commit in git repo: tmux/tmux@95f48a2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment