Browse Source

Apparently \033 is more common than \x1b for ESC. Use the former in our

code for clarity.
tags/v0.99.beta17
Sam Hocevar sam 16 years ago
parent
commit
7b25d39e63
4 changed files with 14 additions and 14 deletions
  1. +5
    -5
      caca/codec/import.c
  2. +1
    -1
      caca/driver/win32.c
  3. +1
    -1
      caca/graphics.c
  4. +7
    -7
      src/cacaserver.c

+ 5
- 5
caca/codec/import.c View File

@@ -110,7 +110,7 @@ ssize_t caca_import_memory(caca_canvas_t *cv, void const *data,

/* If we find ESC[ argv, we guess it's an ANSI file */
for(i = 0; i + 1 < len; i++)
if((str[i] == 0x1b) && (str[i + 1] == '['))
if((str[i] == '\033') && (str[i + 1] == '['))
return import_ansi(cv, data, len, 0);

/* Otherwise, import it as text */
@@ -455,11 +455,11 @@ static ssize_t import_ansi(caca_canvas_t *cv, void const *data,

/* If there are not enough characters to parse the escape sequence,
* wait until the next try. We require 3. */
else if(buffer[i] == '\x1b' && i + 2 >= size)
else if(buffer[i] == '\033' && i + 2 >= size)
break;

/* XXX: What the fuck is this shit? */
else if(buffer[i] == '\x1b' && buffer[i + 1] == '('
else if(buffer[i] == '\033' && buffer[i + 1] == '('
&& buffer[i + 2] == 'B')
{
skip += 2;
@@ -467,7 +467,7 @@ static ssize_t import_ansi(caca_canvas_t *cv, void const *data,

/* Interpret escape commands, as per Standard ECMA-48 "Control
* Functions for Coded Character Sets", 5.4. Control sequences. */
else if(buffer[i] == '\x1b' && buffer[i + 1] == '[')
else if(buffer[i] == '\033' && buffer[i + 1] == '[')
{
unsigned int argc = 0, argv[101];
unsigned int param, inter, final;
@@ -641,7 +641,7 @@ static ssize_t import_ansi(caca_canvas_t *cv, void const *data,
}

/* Parse OSC stuff. */
else if(buffer[i] == '\x1b' && buffer[i + 1] == ']')
else if(buffer[i] == '\033' && buffer[i + 1] == ']')
{
char *string;
unsigned int command = 0;


+ 1
- 1
caca/driver/win32.c View File

@@ -284,7 +284,7 @@ static int win32_get_event(caca_display_t *dp, caca_privevent_t *ev)
{
case VK_TAB: ev->data.key.ch = '\t'; break;
case VK_RETURN: ev->data.key.ch = '\r'; break;
case VK_ESCAPE: ev->data.key.ch = '\x1b'; break;
case VK_ESCAPE: ev->data.key.ch = '\033'; break;
case VK_SPACE: ev->data.key.ch = ' '; break;
case VK_DELETE: ev->data.key.ch = '\x7f'; break;



+ 1
- 1
caca/graphics.c View File

@@ -261,7 +261,7 @@ void _caca_set_term_title(char const *str)
return;
#endif

fprintf(stdout, "\x1b]0;%s\x07", str);
fprintf(stdout, "\033]0;%s\007", str);
fflush(stdout);
}


+ 7
- 7
src/cacaserver.c View File

@@ -55,18 +55,18 @@
"\xff\xfd\x31" /* DO NAWS */ \
"\xff\x1f\xfa____" /* SB NAWS */ \
"\xff\xf0" /* SE */ \
"\x1b]2;caca for the network\x07" /* Change window title */ \
"\x1b[H\x1b[J" /* Clear screen */
/*"\x1b[?25l"*/ /* Hide cursor */
"\033]2;caca for the network\x07" /* Change window title */ \
"\033[H\033[J" /* Clear screen */
/*"\033[?25l"*/ /* Hide cursor */

#define ANSI_PREFIX \
"\x1b[1;1H" /* move(0,0) */ \
"\x1b[1;1H" /* move(0,0) again */
"\033[1;1H" /* move(0,0) */ \
"\033[1;1H" /* move(0,0) again */

#define ANSI_RESET \
" " /* Garbage */ \
"\x1b[?1049h" /* Clear screen */ \
"\x1b[?1049h" /* Clear screen again */
"\033[?1049h" /* Clear screen */ \
"\033[?1049h" /* Clear screen again */

static char const telnet_commands[16][5] =
{


Loading…
Cancel
Save