mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Change display-menu from taking a single string to a set of arguments,
which is much easier to work with. Based on a diff from Avi Halachmi.
This commit is contained in:
		
							
								
								
									
										51
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								format.c
									
									
									
									
									
								
							@@ -54,52 +54,6 @@ static void	 format_defaults_session(struct format_tree *,
 | 
			
		||||
static void	 format_defaults_client(struct format_tree *, struct client *);
 | 
			
		||||
static void	 format_defaults_winlink(struct format_tree *, struct winlink *);
 | 
			
		||||
 | 
			
		||||
/* Default menus. */
 | 
			
		||||
#define DEFAULT_CLIENT_MENU \
 | 
			
		||||
	"Detach,d,detach-client|" \
 | 
			
		||||
	"Detach & Kill,X,detach-client -P|" \
 | 
			
		||||
	"Detach Others,o,detach-client -a|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Lock,l,lock-client"
 | 
			
		||||
#define DEFAULT_SESSION_MENU \
 | 
			
		||||
	"Next,n,switch-client -n|" \
 | 
			
		||||
	"Previous,p,switch-client -p|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Renumber,N,move-window -r|" \
 | 
			
		||||
	"Rename,n,command-prompt -I \"#S\" \"rename-session -- '%%'\"|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"New Session,s,new-session|" \
 | 
			
		||||
	"New Window,w,new-window"
 | 
			
		||||
#define DEFAULT_WINDOW_MENU \
 | 
			
		||||
	"Swap Left,l,swap-window -t:-1|" \
 | 
			
		||||
	"Swap Right,r,swap-window -t:+1|" \
 | 
			
		||||
	"#{?pane_marked_set,,#[dim]}Swap Marked,s,swap-window|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Kill,X,kill-window|" \
 | 
			
		||||
	"Respawn,R,respawn-window -k|" \
 | 
			
		||||
	"#{?pane_marked,Unmark,Mark},m,select-pane -m|" \
 | 
			
		||||
	"Rename,n,command-prompt -I \"#W\" \"rename-window -- '%%'\"|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"New After,w,new-window -a|" \
 | 
			
		||||
	"New At End,W,new-window"
 | 
			
		||||
#define DEFAULT_PANE_MENU \
 | 
			
		||||
	"#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},},C-r,copy-mode -t=; send -Xt= search-backward \"#{q:mouse_word}\"|" \
 | 
			
		||||
	"#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},},C-y,send-keys -l \"#{q:mouse_word}\"|" \
 | 
			
		||||
	"#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},},c,set-buffer \"#{q:mouse_word}\"|" \
 | 
			
		||||
	"#{?mouse_line,Copy Line,},l,set-buffer \"#{q:mouse_line}\"|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Horizontal Split,h,split-window -h|" \
 | 
			
		||||
	"Vertical Split,v,split-window -v|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Swap Up,u,swap-pane -U|" \
 | 
			
		||||
	"Swap Down,d,swap-pane -D|" \
 | 
			
		||||
	"#{?pane_marked_set,,#[dim]}Swap Marked,s,swap-pane|" \
 | 
			
		||||
	"|" \
 | 
			
		||||
	"Kill,X,kill-pane|" \
 | 
			
		||||
	"Respawn,R,respawn-pane -k|" \
 | 
			
		||||
	"#{?pane_marked,Unmark,Mark},m,select-pane -m|" \
 | 
			
		||||
	"#{?window_zoomed_flag,Unzoom,Zoom},z,resize-pane -Z"
 | 
			
		||||
 | 
			
		||||
/* Entry in format job tree. */
 | 
			
		||||
struct format_job {
 | 
			
		||||
	struct client		*client;
 | 
			
		||||
@@ -944,11 +898,6 @@ format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "client_menu", "%s", DEFAULT_CLIENT_MENU);
 | 
			
		||||
	format_add(ft, "session_menu", "%s", DEFAULT_SESSION_MENU);
 | 
			
		||||
	format_add(ft, "window_menu", "%s", DEFAULT_WINDOW_MENU);
 | 
			
		||||
	format_add(ft, "pane_menu", "%s", DEFAULT_PANE_MENU);
 | 
			
		||||
 | 
			
		||||
	if (item != NULL)
 | 
			
		||||
		format_create_add_item(ft, item);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user