mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	With -f use percentages of window size not pane size, GitHub issue 2866.
This commit is contained in:
		@@ -61,6 +61,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	struct client		*tc = cmdq_get_target_client(item);
 | 
						struct client		*tc = cmdq_get_target_client(item);
 | 
				
			||||||
	struct session		*s = target->s;
 | 
						struct session		*s = target->s;
 | 
				
			||||||
	struct winlink		*wl = target->wl;
 | 
						struct winlink		*wl = target->wl;
 | 
				
			||||||
 | 
						struct window		*w = wl->window;
 | 
				
			||||||
	struct window_pane	*wp = target->wp, *new_wp;
 | 
						struct window_pane	*wp = target->wp, *new_wp;
 | 
				
			||||||
	enum layout_type	 type;
 | 
						enum layout_type	 type;
 | 
				
			||||||
	struct layout_cell	*lc;
 | 
						struct layout_cell	*lc;
 | 
				
			||||||
@@ -87,10 +88,17 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
				cmdq_error(item, "percentage %s", errstr);
 | 
									cmdq_error(item, "percentage %s", errstr);
 | 
				
			||||||
				return (CMD_RETURN_ERROR);
 | 
									return (CMD_RETURN_ERROR);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (type == LAYOUT_TOPBOTTOM)
 | 
								if (args_has(args, 'f')) {
 | 
				
			||||||
				size = (wp->sy * percentage) / 100;
 | 
									if (type == LAYOUT_TOPBOTTOM)
 | 
				
			||||||
			else
 | 
										size = (w->sy * percentage) / 100;
 | 
				
			||||||
				size = (wp->sx * percentage) / 100;
 | 
									else
 | 
				
			||||||
 | 
										size = (w->sx * percentage) / 100;
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									if (type == LAYOUT_TOPBOTTOM)
 | 
				
			||||||
 | 
										size = (wp->sy * percentage) / 100;
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										size = (wp->sx * percentage) / 100;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			size = args_strtonum(args, 'l', 0, INT_MAX, &cause);
 | 
								size = args_strtonum(args, 'l', 0, INT_MAX, &cause);
 | 
				
			||||||
			if (cause != NULL) {
 | 
								if (cause != NULL) {
 | 
				
			||||||
@@ -106,10 +114,17 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
			free(cause);
 | 
								free(cause);
 | 
				
			||||||
			return (CMD_RETURN_ERROR);
 | 
								return (CMD_RETURN_ERROR);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (type == LAYOUT_TOPBOTTOM)
 | 
							if (args_has(args, 'f')) {
 | 
				
			||||||
			size = (wp->sy * percentage) / 100;
 | 
								if (type == LAYOUT_TOPBOTTOM)
 | 
				
			||||||
		else
 | 
									size = (w->sy * percentage) / 100;
 | 
				
			||||||
			size = (wp->sx * percentage) / 100;
 | 
								else
 | 
				
			||||||
 | 
									size = (w->sx * percentage) / 100;
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								if (type == LAYOUT_TOPBOTTOM)
 | 
				
			||||||
 | 
									size = (wp->sy * percentage) / 100;
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									size = (wp->sx * percentage) / 100;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		size = -1;
 | 
							size = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user