Compare commits

...

7 Commits

  1. 34
      src/bin/termio.c
  2. 2
      src/bin/termptyesc.c
  3. 8
      src/bin/tyalpha.c
  4. 4
      src/bin/tybg.c
  5. 16
      src/bin/tycat.c
  6. 6
      src/bin/tyls.c
  7. 7
      src/bin/typop.c
  8. 2
      src/bin/tyq.c

@ -3637,30 +3637,32 @@ _rep_mouse_down(Termio *sd, Evas_Event_Mouse_Down *ev, int cx, int cy)
buf[i++] = 0x80 + (v & 0x3f);
}
buf[i] = 0;
termpty_write(sd->pty, buf, strlen(buf));
termpty_write(sd->pty, buf, i);
ret = EINA_TRUE;
}
break;
case MOUSE_EXT_SGR: // ESC.[.<.NUM.;.NUM.;.NUM.M
{
int meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0;
int len;
if (btn > 2) btn = 0;
snprintf(buf, sizeof(buf), "%c[<%i;%i;%iM", 0x1b,
(btn | meta), cx + 1, cy + 1);
termpty_write(sd->pty, buf, strlen(buf));
len = snprintf(buf, sizeof(buf), "%c[<%i;%i;%iM", 0x1b,
(btn | meta), cx + 1, cy + 1);
termpty_write(sd->pty, buf, len);
ret = EINA_TRUE;
}
break;
case MOUSE_EXT_URXVT: // ESC.[.NUM.;.NUM.;.NUM.M
{
int meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0;
int len;
if (btn > 2) btn = 0;
snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b,
(btn | meta) + ' ',
cx + 1, cy + 1);
termpty_write(sd->pty, buf, strlen(buf));
len = snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b,
(btn | meta) + ' ',
cx + 1, cy + 1);
termpty_write(sd->pty, buf, len);
ret = EINA_TRUE;
}
break;
@ -5547,10 +5549,11 @@ _smart_pty_command(void *data)
if (ty->cur_cmd[1] == 's')
{
char buf[256];
int len;
snprintf(buf, sizeof(buf), "%i;%i;%i;%i\n",
sd->grid.w, sd->grid.h, sd->font.chw, sd->font.chh);
termpty_write(ty, buf, strlen(buf));
len = snprintf(buf, sizeof(buf), "%i;%i;%i;%i\n",
sd->grid.w, sd->grid.h, sd->font.chw, sd->font.chh);
termpty_write(ty, buf, len);
return;
}
else if (ty->cur_cmd[1] == 'j')
@ -5790,10 +5793,11 @@ _smart_pty_command(void *data)
if (ty->cur_cmd[1] == 's')
{
char buf[256];
int len;
snprintf(buf, sizeof(buf), "%i;%i;%i;%i\n",
sd->grid.w, sd->grid.h, sd->font.chw, sd->font.chh);
termpty_write(ty, buf, strlen(buf));
len = snprintf(buf, sizeof(buf), "%i;%i;%i;%i\n",
sd->grid.w, sd->grid.h, sd->font.chw, sd->font.chh);
termpty_write(ty, buf, len);
return;
}
else if (ty->cur_cmd[1] == 'j')
@ -5867,7 +5871,7 @@ _smart_cb_drop(void *data, Evas_Object *o EINA_UNUSED, Elm_Selection_Data *ev)
{
char *p, *p2, *p3, *tb;
tb = malloc(strlen(ev->data) + 1);
tb = malloc(ev->len + 1);
if (tb)
{
for (p = ev->data; p;)

@ -1506,7 +1506,7 @@ _handle_esc_terminology(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *
// commands are stored in the buffer, 0 bytes not allowed (end marker)
cmd = eina_unicode_unicode_to_utf8(buf, NULL);
ty->cur_cmd = cmd;
if ((!config->ty_escapes) || (!_termpty_ext_handle(ty, cmd, buf)))
if ((config->ty_escapes) && (!_termpty_ext_handle(ty, cmd, buf)))
{
if (ty->cb.command.func) ty->cb.command.func(ty->cb.command.data);
}

@ -11,6 +11,7 @@ int
main(int argc, char **argv)
{
int i, perm = 0;
int bytes;
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
@ -34,10 +35,11 @@ main(int argc, char **argv)
if (i >= argc) break;
}
if (perm)
snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
bytes = snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
else
snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
bytes = snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
bytes++;
if (write(STDIN_FILENO, tbuf, bytes) != bytes) perror("write");
}
return 0;
}

@ -29,7 +29,7 @@ main(int argc, char **argv)
{
char tbuf[32];
snprintf(tbuf, sizeof(tbuf), "%c}bt", 0x1b);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
return 0;
}
for (i = 1; i < argc; i++)
@ -48,7 +48,7 @@ main(int argc, char **argv)
snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path);
else
snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
}
return 0;
}

