mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Remove current match indicator which can't work anymore since we only
search the visible region. From Anindya Mukherjee, GitHub issue 2508.
This commit is contained in:
		@@ -272,7 +272,7 @@ struct window_copy_mode_data {
 | 
				
			|||||||
	u_char		*searchmark;
 | 
						u_char		*searchmark;
 | 
				
			||||||
	int		 searchcount;
 | 
						int		 searchcount;
 | 
				
			||||||
	int		 searchmore;
 | 
						int		 searchmore;
 | 
				
			||||||
	int		 searchthis;
 | 
						int		 searchall;
 | 
				
			||||||
	int		 searchx;
 | 
						int		 searchx;
 | 
				
			||||||
	int		 searchy;
 | 
						int		 searchy;
 | 
				
			||||||
	int		 searcho;
 | 
						int		 searcho;
 | 
				
			||||||
@@ -396,6 +396,7 @@ window_copy_common_init(struct window_mode_entry *wme)
 | 
				
			|||||||
		data->searchstr = NULL;
 | 
							data->searchstr = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data->searchx = data->searchy = data->searcho = -1;
 | 
						data->searchx = data->searchy = data->searcho = -1;
 | 
				
			||||||
 | 
						data->searchall = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->jumptype = WINDOW_COPY_OFF;
 | 
						data->jumptype = WINDOW_COPY_OFF;
 | 
				
			||||||
	data->jumpchar = '\0';
 | 
						data->jumpchar = '\0';
 | 
				
			||||||
@@ -2334,9 +2335,6 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
 | 
				
			|||||||
		if (clear != WINDOW_COPY_CMD_CLEAR_NEVER) {
 | 
							if (clear != WINDOW_COPY_CMD_CLEAR_NEVER) {
 | 
				
			||||||
			window_copy_clear_marks(wme);
 | 
								window_copy_clear_marks(wme);
 | 
				
			||||||
			data->searchx = data->searchy = -1;
 | 
								data->searchx = data->searchy = -1;
 | 
				
			||||||
		} else if (data->searchthis != -1) {
 | 
					 | 
				
			||||||
			data->searchthis = -1;
 | 
					 | 
				
			||||||
			action = WINDOW_COPY_CMD_REDRAW;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (action == WINDOW_COPY_CMD_NOTHING)
 | 
							if (action == WINDOW_COPY_CMD_NOTHING)
 | 
				
			||||||
			action = WINDOW_COPY_CMD_REDRAW;
 | 
								action = WINDOW_COPY_CMD_REDRAW;
 | 
				
			||||||
@@ -2929,9 +2927,11 @@ window_copy_search(struct window_mode_entry *wme, int direction, int regex,
 | 
				
			|||||||
	if (data->timeout)
 | 
						if (data->timeout)
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (wp->searchstr == NULL || wp->searchregex != regex)
 | 
						if (data->searchall || wp->searchstr == NULL ||
 | 
				
			||||||
 | 
						    wp->searchregex != regex) {
 | 
				
			||||||
		visible_only = 0;
 | 
							visible_only = 0;
 | 
				
			||||||
	else
 | 
							data->searchall = 0;
 | 
				
			||||||
 | 
						} else
 | 
				
			||||||
		visible_only = (strcmp(wp->searchstr, str) == 0);
 | 
							visible_only = (strcmp(wp->searchstr, str) == 0);
 | 
				
			||||||
	free(wp->searchstr);
 | 
						free(wp->searchstr);
 | 
				
			||||||
	wp->searchstr = xstrdup(str);
 | 
						wp->searchstr = xstrdup(str);
 | 
				
			||||||
@@ -3116,7 +3116,6 @@ again:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (!visible_only) {
 | 
						if (!visible_only) {
 | 
				
			||||||
		if (stopped) {
 | 
							if (stopped) {
 | 
				
			||||||
			data->searchthis = -1;
 | 
					 | 
				
			||||||
			if (nfound > 1000)
 | 
								if (nfound > 1000)
 | 
				
			||||||
				data->searchcount = 1000;
 | 
									data->searchcount = 1000;
 | 
				
			||||||
			else if (nfound > 100)
 | 
								else if (nfound > 100)
 | 
				
			||||||
@@ -3127,10 +3126,6 @@ again:
 | 
				
			|||||||
				data->searchcount = -1;
 | 
									data->searchcount = -1;
 | 
				
			||||||
			data->searchmore = 1;
 | 
								data->searchmore = 1;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (which != -1)
 | 
					 | 
				
			||||||
				data->searchthis = 1 + nfound - which;
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				data->searchthis = -1;
 | 
					 | 
				
			||||||
			data->searchcount = nfound;
 | 
								data->searchcount = nfound;
 | 
				
			||||||
			data->searchmore = 0;
 | 
								data->searchmore = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -3366,15 +3361,11 @@ window_copy_write_line(struct window_mode_entry *wme,
 | 
				
			|||||||
			if (data->searchcount == -1) {
 | 
								if (data->searchcount == -1) {
 | 
				
			||||||
				size = xsnprintf(hdr, sizeof hdr,
 | 
									size = xsnprintf(hdr, sizeof hdr,
 | 
				
			||||||
				    "[%u/%u]", data->oy, hsize);
 | 
									    "[%u/%u]", data->oy, hsize);
 | 
				
			||||||
			} else if (data->searchthis == -1) {
 | 
								} else {
 | 
				
			||||||
				size = xsnprintf(hdr, sizeof hdr,
 | 
									size = xsnprintf(hdr, sizeof hdr,
 | 
				
			||||||
				    "(%d%s results) [%u/%u]", data->searchcount,
 | 
									    "(%d%s results) [%u/%u]", data->searchcount,
 | 
				
			||||||
				    data->searchmore ? "+" : "", data->oy,
 | 
									    data->searchmore ? "+" : "", data->oy,
 | 
				
			||||||
				    hsize);
 | 
									    hsize);
 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				size = xsnprintf(hdr, sizeof hdr,
 | 
					 | 
				
			||||||
				    "(%d/%d results) [%u/%u]", data->searchthis,
 | 
					 | 
				
			||||||
				    data->searchcount, data->oy, hsize);
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (size > screen_size_x(s))
 | 
							if (size > screen_size_x(s))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user