mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Change the behaviour of extended-keys always slightly so that
applications can still enter mode 2 if they want, they just cannot turn extended keys off entirely. From Stanislav Kljuhhin.
This commit is contained in:
		
							
								
								
									
										42
									
								
								input.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								input.c
									
									
									
									
									
								
							| @@ -1349,7 +1349,7 @@ input_csi_dispatch(struct input_ctx *ictx) | |||||||
| 	struct screen_write_ctx	       *sctx = &ictx->ctx; | 	struct screen_write_ctx	       *sctx = &ictx->ctx; | ||||||
| 	struct screen		       *s = sctx->s; | 	struct screen		       *s = sctx->s; | ||||||
| 	struct input_table_entry       *entry; | 	struct input_table_entry       *entry; | ||||||
| 	int				i, n, m; | 	int				i, n, m, ek; | ||||||
| 	u_int				cx, bg = ictx->cell.cell.bg; | 	u_int				cx, bg = ictx->cell.cell.bg; | ||||||
|  |  | ||||||
| 	if (ictx->flags & INPUT_DISCARD) | 	if (ictx->flags & INPUT_DISCARD) | ||||||
| @@ -1407,30 +1407,36 @@ input_csi_dispatch(struct input_ctx *ictx) | |||||||
| 		break; | 		break; | ||||||
| 	case INPUT_CSI_MODSET: | 	case INPUT_CSI_MODSET: | ||||||
| 		n = input_get(ictx, 0, 0, 0); | 		n = input_get(ictx, 0, 0, 0); | ||||||
| 		m = input_get(ictx, 1, 0, 0); | 		if (n != 4) | ||||||
| 		/* |  | ||||||
| 		 * Set the extended key reporting mode as per the client request, |  | ||||||
| 		 * unless "extended-keys always" forces us into mode 1. |  | ||||||
| 		 */ |  | ||||||
| 		if (options_get_number(global_options, "extended-keys") != 1) |  | ||||||
| 			break; | 			break; | ||||||
| 		screen_write_mode_clear(sctx, | 		m = input_get(ictx, 1, 0, 0); | ||||||
| 		    MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2); |  | ||||||
| 		if (n == 4 && m == 1) | 		/* | ||||||
| 			screen_write_mode_set(sctx, MODE_KEYS_EXTENDED); | 		 * Set the extended key reporting mode as per the client | ||||||
| 		if (n == 4 && m == 2) | 		 * request, unless "extended-keys" is set to "off". | ||||||
|  | 		 */ | ||||||
|  | 		ek = options_get_number(global_options, "extended-keys"); | ||||||
|  | 		if (ek == 0) | ||||||
|  | 			break; | ||||||
|  | 		screen_write_mode_clear(sctx, EXTENDED_KEY_MODES); | ||||||
|  | 		if (m == 2) | ||||||
| 			screen_write_mode_set(sctx, MODE_KEYS_EXTENDED_2); | 			screen_write_mode_set(sctx, MODE_KEYS_EXTENDED_2); | ||||||
|  | 		else if (m == 1 || ek == 2) | ||||||
|  | 			screen_write_mode_set(sctx, MODE_KEYS_EXTENDED); | ||||||
| 		break; | 		break; | ||||||
| 	case INPUT_CSI_MODOFF: | 	case INPUT_CSI_MODOFF: | ||||||
| 		n = input_get(ictx, 0, 0, 0); | 		n = input_get(ictx, 0, 0, 0); | ||||||
|  | 		if (n != 4) | ||||||
|  | 			break; | ||||||
|  |  | ||||||
| 		/* | 		/* | ||||||
| 		 * Clear the extended key reporting mode as per the client request, | 		 * Clear the extended key reporting mode as per the client | ||||||
| 		 * unless "extended-keys always" forces us into mode 1. | 		 * request, unless "extended-keys always" forces into mode 1. | ||||||
| 		 */ | 		 */ | ||||||
| 		if (n == 4) { | 		screen_write_mode_clear(sctx, | ||||||
| 			screen_write_mode_clear(sctx, | 		    MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2); | ||||||
| 			    MODE_KEYS_EXTENDED|MODE_KEYS_EXTENDED_2); | 		if (options_get_number(global_options, "extended-keys") == 2) | ||||||
| 		} | 			screen_write_mode_set(sctx, MODE_KEYS_EXTENDED); | ||||||
| 		break; | 		break; | ||||||
| 	case INPUT_CSI_WINOPS: | 	case INPUT_CSI_WINOPS: | ||||||
| 		input_csi_dispatch_winops(ictx); | 		input_csi_dispatch_winops(ictx); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm