mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Sort panes by index not by ID, GitHub issue 3249.
This commit is contained in:
		@@ -272,9 +272,10 @@ window_tree_cmp_window(const void *a0, const void *b0)
 | 
				
			|||||||
static int
 | 
					static int
 | 
				
			||||||
window_tree_cmp_pane(const void *a0, const void *b0)
 | 
					window_tree_cmp_pane(const void *a0, const void *b0)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const struct window_pane *const	*a = a0;
 | 
						struct window_pane	**a = (struct window_pane **)a0;
 | 
				
			||||||
	const struct window_pane *const	*b = b0;
 | 
						struct window_pane	**b = (struct window_pane **)b0;
 | 
				
			||||||
	int			  result;
 | 
						int			  result;
 | 
				
			||||||
 | 
						u_int			  ai, bi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (window_tree_sort->field == WINDOW_TREE_BY_TIME)
 | 
						if (window_tree_sort->field == WINDOW_TREE_BY_TIME)
 | 
				
			||||||
		result = (*a)->active_point - (*b)->active_point;
 | 
							result = (*a)->active_point - (*b)->active_point;
 | 
				
			||||||
@@ -283,7 +284,9 @@ window_tree_cmp_pane(const void *a0, const void *b0)
 | 
				
			|||||||
		 * Panes don't have names, so use number order for any other
 | 
							 * Panes don't have names, so use number order for any other
 | 
				
			||||||
		 * sort field.
 | 
							 * sort field.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		result = (*a)->id - (*b)->id;
 | 
							window_pane_index(*a, &ai);
 | 
				
			||||||
 | 
							window_pane_index(*b, &bi);
 | 
				
			||||||
 | 
							result = ai - bi;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (window_tree_sort->reversed)
 | 
						if (window_tree_sort->reversed)
 | 
				
			||||||
		result = -result;
 | 
							result = -result;
 | 
				
			||||||
@@ -1243,12 +1246,17 @@ window_tree_key(struct window_mode_entry *wme, struct client *c,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	item = mode_tree_get_current(data->data);
 | 
						item = mode_tree_get_current(data->data);
 | 
				
			||||||
	finished = mode_tree_key(data->data, c, &key, m, &x, &y);
 | 
						finished = mode_tree_key(data->data, c, &key, m, &x, &y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					again:
 | 
				
			||||||
	if (item != (new_item = mode_tree_get_current(data->data))) {
 | 
						if (item != (new_item = mode_tree_get_current(data->data))) {
 | 
				
			||||||
		item = new_item;
 | 
							item = new_item;
 | 
				
			||||||
		data->offset = 0;
 | 
							data->offset = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (KEYC_IS_MOUSE(key) && m != NULL)
 | 
						if (KEYC_IS_MOUSE(key) && m != NULL) {
 | 
				
			||||||
		key = window_tree_mouse(data, key, x, item);
 | 
							key = window_tree_mouse(data, key, x, item);
 | 
				
			||||||
 | 
							goto again;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (key) {
 | 
						switch (key) {
 | 
				
			||||||
	case '<':
 | 
						case '<':
 | 
				
			||||||
		data->offset--;
 | 
							data->offset--;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user