mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Fix positioning of menu in choose modes and a couple of keys in tree mode.
This commit is contained in:
		
							
								
								
									
										4
									
								
								menu.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								menu.c
									
									
									
									
									
								
							@@ -295,6 +295,10 @@ menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2)
 | 
						if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2)
 | 
				
			||||||
		return (-1);
 | 
							return (-1);
 | 
				
			||||||
 | 
						if (px + menu->width + 4 > c->tty.sx)
 | 
				
			||||||
 | 
							px = c->tty.sx - menu->width - 4;
 | 
				
			||||||
 | 
						if (py + menu->count + 2 > c->tty.sy)
 | 
				
			||||||
 | 
							py = c->tty.sy - menu->count - 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	md = xcalloc(1, sizeof *md);
 | 
						md = xcalloc(1, sizeof *md);
 | 
				
			||||||
	md->item = item;
 | 
						md->item = item;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -847,6 +847,10 @@ mode_tree_display_menu(struct mode_tree_data *mtd, struct client *c, u_int x,
 | 
				
			|||||||
	mtm->itemdata = mti->itemdata;
 | 
						mtm->itemdata = mti->itemdata;
 | 
				
			||||||
	mtd->references++;
 | 
						mtd->references++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (x >= (menu->width + 4) / 2)
 | 
				
			||||||
 | 
							x -= (menu->width + 4) / 2;
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							x = 0;
 | 
				
			||||||
	if (menu_display(menu, 0, NULL, x, y, c, NULL, mode_tree_menu_callback,
 | 
						if (menu_display(menu, 0, NULL, x, y, c, NULL, mode_tree_menu_callback,
 | 
				
			||||||
	    mtm) != 0)
 | 
						    mtm) != 0)
 | 
				
			||||||
		menu_free(menu);
 | 
							menu_free(menu);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,8 +54,8 @@ static void		 window_tree_key(struct window_mode_entry *,
 | 
				
			|||||||
	"}"
 | 
						"}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct menu_item window_tree_menu_items[] = {
 | 
					static const struct menu_item window_tree_menu_items[] = {
 | 
				
			||||||
	{ "Select", 'E', NULL },
 | 
						{ "Select", '\r', NULL },
 | 
				
			||||||
	{ "Expand", 'R', NULL },
 | 
						{ "Expand", KEYC_RIGHT, NULL },
 | 
				
			||||||
	{ "", KEYC_NONE, NULL },
 | 
						{ "", KEYC_NONE, NULL },
 | 
				
			||||||
	{ "Tag", 't', NULL },
 | 
						{ "Tag", 't', NULL },
 | 
				
			||||||
	{ "Tag All", '\024', NULL },
 | 
						{ "Tag All", '\024', NULL },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user