static int term_7to8bit(char_u *p);
static void accept_modifiers_for_function_keys(void);
- // Change this to "if 1" to debug what happens with termresponse.
-# if 0
+# if 0 // Change to 1 to enable ch_log() calls for termresponse debugging.
# define DEBUG_TERMRESPONSE
-static void log_tr(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
-# define LOG_TR(msg) log_tr msg
+# define LOG_TR(fmt,...) \
+ ch_log(NULL, "TermResp: %s " fmt, \
+ must_redraw == UPD_NOT_VALID ? "NV" \
+ : must_redraw == UPD_CLEAR ? "CL" : " ", ##__VA_ARGS__)
# else
-# define LOG_TR(msg) do { /**/ } while (0)
+# define LOG_TR(fmt,...) do { /**/ } while (0)
# endif
#ifdef HAVE_TGETENT
{
int r = redraw_asap(UPD_CLEAR);
- log_tr("Received t_Co, redraw_asap(): %d", r);
+ LOG_TR("Received t_Co, redraw_asap(): %d", r);
}
#else
redraw_asap(UPD_CLEAR);
full_screen = TRUE; // we can use termcap codes from now on
set_term_defaults(); // use current values as defaults
#ifdef FEAT_TERMRESPONSE
- LOG_TR(("setting crv_status to STATUS_GET"));
+ LOG_TR("setting crv_status to STATUS_GET");
crv_status.tr_progress = STATUS_GET; // Get terminal version later
write_t_8u_state = FALSE;
#endif
&& *T_CRV != NUL)
{
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending CRV request"));
+ LOG_TR("Sending CRV request");
out_str(T_CRV);
termrequest_sent(&crv_status);
// check for the characters now, otherwise they might be eaten by
// changes cursor position, so it must be called immediately after
// entering termcap mode.
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending request for ambiwidth check"));
+ LOG_TR("Sending request for ambiwidth check");
// Do this in the second row. In the first row the returned sequence
// may be CSI 1;2R, which is the same as <S-F3>.
term_windgoto(1, 0);
// handles test sequence incorrectly, a garbage string is displayed and
// the cursor does move.
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending xterm compatibility test sequence."));
+ LOG_TR("Sending xterm compatibility test sequence.");
// Do this in the third row. Second row is used by ambiguous
// character width check.
term_windgoto(2, 0);
if (rfg_status.tr_progress == STATUS_GET && *T_RFG != NUL)
{
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending FG request"));
+ LOG_TR("Sending FG request");
out_str(T_RFG);
termrequest_sent(&rfg_status);
didit = TRUE;
if (rbg_status.tr_progress == STATUS_GET && *T_RBG != NUL)
{
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending BG request"));
+ LOG_TR("Sending BG request");
out_str(T_RBG);
termrequest_sent(&rbg_status);
didit = TRUE;
}
}
-# ifdef DEBUG_TERMRESPONSE
- static void
-log_tr(const char *fmt, ...)
-{
- static FILE *fd_tr = NULL;
- static proftime_T start;
- proftime_T now;
- va_list ap;
-
- if (fd_tr == NULL)
- {
- fd_tr = fopen("termresponse.log", "w");
- profile_start(&start);
- }
- now = start;
- profile_end(&now);
- fprintf(fd_tr, "%s: %s ", profile_msg(&now),
- must_redraw == UPD_NOT_VALID ? "NV"
- : must_redraw == UPD_CLEAR ? "CL" : " ");
- va_start(ap, fmt);
- vfprintf(fd_tr, fmt, ap);
- va_end(ap);
- fputc('\n', fd_tr);
- fflush(fd_tr);
-}
-# endif
#endif
/*
need_gather = TRUE; // need to fill termleader[]
}
detected_8bit = TRUE;
- LOG_TR(("Switching to 8 bit"));
+ LOG_TR("Switching to 8 bit");
}
#ifdef CHECK_DOUBLE_CLICK
{
char *aw = NULL;
- LOG_TR(("Received U7 status: %s", tp));
+ LOG_TR("Received U7 status: %s", tp);
u7_status.tr_progress = STATUS_GOT;
did_cursorhold = TRUE;
if (arg[1] == 2)
{
int r = redraw_asap(UPD_CLEAR);
- log_tr("set 'ambiwidth', redraw_asap(): %d", r);
+ LOG_TR("set 'ambiwidth', redraw_asap(): %d", r);
}
#else
redraw_asap(UPD_CLEAR);
{
int value;
- LOG_TR(("Received compatibility test result: %s", tp));
+ LOG_TR("Received compatibility test result: %s", tp);
xcc_status.tr_progress = STATUS_GOT;
// Third row: xterm compatibility test.
// version.
int version = arg[1];
- LOG_TR(("Received CRV response: %s", tp));
+ LOG_TR("Received CRV response: %s", tp);
crv_status.tr_progress = STATUS_GOT;
did_cursorhold = TRUE;
// terminals the request should be ignored.
if (version >= 141 && p_xtermcodes)
{
- LOG_TR(("Enable checking for XT codes"));
+ LOG_TR("Enable checking for XT codes");
check_for_codes = TRUE;
need_gather = TRUE;
req_codes_from_term();
&& *T_CRS != NUL)
{
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending cursor style request"));
+ LOG_TR("Sending cursor style request");
out_str(T_CRS);
termrequest_sent(&rcs_status);
need_flush = TRUE;
&& *T_CRC != NUL)
{
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Sending cursor blink mode request"));
+ LOG_TR("Sending cursor blink mode request");
out_str(T_CRC);
termrequest_sent(&rbm_status);
need_flush = TRUE;
{
initial_cursor_blink = (arg[1] == '1');
rbm_status.tr_progress = STATUS_GOT;
- LOG_TR(("Received cursor blinking mode response: %s", tp));
+ LOG_TR("Received cursor blinking mode response: %s", tp);
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
*slen = csi_len;
char *new_bg_val = (3 * '6' < *tp_r + *tp_g +
*tp_b) ? "light" : "dark";
- LOG_TR(("Received RBG response: %s", tp));
+ LOG_TR("Received RBG response: %s", tp);
#ifdef FEAT_TERMRESPONSE
rbg_status.tr_progress = STATUS_GOT;
# ifdef FEAT_TERMINAL
#if defined(FEAT_TERMRESPONSE) && defined(FEAT_TERMINAL)
else
{
- LOG_TR(("Received RFG response: %s", tp));
+ LOG_TR("Received RFG response: %s", tp);
rfg_status.tr_progress = STATUS_GOT;
fg_r = rval;
fg_g = gval;
}
if (i == len)
{
- LOG_TR(("not enough characters for RB"));
+ LOG_TR("not enough characters for RB");
return FAIL;
}
return OK;
{
int i, j;
- LOG_TR(("Received DCS response: %s", (char*)tp));
+ LOG_TR("Received DCS response: %s", (char*)tp);
j = 1 + (tp[0] == ESC);
if (len < j + 3)
i = len; // need more chars
(number & 1) ? FALSE : TRUE;
rcs_status.tr_progress = STATUS_GOT;
#endif
- LOG_TR(("Received cursor shape response: %s", tp));
+ LOG_TR("Received cursor shape response: %s", tp);
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
{
// These codes arrive many together, each code can be
// truncated at any point.
- LOG_TR(("not enough characters for XT"));
+ LOG_TR("not enough characters for XT");
return FAIL;
}
return OK;
{
#ifdef DEBUG_TERMRESPONSE
if (resp == -1)
- LOG_TR(("Not enough characters for CSI sequence"));
+ LOG_TR("Not enough characters for CSI sequence");
#endif
return resp;
}
}
#ifdef FEAT_TERMRESPONSE
- LOG_TR(("normal character"));
+ LOG_TR("normal character");
#endif
return 0; // no match found
char *key_name = key_names[xt_index_out];
MAY_WANT_TO_LOG_THIS;
- LOG_TR(("Requesting XT %d: %s", xt_index_out, key_name));
+ LOG_TR("Requesting XT %d: %s", xt_index_out, key_name);
if (key_name[2] != NUL)
sprintf(buf, "\033P+q%02x%02x%02x\033\\", key_name[0], key_name[1], key_name[2]);
else
}
}
- LOG_TR(("Received XT %d: %s", xt_index_in, (char *)name));
+ LOG_TR("Received XT %d: %s", xt_index_in, (char *)name);
if (key_names[i] != NULL)
{