forked from enlightenment/terminology
termptyesc: support DECSED3 to erase the backlog. Closes T3713
This commit is contained in:
parent
e5f3676e32
commit
99f55b7bbc
|
@ -980,30 +980,56 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
|
|||
termpty_write(ty, bf, strlen(bf));
|
||||
}
|
||||
break;
|
||||
case 'J': // "2j" erases the screen, 1j erase from screen start to curs, 0j erase cursor to end of screen
|
||||
DBG("2j erases the screen, 1j erase from screen start to curs, 0j erase cursor to end of screen");
|
||||
arg = _csi_arg_get(&b);
|
||||
if (b)
|
||||
case 'J':
|
||||
if (*b == '?')
|
||||
{
|
||||
if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
|
||||
termpty_clear_screen(ty, arg);
|
||||
else
|
||||
WRN("invalid clr scr %i", arg);
|
||||
b++;
|
||||
arg = _csi_arg_get(&b);
|
||||
WRN("Unsupported selected erase in display %d", arg);
|
||||
}
|
||||
else
|
||||
termpty_clear_screen(ty, TERMPTY_CLR_END);
|
||||
arg = _csi_arg_get(&b);
|
||||
if (arg < 1) arg = 0;
|
||||
/* 3J erases the backlog,
|
||||
* 2J erases the screen,
|
||||
* 1J erase from screen start to cursor,
|
||||
* 0J erase form cursor to end of screen
|
||||
*/
|
||||
DBG("ED/DECSED %d: erase in display", arg);
|
||||
switch (arg)
|
||||
{
|
||||
case TERMPTY_CLR_END:
|
||||
case TERMPTY_CLR_BEGIN:
|
||||
case TERMPTY_CLR_ALL:
|
||||
termpty_clear_screen(ty, arg);
|
||||
break;
|
||||
case 3:
|
||||
termpty_clear_backlog(ty);
|
||||
break;
|
||||
default:
|
||||
ERR("invalid EL/DECSEL argument %d", arg);
|
||||
}
|
||||
break;
|
||||
case 'K': // 0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line
|
||||
arg = _csi_arg_get(&b);
|
||||
DBG("0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line: %d", arg);
|
||||
if (b)
|
||||
if (*b == '?')
|
||||
{
|
||||
if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
|
||||
termpty_clear_line(ty, arg, ty->w);
|
||||
else
|
||||
WRN("invalid clr lin %i", arg);
|
||||
b++;
|
||||
arg = _csi_arg_get(&b);
|
||||
WRN("Unsupported selected erase in line %d", arg);
|
||||
}
|
||||
arg = _csi_arg_get(&b);
|
||||
if (arg < 1) arg = 0;
|
||||
DBG("EL/DECSEL %d: erase in line", arg);
|
||||
switch (arg)
|
||||
{
|
||||
case TERMPTY_CLR_END:
|
||||
case TERMPTY_CLR_BEGIN:
|
||||
case TERMPTY_CLR_ALL:
|
||||
termpty_clear_line(ty, arg, ty->w);
|
||||
break;
|
||||
default:
|
||||
ERR("invalid EL/DECSEL argument %d", arg);
|
||||
}
|
||||
else termpty_clear_line(ty, TERMPTY_CLR_END, ty->w);
|
||||
break;
|
||||
case 'h':
|
||||
case 'l':
|
||||
|
|
|
@ -275,6 +275,29 @@ termpty_clear_tabs_on_screen(Termpty *ty)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
termpty_clear_backlog(Termpty *ty)
|
||||
{
|
||||
int backsize;
|
||||
|
||||
ty->backlog_beacon.screen_y = 0;
|
||||
ty->backlog_beacon.backlog_y = 0;
|
||||
|
||||
termpty_backlog_lock();
|
||||
if (ty->back)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < ty->backsize; i++)
|
||||
termpty_save_free(&ty->back[i]);
|
||||
free(ty->back);
|
||||
ty->back = NULL;
|
||||
}
|
||||
ty->backpos = 0;
|
||||
backsize = ty->backsize;
|
||||
ty->backsize = 0;
|
||||
termpty_backlog_size_set(ty, backsize);
|
||||
termpty_backlog_unlock();
|
||||
}
|
||||
|
||||
void
|
||||
termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
|
||||
|
@ -370,7 +393,6 @@ termpty_reset_att(Termatt *att)
|
|||
void
|
||||
termpty_reset_state(Termpty *ty)
|
||||
{
|
||||
int backsize;
|
||||
int i;
|
||||
|
||||
ty->cursor_state.cx = 0;
|
||||
|
@ -403,24 +425,7 @@ termpty_reset_state(Termpty *ty)
|
|||
ty->mouse_ext = MOUSE_EXT_NONE;
|
||||
ty->bracketed_paste = 0;
|
||||
|
||||
ty->backlog_beacon.screen_y = 0;
|
||||
ty->backlog_beacon.backlog_y = 0;
|
||||
|
||||
termpty_backlog_lock();
|
||||
if (ty->back)
|
||||
{
|
||||
size_t j;
|
||||
for (j = 0; j < ty->backsize; j++)
|
||||
termpty_save_free(&ty->back[j]);
|
||||
free(ty->back);
|
||||
ty->back = NULL;
|
||||
}
|
||||
ty->backpos = 0;
|
||||
backsize = ty->backsize;
|
||||
ty->backsize = 0;
|
||||
termpty_backlog_size_set(ty, backsize);
|
||||
termpty_backlog_unlock();
|
||||
|
||||
termpty_clear_backlog(ty);
|
||||
termpty_clear_tabs_on_screen(ty);
|
||||
for (i = 0; i < ty->w; i += TAB_WIDTH)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@ void termpty_reset_att(Termatt *att);
|
|||
void termpty_reset_state(Termpty *ty);
|
||||
void termpty_cursor_copy(Termpty *ty, Eina_Bool save);
|
||||
void termpty_clear_tabs_on_screen(Termpty *ty);
|
||||
void termpty_clear_backlog(Termpty *ty);
|
||||
|
||||
#define _term_txt_write(ty, txt) termpty_write(ty, txt, sizeof(txt) - 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue