mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Add a wrap-search option to turn off wrapping of searches in copy
mode. From Jacobo de Vera.
This commit is contained in:
		@@ -669,6 +669,11 @@ const struct options_table_entry window_options_table[] = {
 | 
				
			|||||||
	  .default_str = "#I:#W#F"
 | 
						  .default_str = "#I:#W#F"
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ .name = "wrap-search",
 | 
				
			||||||
 | 
						  .type = OPTIONS_TABLE_FLAG,
 | 
				
			||||||
 | 
						  .default_num = 1
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{ .name = "xterm-keys",
 | 
						{ .name = "xterm-keys",
 | 
				
			||||||
	  .type = OPTIONS_TABLE_FLAG,
 | 
						  .type = OPTIONS_TABLE_FLAG,
 | 
				
			||||||
	  .default_num = 0
 | 
						  .default_num = 0
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								tmux.1
									
									
									
									
									
								
							@@ -2661,6 +2661,12 @@ will generate
 | 
				
			|||||||
function key sequences; these have a number included to indicate modifiers such
 | 
					function key sequences; these have a number included to indicate modifiers such
 | 
				
			||||||
as Shift, Alt or Ctrl.
 | 
					as Shift, Alt or Ctrl.
 | 
				
			||||||
The default is off.
 | 
					The default is off.
 | 
				
			||||||
 | 
					.Pp
 | 
				
			||||||
 | 
					.It Xo Ic wrap-search
 | 
				
			||||||
 | 
					.Op Ic on | off
 | 
				
			||||||
 | 
					.Xc
 | 
				
			||||||
 | 
					If this option is set, searches will wrap around the end of the pane contents.
 | 
				
			||||||
 | 
					The default is on.
 | 
				
			||||||
.El
 | 
					.El
 | 
				
			||||||
.It Xo Ic show-options
 | 
					.It Xo Ic show-options
 | 
				
			||||||
.Op Fl gsw
 | 
					.Op Fl gsw
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -984,11 +984,12 @@ window_copy_search_up(struct window_pane *wp, const char *searchstr)
 | 
				
			|||||||
	struct grid_cell	 	 gc;
 | 
						struct grid_cell	 	 gc;
 | 
				
			||||||
	size_t				 searchlen;
 | 
						size_t				 searchlen;
 | 
				
			||||||
	u_int				 i, last, fx, fy, px;
 | 
						u_int				 i, last, fx, fy, px;
 | 
				
			||||||
	int				 utf8flag, n, wrapped;
 | 
						int				 utf8flag, n, wrapped, wrapflag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (*searchstr == '\0')
 | 
						if (*searchstr == '\0')
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	utf8flag = options_get_number(&wp->window->options, "utf8");
 | 
						utf8flag = options_get_number(&wp->window->options, "utf8");
 | 
				
			||||||
 | 
						wrapflag = options_get_number(&wp->window->options, "wrap-search");
 | 
				
			||||||
	searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
 | 
						searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	screen_init(&ss, searchlen, 1, 0);
 | 
						screen_init(&ss, searchlen, 1, 0);
 | 
				
			||||||
@@ -1021,7 +1022,7 @@ retry:
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!n && !wrapped) {
 | 
						if (wrapflag && !n && !wrapped) {
 | 
				
			||||||
		fx = gd->sx - 1;
 | 
							fx = gd->sx - 1;
 | 
				
			||||||
		fy = gd->hsize + gd->sy - 1;
 | 
							fy = gd->hsize + gd->sy - 1;
 | 
				
			||||||
		wrapped = 1;
 | 
							wrapped = 1;
 | 
				
			||||||
@@ -1041,11 +1042,12 @@ window_copy_search_down(struct window_pane *wp, const char *searchstr)
 | 
				
			|||||||
	struct grid_cell	 	 gc;
 | 
						struct grid_cell	 	 gc;
 | 
				
			||||||
	size_t				 searchlen;
 | 
						size_t				 searchlen;
 | 
				
			||||||
	u_int				 i, first, fx, fy, px;
 | 
						u_int				 i, first, fx, fy, px;
 | 
				
			||||||
	int				 utf8flag, n, wrapped;
 | 
						int				 utf8flag, n, wrapped, wrapflag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (*searchstr == '\0')
 | 
						if (*searchstr == '\0')
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	utf8flag = options_get_number(&wp->window->options, "utf8");
 | 
						utf8flag = options_get_number(&wp->window->options, "utf8");
 | 
				
			||||||
 | 
						wrapflag = options_get_number(&wp->window->options, "wrap-search");
 | 
				
			||||||
	searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
 | 
						searchlen = screen_write_strlen(utf8flag, "%s", searchstr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	screen_init(&ss, searchlen, 1, 0);
 | 
						screen_init(&ss, searchlen, 1, 0);
 | 
				
			||||||
@@ -1078,7 +1080,7 @@ retry:
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!n && !wrapped) {
 | 
						if (wrapflag && !n && !wrapped) {
 | 
				
			||||||
		fx = 0;
 | 
							fx = 0;
 | 
				
			||||||
		fy = 0;
 | 
							fy = 0;
 | 
				
			||||||
		wrapped = 1;
 | 
							wrapped = 1;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user