mirror of
				https://github.com/vim/vim.git
				synced 2025-10-29 09:37:35 -04:00 
			
		
		
		
	patch 9.0.0988: using feedkeys() does not show up in a channel log
Problem: Using feedkeys() does not show up in a channel log. Solution: Add ch_log() calls and clean up the code.
This commit is contained in:
		| @@ -4343,7 +4343,6 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
|     int		context = FALSE; |     int		context = FALSE; | ||||||
|     int		dangerous = FALSE; |     int		dangerous = FALSE; | ||||||
|     int		lowlevel = FALSE; |     int		lowlevel = FALSE; | ||||||
|     char_u	*keys_esc; |  | ||||||
|  |  | ||||||
|     // This is not allowed in the sandbox.  If the commands would still be |     // This is not allowed in the sandbox.  If the commands would still be | ||||||
|     // executed in the sandbox it would be OK, but it probably happens later, |     // executed in the sandbox it would be OK, but it probably happens later, | ||||||
| @@ -4378,17 +4377,13 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (*keys != NUL || execute) |     if (*keys != NUL || execute) | ||||||
|     { |  | ||||||
| 	// Need to escape K_SPECIAL and CSI before putting the string in the |  | ||||||
| 	// typeahead buffer. |  | ||||||
| 	keys_esc = vim_strsave_escape_csi(keys); |  | ||||||
| 	if (keys_esc != NULL) |  | ||||||
|     { |     { | ||||||
| 	if (lowlevel) | 	if (lowlevel) | ||||||
| 	{ | 	{ | ||||||
| #ifdef USE_INPUT_BUF | #ifdef USE_INPUT_BUF | ||||||
| 		int len = (int)STRLEN(keys); | 	    ch_log(NULL, "feedkeys() lowlevel: %s", keys); | ||||||
|  |  | ||||||
|  | 	    int len = (int)STRLEN(keys); | ||||||
| 	    for (int idx = 0; idx < len; ++idx) | 	    for (int idx = 0; idx < len; ++idx) | ||||||
| 	    { | 	    { | ||||||
| 		// if a CTRL-C was typed, set got_int, similar to what | 		// if a CTRL-C was typed, set got_int, similar to what | ||||||
| @@ -4403,6 +4398,14 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
|  | 	    // Need to escape K_SPECIAL and CSI before putting the string in | ||||||
|  | 	    // the typeahead buffer. | ||||||
|  | 	    char_u *keys_esc = vim_strsave_escape_csi(keys); | ||||||
|  | 	    if (keys_esc == NULL) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	    ch_log(NULL, "feedkeys(%s): %s", typed ? "typed" : "", keys); | ||||||
|  |  | ||||||
| 	    ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), | 	    ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), | ||||||
| 				   insert ? 0 : typebuf.tb_len, !typed, FALSE); | 				   insert ? 0 : typebuf.tb_len, !typed, FALSE); | ||||||
| 	    if (vgetc_busy | 	    if (vgetc_busy | ||||||
| @@ -4411,8 +4414,9 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
| #endif | #endif | ||||||
| 		    || input_busy) | 		    || input_busy) | ||||||
| 		typebuf_was_filled = TRUE; | 		typebuf_was_filled = TRUE; | ||||||
| 	    } |  | ||||||
| 	    vim_free(keys_esc); | 	    vim_free(keys_esc); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (execute) | 	if (execute) | ||||||
| 	{ | 	{ | ||||||
| @@ -4422,6 +4426,8 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
| 	    // Avoid a 1 second delay when the keys start Insert mode. | 	    // Avoid a 1 second delay when the keys start Insert mode. | ||||||
| 	    msg_scroll = FALSE; | 	    msg_scroll = FALSE; | ||||||
|  |  | ||||||
|  | 	    ch_log(NULL, "feedkeys() executing"); | ||||||
|  |  | ||||||
| 	    if (context) | 	    if (context) | ||||||
| 	    { | 	    { | ||||||
| 		save_sctx = current_sctx; | 		save_sctx = current_sctx; | ||||||
| @@ -4448,7 +4454,6 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) | |||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * "fnameescape({string})" function |  * "fnameescape({string})" function | ||||||
|   | |||||||
| @@ -695,6 +695,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     988, | ||||||
| /**/ | /**/ | ||||||
|     987, |     987, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user