mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Sync OpenBSD patchset 250:
A tty context must not be modified as it may be reused to update multiple clients, so make it const. Also fix an actual modification which caused a hang when a session was connected to multiple terminals at least one of which was missing ich/ich1.
This commit is contained in:
		
							
								
								
									
										35
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								tmux.h
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| /* $Id: tmux.h,v 1.414 2009-08-14 21:23:20 tcunha Exp $ */ | ||||
| /* $Id: tmux.h,v 1.415 2009-08-14 21:30:24 tcunha Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -1166,22 +1166,23 @@ void	tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int); | ||||
| int	tty_open(struct tty *, const char *, char **); | ||||
| void	tty_close(struct tty *); | ||||
| void	tty_free(struct tty *); | ||||
| void	tty_write(void (*)(struct tty *, struct tty_ctx *), struct tty_ctx *); | ||||
| void	tty_cmd_alignmenttest(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_cell(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearendofline(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearendofscreen(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearline(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearscreen(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearstartofline(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_clearstartofscreen(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_deletecharacter(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_deleteline(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_insertcharacter(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_insertline(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_linefeed(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_utf8character(struct tty *, struct tty_ctx *); | ||||
| void	tty_cmd_reverseindex(struct tty *, struct tty_ctx *); | ||||
| void	tty_write(void (*)( | ||||
| 	    struct tty *, const struct tty_ctx *), const struct tty_ctx *); | ||||
| void	tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_cell(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearendofline(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearendofscreen(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearline(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearscreen(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearstartofline(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_clearstartofscreen(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_deletecharacter(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_deleteline(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_insertline(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_linefeed(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_utf8character(struct tty *, const struct tty_ctx *); | ||||
| void	tty_cmd_reverseindex(struct tty *, const struct tty_ctx *); | ||||
|  | ||||
| /* tty-term.c */ | ||||
| extern struct tty_terms tty_terms; | ||||
|   | ||||
							
								
								
									
										42
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								tty.c
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| /* $Id: tty.c,v 1.126 2009-08-14 21:24:46 tcunha Exp $ */ | ||||
| /* $Id: tty.c,v 1.127 2009-08-14 21:30:24 tcunha Exp $ */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> | ||||
| @@ -38,7 +38,7 @@ void	tty_attributes(struct tty *, const struct grid_cell *); | ||||
| void	tty_attributes_fg(struct tty *, const struct grid_cell *); | ||||
| void	tty_attributes_bg(struct tty *, const struct grid_cell *); | ||||
|  | ||||
| void	tty_redraw_region(struct tty *, struct tty_ctx *); | ||||
| void	tty_redraw_region(struct tty *, const struct tty_ctx *); | ||||
| void	tty_emulate_repeat( | ||||
| 	    struct tty *, enum tty_code_code, enum tty_code_code, u_int); | ||||
| void	tty_cell(struct tty *, | ||||
| @@ -471,7 +471,7 @@ tty_emulate_repeat( | ||||
|  * width of the terminal. | ||||
|  */ | ||||
| void | ||||
| tty_redraw_region(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
| 	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -542,7 +542,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_write(void (*cmdfn)(struct tty *, struct tty_ctx *), struct tty_ctx *ctx) | ||||
| tty_write(void (*cmdfn)( | ||||
|     struct tty *, const struct tty_ctx *), const struct tty_ctx *ctx) | ||||
| { | ||||
| 	struct window_pane	*wp = ctx->wp; | ||||
| 	struct client		*c; | ||||
| @@ -573,10 +574,11 @@ tty_write(void (*cmdfn)(struct tty *, struct tty_ctx *), struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_insertcharacter(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| 	u_int			 i; | ||||
|  | ||||
| 	if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { | ||||
| 		tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff); | ||||
| @@ -591,14 +593,14 @@ tty_cmd_insertcharacter(struct tty *tty, struct tty_ctx *ctx) | ||||
| 		tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num); | ||||
| 	else { | ||||
| 		tty_putcode(tty, TTYC_SMIR); | ||||
| 		while (ctx->num-- > 0) | ||||
| 		for (i = 0; i < ctx->num; i++) | ||||
| 			tty_putc(tty, ' '); | ||||
| 		tty_putcode(tty, TTYC_RMIR); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_deletecharacter(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -615,7 +617,7 @@ tty_cmd_deletecharacter(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_insertline(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_insertline(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -635,7 +637,7 @@ tty_cmd_insertline(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_deleteline(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -655,7 +657,7 @@ tty_cmd_deleteline(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearline(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearline(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -674,7 +676,7 @@ tty_cmd_clearline(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearendofline(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -693,7 +695,7 @@ tty_cmd_clearendofline(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	u_int		 	 i; | ||||
| @@ -711,7 +713,7 @@ tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_reverseindex(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -733,7 +735,7 @@ tty_cmd_reverseindex(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_linefeed(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -755,7 +757,7 @@ tty_cmd_linefeed(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearendofscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|   	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -790,7 +792,7 @@ tty_cmd_clearendofscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearstartofscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|  	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -819,7 +821,7 @@ tty_cmd_clearstartofscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_clearscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_clearscreen(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
|  	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -848,7 +850,7 @@ tty_cmd_clearscreen(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_alignmenttest(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
| 	struct window_pane	*wp = ctx->wp; | ||||
| 	struct screen		*s = wp->screen; | ||||
| @@ -866,7 +868,7 @@ tty_cmd_alignmenttest(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
| 	struct window_pane	*wp = ctx->wp; | ||||
|  | ||||
| @@ -876,7 +878,7 @@ tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx) | ||||
| } | ||||
|  | ||||
| void | ||||
| tty_cmd_utf8character(struct tty *tty, struct tty_ctx *ctx) | ||||
| tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx) | ||||
| { | ||||
| 	u_char	*ptr = ctx->ptr; | ||||
| 	size_t	 i; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tiago Cunha
					Tiago Cunha