コード例 #1
0
ファイル: microrl.cpp プロジェクト: dekar/gsioc
//*****************************************************************************
static void terminal_reset_cursor (microrl_t * pThis)
{
	char str[16];
#ifdef _USE_LIBC_STDIO
	snprintf (str, 16, "\033[%dD\033[%dC", \
						_COMMAND_LINE_LEN + _PROMPT_LEN + 2, _PROMPT_LEN);

#else
	strcpy (str, "\033[");
	u16bit_to_str ( _COMMAND_LINE_LEN + _PROMPT_LEN + 2,str+2);
	strcat (str, "D\033[");
	u16bit_to_str (_PROMPT_LEN, str+strlen(str));
	strcat (str, "C");
#endif
	pThis->print (str);
}
コード例 #2
0
ファイル: microrl.c プロジェクト: Squonk42/nodelua
//*****************************************************************************
static void ICACHE_FLASH_ATTR terminal_reset_cursor (microrl_t * pThis)
{
	char str[16];
#ifdef _USE_LIBC_STDIO
	snprintf (str, 16, "\033[%dD\033[%dC", \
						_COMMAND_LINE_LEN + pThis->prompt_str_len + 2, pThis->prompt_str_len);

#else
	char *endstr;
	os_strcpy (str, "\033[");
	endstr = u16bit_to_str ( _COMMAND_LINE_LEN + pThis->prompt_str_len + 2,str+2);
	os_strcpy (endstr, "D\033["); endstr += 3;
	endstr = u16bit_to_str (pThis->prompt_str_len, endstr);
	os_strcpy (endstr, "C");
#endif
	pThis->print (str);
}
コード例 #3
0
//*****************************************************************************
static void terminal_reset_cursor (microrl_t * pThis)
{
	char str[16];
#ifdef _USE_LIBC_STDIO
	snprintf (str, 16, "\033[%dD\033[%dC", \
						_COMMAND_LINE_LEN + _PROMPT_LEN + 2, _PROMPT_LEN);

#else
	char *endstr;
	strcpy (str, "\033[");
	/* FixMe: Dirty hack, move current_prompt_len to pThis */
	endstr = u16bit_to_str ( _COMMAND_LINE_LEN + current_prompt_len + 2,str+2);
	strcpy (endstr, "D\033["); endstr += 3;
	endstr = u16bit_to_str (current_prompt_len, endstr);
	strcpy (endstr, "C");
#endif
	pThis->print (str);
}
コード例 #4
0
ファイル: microrl.cpp プロジェクト: dekar/gsioc
//*****************************************************************************
// set cursor at position from begin cmdline (after prompt) + offset
static void terminal_move_cursor (microrl_t * pThis, int offset)
{
	char str[16] = {0,};
#ifdef _USE_LIBC_STDIO
	if (offset > 0) {
		snprintf (str, 16, "\033[%dC", offset);
	} else if (offset < 0) {
		snprintf (str, 16, "\033[%dD", -(offset));
	}
#else
	strcpy (str, "\033[");
	if (offset > 0) {
		u16bit_to_str (offset, str+2);
		strcat (str, "C");
	} else if (offset < 0) {
		u16bit_to_str (-(offset), str+2);
		strcat (str, "D");
	} else
		return;
#endif
	pThis->print (str);
}