mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Fix line numbers - commands are added after the line ends so they need to
get line - 1.
This commit is contained in:
		
							
								
								
									
										1
									
								
								cfg.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								cfg.c
									
									
									
									
									
								
							@@ -126,6 +126,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
 | 
				
			|||||||
	memset(&pi, 0, sizeof pi);
 | 
						memset(&pi, 0, sizeof pi);
 | 
				
			||||||
	pi.flags = flags;
 | 
						pi.flags = flags;
 | 
				
			||||||
	pi.file = path;
 | 
						pi.file = path;
 | 
				
			||||||
 | 
						pi.line = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pr = cmd_parse_from_file(f, &pi);
 | 
						pr = cmd_parse_from_file(f, &pi);
 | 
				
			||||||
	fclose(f);
 | 
						fclose(f);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -356,7 +356,7 @@ command		: assignment TOKEN
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			$$ = xcalloc(1, sizeof *$$);
 | 
								$$ = xcalloc(1, sizeof *$$);
 | 
				
			||||||
			$$->name = $2;
 | 
								$$->name = $2;
 | 
				
			||||||
			$$->line = ps->input->line;
 | 
								$$->line = ps->input->line - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		| assignment TOKEN arguments
 | 
							| assignment TOKEN arguments
 | 
				
			||||||
@@ -365,7 +365,7 @@ command		: assignment TOKEN
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			$$ = xcalloc(1, sizeof *$$);
 | 
								$$ = xcalloc(1, sizeof *$$);
 | 
				
			||||||
			$$->name = $2;
 | 
								$$->name = $2;
 | 
				
			||||||
			$$->line = ps->input->line;
 | 
								$$->line = ps->input->line - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$$->argc = $3.argc;
 | 
								$$->argc = $3.argc;
 | 
				
			||||||
			$$->argv = $3.argv;
 | 
								$$->argv = $3.argv;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user