billiob pushed a commit to branch master.
commit b6d2b1b4ad6c15bbed089cd9bfec3588a0102be7
Author: Boris Faure <[email protected]>
Date: Thu May 2 10:24:57 2013 +0200
revert a bunch of commits that weren't ready for prime time
664c5a23: Revert "compat: csi parameters are always decimal"
3694c88c: Revert "compat: handle cursor-controls chars in ESC sequences"
16e143f9: Revert "compat: add margin top support on Origin mode"
4daccf1f: Revert "compat: add ugly testing code to change between 80/132
cols"
d5be8a64: Revert "add termio_win_get();"
cff21ea5: Revert "compat: only clear cells when scrolling to add text"
13a11e5a: Revert "compat: add some csi dec private modes TODOs"
65f07f77: Revert "handle DCS status string requests"
---
src/bin/termio.c | 10 ---
src/bin/termio.h | 1 -
src/bin/termpty.h | 7 --
src/bin/termptyesc.c | 229 ++++++++++++++-------------------------------------
src/bin/termptyops.c | 26 +++---
src/bin/termptyops.h | 8 +-
6 files changed, 76 insertions(+), 205 deletions(-)
diff --git a/src/bin/termio.c b/src/bin/termio.c
index f761858..9a7d7fc 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -4282,16 +4282,6 @@ termio_textgrid_get(Evas_Object *obj)
return sd->grid.obj;
}
-Evas_Object *
-termio_win_get(Evas_Object *obj)
-{
- Termio *sd = evas_object_smart_data_get(obj);
- if (!sd) return NULL;
-
- return sd->win;
-}
-
-
static void
_smart_mirror_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void
*info __UNUSED__)
{
diff --git a/src/bin/termio.h b/src/bin/termio.h
index edfa211..1dc07d3 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -22,7 +22,6 @@ void termio_grid_size_set(Evas_Object *obj, int w,
int h);
pid_t termio_pid_get(const Evas_Object *obj);
Eina_Bool termio_cwd_get(const Evas_Object *obj, char *buf, size_t size);
Evas_Object *termio_textgrid_get(Evas_Object *obj);
-Evas_Object *termio_win_get(Evas_Object *obj);
Evas_Object *termio_mirror_add(Evas_Object *obj);
const char *termio_title_get(Evas_Object *obj);
const char *termio_icon_name_get(Evas_Object *obj);
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 9e84f98..47d74dd 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -36,9 +36,6 @@ typedef struct _Termexp Termexp;
//#define SUPPORT_ITALIC 1
#define SUPPORT_DBLWIDTH 1
-// Only for testing purpose
-//#define SUPPORT_80_132_COLUMNS 1
-
struct _Termatt
{
unsigned char fg, bg;
@@ -63,9 +60,6 @@ struct _Termatt
unsigned short autowrapped : 1;
unsigned short newline : 1;
unsigned short tab : 1;
-#if defined(SUPPORT_80_132_COLUMNS)
- unsigned short is_80_132_mode_allowed : 1;
-#endif
};
struct _Termstate
@@ -77,7 +71,6 @@ struct _Termstate
unsigned char chset[4];
int scroll_y1, scroll_y2;
int had_cr_x, had_cr_y;
- int margin_top; // soon, more to come...
unsigned int multibyte : 1;
unsigned int alt_kp : 1;
unsigned int insert : 1;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 38109a1..5528351 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -5,9 +5,6 @@
#include "termptyesc.h"
#include "termptyops.h"
#include "termptyext.h"
-#if defined(SUPPORT_80_132_COLUMNS)
-#include "termio.h"
-#endif
#undef CRITICAL
#undef ERR
@@ -33,6 +30,7 @@ static int
_csi_arg_get(Eina_Unicode **ptr)
{
Eina_Unicode *b = *ptr;
+ int octal = 0;
int sum = 0;
while ((*b) && (!isdigit(*b))) b++;
@@ -41,9 +39,11 @@ _csi_arg_get(Eina_Unicode **ptr)
*ptr = NULL;
return 0;
}
+ if (*b == '0') octal = 1;
while (isdigit(*b))
{
- sum *= 10;
+ if (octal) sum *= 8;
+ else sum *= 10;
sum += *b - '0';
b++;
}
@@ -51,63 +51,6 @@ _csi_arg_get(Eina_Unicode **ptr)
return sum;
}
-static void
-_handle_cursor_control(Termpty *ty, Eina_Unicode *cc)
-{
- switch (*cc)
- {
- case 0x07: // BEL '\a' (bell)
- if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
- ty->state.had_cr = 0;
- return;
- case 0x08: // BS '\b' (backspace)
- DBG("->BS");
- ty->state.wrapnext = 0;
- ty->state.cx--;
- if (ty->state.cx < 0) ty->state.cx = 0;
- ty->state.had_cr = 0;
- return;
- case 0x09: // HT '\t' (horizontal tab)
- DBG("->HT");
- TERMPTY_SCREEN(ty, ty->state.cx, ty->state.cy).att.tab = 1;
- ty->state.wrapnext = 0;
- ty->state.cx += 8;
- ty->state.cx = (ty->state.cx / 8) * 8;
- if (ty->state.cx >= ty->w)
- ty->state.cx = ty->w - 1;
- ty->state.had_cr = 0;
- return;
- case 0x0a: // LF '\n' (new line)
- case 0x0b: // VT '\v' (vertical tab)
- case 0x0c: // FF '\f' (form feed)
- DBG("->LF");
- if (ty->state.had_cr)
- {
- TERMPTY_SCREEN(ty, ty->state.had_cr_x,
- ty->state.had_cr_y).att.newline = 1;
- }
- ty->state.wrapnext = 0;
- if (ty->state.crlf) ty->state.cx = 0;
- ty->state.cy++;
- _termpty_text_scroll_test(ty, EINA_TRUE);
- ty->state.had_cr = 0;
- return;
- case 0x0d: // CR '\r' (carriage ret)
- DBG("->CR");
- if (ty->state.cx != 0)
- {
- ty->state.had_cr_x = ty->state.cx;
- ty->state.had_cr_y = ty->state.cy;
- }
- ty->state.wrapnext = 0;
- ty->state.cx = 0;
- ty->state.had_cr = 1;
- return;
- default:
- return;
- }
-}
-
static int
_handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
{
@@ -117,9 +60,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
cc = (Eina_Unicode *)c;
b = buf;
- while ((cc < ce) && (*cc <= '?'))
+ while ((cc < ce) && (*cc >= '0') && (*cc <= '?'))
{
- _handle_cursor_control(ty, cc);
*b = *cc;
b++;
cc++;
@@ -127,7 +69,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
if (cc == ce) return 0;
*b = 0;
b = buf;
- DBG(" CSI: '%c' args '%s'", *cc, (char *) buf);
+// DBG(" CSI: '%c' args '%s'", *cc, buf);
switch (*cc)
{
case 'm': // color set
@@ -367,7 +309,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
for (i = 0; i < arg; i++)
{
ty->state.cy--;
- _termpty_text_scroll_rev_test(ty, EINA_FALSE);
+ _termpty_text_scroll_rev_test(ty);
}
break;
case 'B': // cursor down N
@@ -377,7 +319,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
for (i = 0; i < arg; i++)
{
ty->state.cy++;
- _termpty_text_scroll_test(ty, EINA_FALSE);
+ _termpty_text_scroll_test(ty);
}
break;
case 'D': // cursor left N
@@ -416,9 +358,9 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
arg--;
if (arg < 0) arg = 0;
else if (arg >= ty->h) arg = ty->h - 1;
+ if (b) ty->state.cy = arg;
if (b)
{
- ty->state.cy = arg;
arg = _csi_arg_get(&b);
if (arg < 1) arg = 1;
arg--;
@@ -428,7 +370,6 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
else if (arg >= ty->w) arg = ty->w - 1;
if (b) ty->state.cx = arg;
}
- ty->state.cy += ty->state.margin_top;
break;
case 'G': // to column N
arg = _csi_arg_get(&b);
@@ -472,12 +413,12 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
case 'S': // scroll up N lines
arg = _csi_arg_get(&b);
if (arg < 1) arg = 1;
- for (i = 0; i < arg; i++) _termpty_text_scroll(ty, EINA_FALSE);
+ for (i = 0; i < arg; i++) _termpty_text_scroll(ty);
break;
case 'T': // scroll down N lines
arg = _csi_arg_get(&b);
if (arg < 1) arg = 1;
- for (i = 0; i < arg; i++) _termpty_text_scroll_rev(ty, EINA_FALSE);
+ for (i = 0; i < arg; i++) _termpty_text_scroll_rev(ty);
break;
case 'M': // delete N lines - cy
case 'L': // insert N lines - cy
@@ -501,8 +442,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
if (arg < 1) arg = 1;
for (i = 0; i < arg; i++)
{
- if (*cc == 'M') _termpty_text_scroll(ty, EINA_TRUE);
- else _termpty_text_scroll_rev(ty, EINA_TRUE);
+ if (*cc == 'M') _termpty_text_scroll(ty);
+ else _termpty_text_scroll_rev(ty);
}
ty->state.scroll_y1 = sy1;
ty->state.scroll_y2 = sy2;
@@ -607,29 +548,13 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
handled = 1;
ty->state.kbd_lock = mode;
break;
- case 3: // 132 column mode⦠should we handle
this?
+ case 3: // should we handle this?
handled = 1;
-#if defined(SUPPORT_80_132_COLUMNS)
- if (ty->state.att.is_80_132_mode_allowed)
- {
- /* ONLY FOR TESTING PURPOSE FTM */
- Evas_Object *wn;
- int w, h;
-
- wn = termio_win_get(ty->obj);
- elm_win_size_step_get(wn, &w, &h);
- evas_object_resize(wn,
- 2 + (mode ? 132 : 80)
* w,
- 2 + 24 * h);
- termpty_resize(ty, mode ? 132 : 80, 24);
- _termpty_reset_state(ty);
- _termpty_clear_screen(ty,
TERMPTY_CLR_ALL);
- }
-#endif
+ ERR("XXX: 132 column mode %i", mode);
break;
case 4:
handled = 1;
- ERR("TODO: set insert mode to %i", mode);
+ ERR("XXX: set insert mode to %i", mode);
break;
case 5:
handled = 1;
@@ -637,24 +562,11 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
break;
case 6:
handled = 1;
- if (mode)
- {
- ty->state.margin_top = ty->state.cy;
- ty->state.cx = 0;
- }
- else
- {
- ty->state.cx = 0;
- ty->state.margin_top = 0;
- }
- DBG("XXX: origin mode (%d): cursor is at 0,0"
- "cursor limited to screen/start point"
- " for line #'s depends on top margin",
- mode);
+ ERR("XXX: origin mode: cursor is at
0,0/cursor limited to screen/start point for line #'s depends on top margin");
break;
case 7:
handled = 1;
- DBG("XXX: set wrap mode to %i", mode);
+ DBG("DDD: set wrap mode to %i", mode);
ty->state.wrap = mode;
break;
case 8:
@@ -704,17 +616,6 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
handled = 1;
// INF("XXX: switch to tek window %i", mode);
break;
- case 40:
- handled = 1;
- // INF("XXX: Allow 80 -> 132 Mode %i", mode);
-#if defined(SUPPORT_80_132_COLUMNS)
- ty->state.att.is_80_132_mode_allowed = mode;
-#endif
- break;
- case 45: // ignore
- handled = 1;
- INF("TODO: Reverse-wraparound Mode");
- break;
case 59: // ignore
handled = 1;
// INF("XXX: kanji terminal mode %i", mode);
@@ -1114,8 +1015,7 @@ _handle_esc_dcs(Termpty *ty __UNUSED__, const
Eina_Unicode *c, const Eina_Unicod
{
const Eina_Unicode *cc, *be;
Eina_Unicode buf[4096], *b;
- int len;
-
+
cc = c;
b = buf;
be = buf + sizeof(buf) / sizeof(buf[0]);
@@ -1130,12 +1030,11 @@ _handle_esc_dcs(Termpty *ty __UNUSED__, const
Eina_Unicode *c, const Eina_Unicod
b++;
cc++;
}
- len = cc - c;
if (b == be)
- {
+ {
ERR("dcs parsing overflowed (binary data?)");
- goto end;
- }
+ return cc - c;
+ }
*b = 0;
if ((*cc == ST) || (*cc == '\\')) cc++;
else return 0;
@@ -1144,51 +1043,12 @@ _handle_esc_dcs(Termpty *ty __UNUSED__, const
Eina_Unicode *c, const Eina_Unicod
case '+':
/* TODO: Set request termcap/terminfo */
break;
- case '$':
- /* Request status string */
- if (len > 1 && buf[1] != 'q')
- {
- ERR("invalid/unhandled dsc esc '$%c' (expected '$q')", buf[1]);
- goto end;
- }
- if (len < 4)
- goto end;
- switch (buf[2])
- {
- case '"':
- if (buf[3] == 'p') /* DECSCL */
- {
- char bf[32];
- snprintf(bf, sizeof(bf), "\033P1$r64;1\"p\033\\");
- termpty_write(ty, bf, strlen(bf));
- }
- else if (buf[3] == 'q') /* DECSCA */
- {
- /* TODO: */
- }
- else
- {
- ERR("invalid/unhandled dsc esc '$q\"%c'", buf[3]);
- goto end;
- }
- break;
- case 'm': /* SGR */
- /* TODO: */
- case 'r': /* DECSTBM */
- /* TODO: */
- default:
- ERR("unhandled dsc request status string '$q%c'", buf[2]);
- goto end;
- }
- /* TODO */
- break;
default:
// many others
ERR("unhandled dcs esc '%c'", buf[0]);
break;
}
-end:
- return len;
+ return cc - c;
}
static int
@@ -1225,18 +1085,18 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
case 'M': // move to prev line
ty->state.wrapnext = 0;
ty->state.cy--;
- _termpty_text_scroll_rev_test(ty, EINA_FALSE);
+ _termpty_text_scroll_rev_test(ty);
return 1;
case 'D': // move to next line
ty->state.wrapnext = 0;
ty->state.cy++;
- _termpty_text_scroll_test(ty, EINA_FALSE);
+ _termpty_text_scroll_test(ty);
return 1;
case 'E': // add \n\r
ty->state.wrapnext = 0;
ty->state.cx = 0;
ty->state.cy++;
- _termpty_text_scroll_test(ty, EINA_FALSE);
+ _termpty_text_scroll_test(ty);
return 1;
case 'Z': // same a 'ESC [ Pn c'
_term_txt_write(ty, "\033[?1;2C");
@@ -1370,13 +1230,48 @@ _termpty_handle_seq(Termpty *ty, Eina_Unicode *c,
Eina_Unicode *ce)
return 1;
*/
case 0x07: // BEL '\a' (bell)
+ if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
+ ty->state.had_cr = 0;
+ return 1;
case 0x08: // BS '\b' (backspace)
+ DBG("->BS");
+ ty->state.wrapnext = 0;
+ ty->state.cx--;
+ if (ty->state.cx < 0) ty->state.cx = 0;
+ ty->state.had_cr = 0;
+ return 1;
case 0x09: // HT '\t' (horizontal tab)
+ DBG("->HT");
+ TERMPTY_SCREEN(ty, ty->state.cx, ty->state.cy).att.tab = 1;
+ ty->state.wrapnext = 0;
+ ty->state.cx += 8;
+ ty->state.cx = (ty->state.cx / 8) * 8;
+ if (ty->state.cx >= ty->w)
+ ty->state.cx = ty->w - 1;
+ ty->state.had_cr = 0;
+ return 1;
case 0x0a: // LF '\n' (new line)
case 0x0b: // VT '\v' (vertical tab)
case 0x0c: // FF '\f' (form feed)
+ DBG("->LF");
+ if (ty->state.had_cr)
+ TERMPTY_SCREEN(ty, ty->state.had_cr_x,
ty->state.had_cr_y).att.newline = 1;
+ ty->state.wrapnext = 0;
+ if (ty->state.crlf) ty->state.cx = 0;
+ ty->state.cy++;
+ _termpty_text_scroll_test(ty);
+ ty->state.had_cr = 0;
+ return 1;
case 0x0d: // CR '\r' (carriage ret)
- _handle_cursor_control(ty, c);
+ DBG("->CR");
+ if (ty->state.cx != 0)
+ {
+ ty->state.had_cr_x = ty->state.cx;
+ ty->state.had_cr_y = ty->state.cy;
+ }
+ ty->state.wrapnext = 0;
+ ty->state.cx = 0;
+ ty->state.had_cr = 1;
return 1;
case 0x0e: // SO (shift out) // Maps G1 character set into GL.
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 1561b2a..8c3f2b7 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -55,7 +55,7 @@ termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t
w_max)
}
void
-_termpty_text_scroll(Termpty *ty, Eina_Bool clear)
+_termpty_text_scroll(Termpty *ty)
{
Termcell *cells = NULL, *cells2;
int y, start_y = 0, end_y = ty->h - 1;
@@ -78,9 +78,6 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
}
DBG("... scroll!!!!! [%i->%i]", start_y, end_y);
- if (!clear)
- return;
-
if (start_y == 0 && end_y == ty->h - 1)
{
// screen is a circular buffer now
@@ -89,7 +86,7 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
ty->circular_offset++;
if (ty->circular_offset >= ty->h)
- ty->circular_offset = 0;
+ ty->circular_offset = 0;
}
else
{
@@ -105,7 +102,7 @@ _termpty_text_scroll(Termpty *ty, Eina_Bool clear)
}
void
-_termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
+_termpty_text_scroll_rev(Termpty *ty)
{
Termcell *cells, *cells2 = NULL;
int y, start_y = 0, end_y = ty->h - 1;
@@ -117,15 +114,12 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
}
DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y);
- if (!clear)
- return;
-
if (start_y == 0 && end_y == ty->h - 1)
{
// screen is a circular buffer now
ty->circular_offset--;
if (ty->circular_offset < 0)
- ty->circular_offset = ty->h - 1;
+ ty->circular_offset = ty->h - 1;
cells = &(ty->screen[ty->circular_offset * ty->w]);
_text_clear(ty, cells, ty->w, 0, EINA_TRUE);
@@ -145,27 +139,27 @@ _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
}
void
-_termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
+_termpty_text_scroll_test(Termpty *ty)
{
int e = ty->h;
if (ty->state.scroll_y2 != 0) e = ty->state.scroll_y2;
if (ty->state.cy >= e)
{
- _termpty_text_scroll(ty, clear);
+ _termpty_text_scroll(ty);
ty->state.cy = e - 1;
}
}
void
-_termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear)
+_termpty_text_scroll_rev_test(Termpty *ty)
{
int b = 0;
- if (ty->state.scroll_y1 != 0) b = ty->state.scroll_y1;
+ if (ty->state.scroll_y2 != 0) b = ty->state.scroll_y1;
if (ty->state.cy < b)
{
- _termpty_text_scroll_rev(ty, clear);
+ _termpty_text_scroll_rev(ty);
ty->state.cy = b;
}
}
@@ -187,7 +181,7 @@ _termpty_text_append(Termpty *ty, const Eina_Unicode
*codepoints, int len)
ty->state.wrapnext = 0;
ty->state.cx = 0;
ty->state.cy++;
- _termpty_text_scroll_test(ty, EINA_TRUE);
+ _termpty_text_scroll_test(ty);
cells = &(TERMPTY_SCREEN(ty, 0, ty->state.cy));
}
if (ty->state.insert)
diff --git a/src/bin/termptyops.h b/src/bin/termptyops.h
index 8d11a41..3358602 100644
--- a/src/bin/termptyops.h
+++ b/src/bin/termptyops.h
@@ -7,10 +7,10 @@ typedef enum _Termpty_Clear
void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max);
void _termpty_text_copy(Termpty *ty, Termcell *cells, Termcell *dest, int
count);
-void _termpty_text_scroll(Termpty *ty, Eina_Bool clear);
-void _termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear);
-void _termpty_text_scroll_test(Termpty *ty, Eina_Bool clear);
-void _termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear);
+void _termpty_text_scroll(Termpty *ty);
+void _termpty_text_scroll_rev(Termpty *ty);
+void _termpty_text_scroll_test(Termpty *ty);
+void _termpty_text_scroll_rev_test(Termpty *ty);
void _termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int
len);
void _termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit);
void _termpty_clear_screen(Termpty *ty, Termpty_Clear mode);
--
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1