mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
Conflicts: server-client.c
This commit is contained in:
		@@ -190,7 +190,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
 | 
				
			|||||||
	/* Change the option. */
 | 
						/* Change the option. */
 | 
				
			||||||
	if (args_has(args, 'u')) {
 | 
						if (args_has(args, 'u')) {
 | 
				
			||||||
		if (o == NULL)
 | 
							if (o == NULL)
 | 
				
			||||||
			goto fail;
 | 
								goto out;
 | 
				
			||||||
		if (idx == -1) {
 | 
							if (idx == -1) {
 | 
				
			||||||
			if (oo == global_options ||
 | 
								if (oo == global_options ||
 | 
				
			||||||
			    oo == global_s_options ||
 | 
								    oo == global_s_options ||
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								input.c
									
									
									
									
									
								
							@@ -433,7 +433,7 @@ static const struct input_state input_state_rename_string = {
 | 
				
			|||||||
/* consume_st state definition. */
 | 
					/* consume_st state definition. */
 | 
				
			||||||
static const struct input_state input_state_consume_st = {
 | 
					static const struct input_state input_state_consume_st = {
 | 
				
			||||||
	"consume_st",
 | 
						"consume_st",
 | 
				
			||||||
	NULL, NULL,
 | 
						input_enter_rename, NULL, /* rename also waits for ST */
 | 
				
			||||||
	input_state_consume_st_table
 | 
						input_state_consume_st_table
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -138,12 +138,17 @@ void
 | 
				
			|||||||
key_bindings_remove_table(const char *name)
 | 
					key_bindings_remove_table(const char *name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct key_table	*table;
 | 
						struct key_table	*table;
 | 
				
			||||||
 | 
						struct client		*c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	table = key_bindings_get_table(name, 0);
 | 
						table = key_bindings_get_table(name, 0);
 | 
				
			||||||
	if (table != NULL) {
 | 
						if (table != NULL) {
 | 
				
			||||||
		RB_REMOVE(key_tables, &key_tables, table);
 | 
							RB_REMOVE(key_tables, &key_tables, table);
 | 
				
			||||||
		key_bindings_unref_table(table);
 | 
							key_bindings_unref_table(table);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						TAILQ_FOREACH(c, &clients, entry) {
 | 
				
			||||||
 | 
							if (c->keytable == table)
 | 
				
			||||||
 | 
								server_client_set_key_table(c, NULL);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								mode-tree.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								mode-tree.c
									
									
									
									
									
								
							@@ -127,6 +127,17 @@ mode_tree_free_items(struct mode_tree_list *mtl)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					mode_tree_check_selected(struct mode_tree_data *mtd)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * If the current line would now be off screen reset the offset to the
 | 
				
			||||||
 | 
						 * last visible line.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						if (mtd->current > mtd->height - 1)
 | 
				
			||||||
 | 
							mtd->offset = mtd->current - mtd->height + 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
mode_tree_clear_lines(struct mode_tree_data *mtd)
 | 
					mode_tree_clear_lines(struct mode_tree_data *mtd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -192,7 +203,7 @@ mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag)
 | 
				
			|||||||
	if (i != mtd->line_size) {
 | 
						if (i != mtd->line_size) {
 | 
				
			||||||
		mtd->current = i;
 | 
							mtd->current = i;
 | 
				
			||||||
		if (mtd->current > mtd->height - 1)
 | 
							if (mtd->current > mtd->height - 1)
 | 
				
			||||||
			mtd->offset = 1 + mtd->current - mtd->height;
 | 
								mtd->offset = mtd->current - mtd->height + 1;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			mtd->offset = 0;
 | 
								mtd->offset = 0;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@@ -361,6 +372,7 @@ mode_tree_build(struct mode_tree_data *mtd)
 | 
				
			|||||||
			mtd->height = screen_size_y(s);
 | 
								mtd->height = screen_size_y(s);
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		mtd->height = screen_size_y(s);
 | 
							mtd->height = screen_size_y(s);
 | 
				
			||||||
 | 
						mode_tree_check_selected(mtd);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
@@ -792,7 +804,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
 | 
				
			|||||||
	case KEYC_END:
 | 
						case KEYC_END:
 | 
				
			||||||
		mtd->current = mtd->line_size - 1;
 | 
							mtd->current = mtd->line_size - 1;
 | 
				
			||||||
		if (mtd->current > mtd->height - 1)
 | 
							if (mtd->current > mtd->height - 1)
 | 
				
			||||||
			mtd->offset = mtd->current - mtd->height;
 | 
								mtd->offset = mtd->current - mtd->height + 1;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			mtd->offset = 0;
 | 
								mtd->offset = 0;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
@@ -870,15 +882,8 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
 | 
				
			|||||||
	case 'v':
 | 
						case 'v':
 | 
				
			||||||
		mtd->preview = !mtd->preview;
 | 
							mtd->preview = !mtd->preview;
 | 
				
			||||||
		mode_tree_build(mtd);
 | 
							mode_tree_build(mtd);
 | 
				
			||||||
 | 
							if (mtd->preview)
 | 
				
			||||||
		/*
 | 
								mode_tree_check_selected(mtd);
 | 
				
			||||||
		 * If the current line would now be off screen now the preview
 | 
					 | 
				
			||||||
		 * is on, reset the the offset to the last visible line.
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		if (mtd->preview && mtd->current > mtd->height - 1) {
 | 
					 | 
				
			||||||
			mtd->offset = mtd->current - mtd->height;
 | 
					 | 
				
			||||||
			mtd->current--;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return (0);
 | 
						return (0);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user