Merge branch 'terminology-1.1'
This commit is contained in:
commit
9abf652003
|
@ -1332,7 +1332,6 @@ termpty_resize(Termpty *ty, int new_w, int new_h)
|
||||||
|
|
||||||
ty->w = new_w;
|
ty->w = new_w;
|
||||||
ty->h = new_h;
|
ty->h = new_h;
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
|
|
||||||
if (altbuf)
|
if (altbuf)
|
||||||
|
|
|
@ -146,7 +146,6 @@ struct _Termpty
|
||||||
unsigned int wrap : 1;
|
unsigned int wrap : 1;
|
||||||
unsigned int wrapnext : 1;
|
unsigned int wrapnext : 1;
|
||||||
unsigned int crlf : 1;
|
unsigned int crlf : 1;
|
||||||
unsigned int had_cr : 1;
|
|
||||||
unsigned int send_bs : 1;
|
unsigned int send_bs : 1;
|
||||||
unsigned int kbd_lock : 1;
|
unsigned int kbd_lock : 1;
|
||||||
unsigned int reverse : 1;
|
unsigned int reverse : 1;
|
||||||
|
|
|
@ -150,18 +150,22 @@ _tab_forward(Termpty *ty, int n)
|
||||||
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cursor_to_start_of_line(Termpty *ty)
|
||||||
|
{
|
||||||
|
ty->cursor_state.cx = ty->termstate.left_margin;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
|
_handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
|
||||||
{
|
{
|
||||||
switch (*cc)
|
switch (*cc)
|
||||||
{
|
{
|
||||||
case 0x07: // BEL '\a' (bell)
|
case 0x07: // BEL '\a' (bell)
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
|
if (ty->cb.bell.func) ty->cb.bell.func(ty->cb.bell.data);
|
||||||
return;
|
return;
|
||||||
case 0x08: // BS '\b' (backspace)
|
case 0x08: // BS '\b' (backspace)
|
||||||
DBG("->BS");
|
DBG("->BS");
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
ty->cursor_state.cx--;
|
ty->cursor_state.cx--;
|
||||||
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
||||||
|
@ -169,20 +173,14 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
|
||||||
case 0x09: // HT '\t' (horizontal tab)
|
case 0x09: // HT '\t' (horizontal tab)
|
||||||
DBG("->HT");
|
DBG("->HT");
|
||||||
_tab_forward(ty, 1);
|
_tab_forward(ty, 1);
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
return;
|
return;
|
||||||
case 0x0a: // LF '\n' (new line)
|
case 0x0a: // LF '\n' (new line)
|
||||||
case 0x0b: // VT '\v' (vertical tab)
|
case 0x0b: // VT '\v' (vertical tab)
|
||||||
case 0x0c: // FF '\f' (form feed)
|
case 0x0c: // FF '\f' (form feed)
|
||||||
DBG("->LF");
|
DBG("->LF");
|
||||||
if (ty->termstate.had_cr)
|
|
||||||
{
|
|
||||||
TERMPTY_SCREEN(ty, ty->termstate.had_cr_x,
|
|
||||||
ty->termstate.had_cr_y).att.newline = 1;
|
|
||||||
}
|
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
if (ty->termstate.crlf) ty->cursor_state.cx = 0;
|
if (ty->termstate.crlf)
|
||||||
|
_cursor_to_start_of_line(ty);
|
||||||
ty->cursor_state.cy++;
|
ty->cursor_state.cy++;
|
||||||
termpty_text_scroll_test(ty, EINA_TRUE);
|
termpty_text_scroll_test(ty, EINA_TRUE);
|
||||||
return;
|
return;
|
||||||
|
@ -194,8 +192,7 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
|
||||||
ty->termstate.had_cr_y = ty->cursor_state.cy;
|
ty->termstate.had_cr_y = ty->cursor_state.cy;
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
}
|
}
|
||||||
ty->cursor_state.cx = 0;
|
_cursor_to_start_of_line(ty);
|
||||||
// ty->termstate.had_cr = 1;
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -2083,7 +2080,6 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
/*
|
/*
|
||||||
case 0x05: // ENQ (enquiry)
|
case 0x05: // ENQ (enquiry)
|
||||||
_term_txt_write(ty, "ABC\r\n");
|
_term_txt_write(ty, "ABC\r\n");
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -2101,13 +2097,11 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case 0x0e: // SO (shift out) // Maps G1 character set into GL.
|
case 0x0e: // SO (shift out) // Maps G1 character set into GL.
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.charset = 1;
|
ty->termstate.charset = 1;
|
||||||
ty->termstate.charsetch = ty->termstate.chset[1];
|
ty->termstate.charsetch = ty->termstate.chset[1];
|
||||||
return 1;
|
return 1;
|
||||||
case 0x0f: // SI (shift in) // Maps G0 character set into GL.
|
case 0x0f: // SI (shift in) // Maps G0 character set into GL.
|
||||||
ty->termstate.charset = 0;
|
ty->termstate.charset = 0;
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.charsetch = ty->termstate.chset[0];
|
ty->termstate.charsetch = ty->termstate.chset[0];
|
||||||
return 1;
|
return 1;
|
||||||
/*
|
/*
|
||||||
|
@ -2135,7 +2129,6 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
return 1;
|
return 1;
|
||||||
*/
|
*/
|
||||||
case 0x1b: // ESC (escape)
|
case 0x1b: // ESC (escape)
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
len = _handle_esc(ty, c + 1, ce);
|
len = _handle_esc(ty, c + 1, ce);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
return 1 + len;
|
return 1 + len;
|
||||||
|
@ -2150,20 +2143,17 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
return 1;
|
return 1;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
//ERR("unhandled char 0x%02x", c[0]);
|
//ERR("unhandled char 0x%02x", c[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c[0] == 0x7f) // DEL
|
else if (c[0] == 0x7f) // DEL
|
||||||
{
|
{
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
WRN("Unhandled char 0x%02x [DEL]", (unsigned int) c[0]);
|
WRN("Unhandled char 0x%02x [DEL]", (unsigned int) c[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (c[0] == 0x9b) // ANSI ESC!!!
|
else if (c[0] == 0x9b) // ANSI ESC!!!
|
||||||
{
|
{
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
DBG("ANSI CSI!!!!!");
|
DBG("ANSI CSI!!!!!");
|
||||||
len = _handle_esc_csi(ty, c + 1, ce);
|
len = _handle_esc_csi(ty, c + 1, ce);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
|
@ -2173,8 +2163,7 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
{
|
{
|
||||||
Termexp *ex;
|
Termexp *ex;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
EINA_LIST_FOREACH(ty->block.expecting, l, ex)
|
EINA_LIST_FOREACH(ty->block.expecting, l, ex)
|
||||||
{
|
{
|
||||||
if (c[0] == ex->ch)
|
if (c[0] == ex->ch)
|
||||||
|
@ -2206,10 +2195,6 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
termpty_text_append(ty, c, 1);
|
termpty_text_append(ty, c, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
}
|
|
||||||
cc = (Eina_Unicode *)c;
|
cc = (Eina_Unicode *)c;
|
||||||
DBG("txt: [");
|
DBG("txt: [");
|
||||||
while ((cc < ce) && (*cc >= 0x20) && (*cc != 0x7f))
|
while ((cc < ce) && (*cc >= 0x20) && (*cc != 0x7f))
|
||||||
|
@ -2220,6 +2205,5 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
|
||||||
}
|
}
|
||||||
DBG("]");
|
DBG("]");
|
||||||
termpty_text_append(ty, c, len);
|
termpty_text_append(ty, c, len);
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,17 @@ termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
|
||||||
{
|
{
|
||||||
int e = ty->h;
|
int e = ty->h;
|
||||||
|
|
||||||
if (ty->termstate.bottom_margin != 0) e = ty->termstate.bottom_margin;
|
if (ty->termstate.bottom_margin != 0)
|
||||||
if (ty->cursor_state.cy >= e)
|
{
|
||||||
|
e = ty->termstate.bottom_margin;
|
||||||
|
if (ty->cursor_state.cy == e)
|
||||||
|
{
|
||||||
|
termpty_text_scroll(ty, clear);
|
||||||
|
ty->cursor_state.cy = e - 1;
|
||||||
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (ty->cursor_state.cy >= ty->h)
|
||||||
{
|
{
|
||||||
termpty_text_scroll(ty, clear);
|
termpty_text_scroll(ty, clear);
|
||||||
ty->cursor_state.cy = e - 1;
|
ty->cursor_state.cy = e - 1;
|
||||||
|
@ -439,7 +448,6 @@ termpty_reset_state(Termpty *ty)
|
||||||
ty->termstate.wrap = 1;
|
ty->termstate.wrap = 1;
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
ty->termstate.crlf = 0;
|
ty->termstate.crlf = 0;
|
||||||
ty->termstate.had_cr = 0;
|
|
||||||
ty->termstate.send_bs = 0;
|
ty->termstate.send_bs = 0;
|
||||||
ty->termstate.reverse = 0;
|
ty->termstate.reverse = 0;
|
||||||
ty->termstate.no_autorepeat = 0;
|
ty->termstate.no_autorepeat = 0;
|
||||||
|
|
Loading…
Reference in New Issue