@ -86,17 +86,18 @@ prnt(const char *path, int w, int h, int mode)
{
int x, y, i;
char *line, buf[4096];
int bytes;
if ((w >= 512) || (h >= 512)) return;
line = malloc(w + 100);
if (!line) return;
if (mode == CENTER)
snprintf(buf, sizeof(buf), "%c}ic#%i;%i;%s", 0x1b, w, h, path);
bytes = snprintf(buf, sizeof(buf), "%c}ic#%i;%i;%s", 0x1b, w, h, path);
else if (mode == FILL)
snprintf(buf, sizeof(buf), "%c}if#%i;%i;%s", 0x1b, w, h, path);
bytes = snprintf(buf, sizeof(buf), "%c}if#%i;%i;%s", 0x1b, w, h, path);
else
snprintf(buf, sizeof(buf), "%c}is#%i;%i;%s", 0x1b, w, h, path);
if (write(0, buf, strlen(buf) + 1) < 0) perror("write");
bytes = snprintf(buf, sizeof(buf), "%c}is#%i;%i;%s", 0x1b, w, h, path);
if (write(STDIN_FILENO, buf, bytes + 1) < 0) perror("write");
i = 0;
line[i++] = 0x1b;
line[i++] = '}';
@ -112,7 +113,7 @@ prnt(const char *path, int w, int h, int mode)
line[i++] = '\n';
for (y = 0; y < h; y++)
{
if (write(0, line, i) < 0) perror("write");
if (write(STDIN_FILENO, line, i) < 0) perror("write");
}
free(line);
}
@ -309,6 +310,7 @@ main(int argc, char **argv)
int i;
char *rp;
Eina_List *file_q = NULL;
int bytes;
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
@ -333,8 +335,8 @@ main(int argc, char **argv)
if (!ee) goto shutdown;
evas = ecore_evas_get(ee);
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
if (write(0, buf, strlen(buf) + 1) < 0) perror("write");
bytes = snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
if (write(STDIN_FILENO, buf, bytes + 1) < 0) perror("write");
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4 ||
((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1)))
{

@ -759,9 +759,9 @@ main(int argc, char **argv)
evas = ecore_evas_get(ee);
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
len = strlen(buf);
if (write(0, buf, len + 1) < (signed)len + 1) perror("write");
len = snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
len++;
if (write(STDIN_FILENO, buf, len) < len) perror("write");
if ((scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4)
|| (tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1))
{

@ -10,7 +10,7 @@
int
main(int argc, char **argv)
{
int i;
int i, bytes;
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
@ -28,8 +28,9 @@ main(int argc, char **argv)
path = argv[i];
if (realpath(path, buf)) path = buf;
snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
bytes = snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path);
bytes++;
if (write(STDIN_FILENO, tbuf, bytes) != bytes) perror("write");
}
return 0;
}

@ -29,7 +29,7 @@ main(int argc, char **argv)
path = argv[i];
if (realpath(path, buf)) path = buf;
snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path);
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
if (write(STDIN_FILENO, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
}
return 0;
}

Loading…
Cancel
Save