2012-07-13 01:46:33 -07:00
|
|
|
#include "private.h"
|
|
|
|
#include <Elementary.h>
|
2013-11-10 13:13:19 -08:00
|
|
|
#include "termio.h"
|
2012-07-13 01:46:33 -07:00
|
|
|
#include "termpty.h"
|
|
|
|
#include "termptydbl.h"
|
|
|
|
#include "termptyops.h"
|
|
|
|
#include "termptygfx.h"
|
2013-05-03 19:44:20 -07:00
|
|
|
#include "termptysave.h"
|
2014-05-03 13:16:27 -07:00
|
|
|
#include "miniview.h"
|
2015-06-02 13:48:50 -07:00
|
|
|
#include <assert.h>
|
2012-07-13 01:46:33 -07:00
|
|
|
|
|
|
|
#undef CRITICAL
|
|
|
|
#undef ERR
|
|
|
|
#undef WRN
|
|
|
|
#undef INF
|
|
|
|
#undef DBG
|
|
|
|
|
|
|
|
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_termpty_log_dom, __VA_ARGS__)
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(_termpty_log_dom, __VA_ARGS__)
|
|
|
|
#define WRN(...) EINA_LOG_DOM_WARN(_termpty_log_dom, __VA_ARGS__)
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(_termpty_log_dom, __VA_ARGS__)
|
|
|
|
#define DBG(...) EINA_LOG_DOM_DBG(_termpty_log_dom, __VA_ARGS__)
|
|
|
|
|
2015-06-01 13:52:07 -07:00
|
|
|
void
|
|
|
|
termpty_cells_clear(Termpty *ty, Termcell *cells, int count)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2013-01-22 21:11:29 -08:00
|
|
|
Termcell src;
|
2012-07-13 01:46:33 -07:00
|
|
|
|
2013-01-29 07:54:47 -08:00
|
|
|
memset(&src, 0, sizeof(src));
|
2015-06-01 13:52:07 -07:00
|
|
|
src.codepoint = 0;
|
|
|
|
src.att = ty->termstate.att;
|
2013-01-29 07:54:47 -08:00
|
|
|
termpty_cell_fill(ty, &src, cells, count);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll(Termpty *ty, Eina_Bool clear)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2013-01-20 02:48:17 -08:00
|
|
|
Termcell *cells = NULL, *cells2;
|
|
|
|
int y, start_y = 0, end_y = ty->h - 1;
|
2012-07-13 01:46:33 -07:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.scroll_y2 != 0)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
start_y = ty->termstate.scroll_y1;
|
|
|
|
end_y = ty->termstate.scroll_y2 - 1;
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
else
|
2013-11-10 13:13:19 -08:00
|
|
|
if (!ty->altbuf)
|
|
|
|
termpty_text_save_top(ty, &(TERMPTY_SCREEN(ty, 0, 0)), ty->w);
|
|
|
|
|
2013-11-18 13:30:26 -08:00
|
|
|
termio_scroll(ty->obj, -1, start_y, end_y);
|
2012-07-13 01:46:33 -07:00
|
|
|
DBG("... scroll!!!!! [%i->%i]", start_y, end_y);
|
2013-01-21 06:02:32 -08:00
|
|
|
|
|
|
|
if (start_y == 0 && end_y == ty->h - 1)
|
|
|
|
{
|
|
|
|
// screen is a circular buffer now
|
2013-11-10 13:13:19 -08:00
|
|
|
cells = &(ty->screen[ty->circular_offset * ty->w]);
|
2013-05-27 13:10:18 -07:00
|
|
|
if (clear)
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w);
|
2013-01-21 06:02:32 -08:00
|
|
|
|
|
|
|
ty->circular_offset++;
|
|
|
|
if (ty->circular_offset >= ty->h)
|
2013-04-18 14:12:15 -07:00
|
|
|
ty->circular_offset = 0;
|
2013-01-21 06:02:32 -08:00
|
|
|
}
|
|
|
|
else
|
2013-01-20 02:48:17 -08:00
|
|
|
{
|
2013-11-17 08:25:09 -08:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, end_y));
|
2014-06-09 05:03:25 -07:00
|
|
|
for (y = start_y; y < end_y; y++)
|
2013-04-06 12:16:38 -07:00
|
|
|
{
|
2013-11-17 08:25:09 -08:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, (y + 1)));
|
|
|
|
cells2 = &(TERMPTY_SCREEN(ty, 0, y));
|
2013-11-10 13:13:19 -08:00
|
|
|
termpty_cell_copy(ty, cells, cells2, ty->w);
|
2013-04-06 12:16:38 -07:00
|
|
|
}
|
2013-05-27 13:10:18 -07:00
|
|
|
if (clear)
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w);
|
2013-01-20 02:48:17 -08:00
|
|
|
}
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2013-01-20 02:48:17 -08:00
|
|
|
Termcell *cells, *cells2 = NULL;
|
|
|
|
int y, start_y = 0, end_y = ty->h - 1;
|
2012-07-13 01:46:33 -07:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.scroll_y2 != 0)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
start_y = ty->termstate.scroll_y1;
|
|
|
|
end_y = ty->termstate.scroll_y2 - 1;
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
DBG("... scroll rev!!!!! [%i->%i]", start_y, end_y);
|
2013-11-18 13:30:26 -08:00
|
|
|
termio_scroll(ty->obj, 1, start_y, end_y);
|
2013-01-21 06:02:32 -08:00
|
|
|
|
|
|
|
if (start_y == 0 && end_y == ty->h - 1)
|
2013-01-20 02:48:17 -08:00
|
|
|
{
|
2013-01-21 06:02:32 -08:00
|
|
|
// screen is a circular buffer now
|
|
|
|
ty->circular_offset--;
|
|
|
|
if (ty->circular_offset < 0)
|
2013-04-18 14:12:15 -07:00
|
|
|
ty->circular_offset = ty->h - 1;
|
2013-01-21 06:02:32 -08:00
|
|
|
|
|
|
|
cells = &(ty->screen[ty->circular_offset * ty->w]);
|
2013-05-27 13:10:18 -07:00
|
|
|
if (clear)
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w);
|
2013-01-21 06:02:32 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, end_y));
|
|
|
|
for (y = end_y; y > start_y; y--)
|
2013-04-06 12:16:38 -07:00
|
|
|
{
|
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, (y - 1)));
|
|
|
|
cells2 = &(TERMPTY_SCREEN(ty, 0, y));
|
|
|
|
termpty_cell_copy(ty, cells, cells2, ty->w);
|
|
|
|
}
|
2013-05-27 13:10:18 -07:00
|
|
|
if (clear)
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w);
|
2013-01-20 02:48:17 -08:00
|
|
|
}
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll_test(Termpty *ty, Eina_Bool clear)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
int e = ty->h;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.scroll_y2 != 0) e = ty->termstate.scroll_y2;
|
|
|
|
if (ty->cursor_state.cy >= e)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll(ty, clear);
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->cursor_state.cy = e - 1;
|
2015-06-02 13:48:50 -07:00
|
|
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll_rev_test(Termpty *ty, Eina_Bool clear)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
int b = 0;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.scroll_y1 != 0) b = ty->termstate.scroll_y1;
|
|
|
|
if (ty->cursor_state.cy < b)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll_rev(ty, clear);
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->cursor_state.cy = b;
|
2015-06-02 13:48:50 -07:00
|
|
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cy, 0, ty->h);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
Termcell *cells;
|
|
|
|
int i, j;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
termio_content_change(ty->obj, ty->cursor_state.cx, ty->cursor_state.cy, len);
|
2013-11-11 09:08:02 -08:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy));
|
2012-07-13 01:46:33 -07:00
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
{
|
|
|
|
Eina_Unicode g;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.wrapnext)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2014-01-06 12:43:53 -08:00
|
|
|
cells[ty->w - 1].att.autowrapped = 1;
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->termstate.wrapnext = 0;
|
|
|
|
ty->cursor_state.cx = 0;
|
|
|
|
ty->cursor_state.cy++;
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_text_scroll_test(ty, EINA_TRUE);
|
2015-04-19 10:59:29 -07:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy));
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->termstate.insert)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
for (j = ty->w - 1; j > ty->cursor_state.cx; j--)
|
2013-01-29 07:54:47 -08:00
|
|
|
termpty_cell_copy(ty, &(cells[j - 1]), &(cells[j]), 1);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
g = _termpty_charset_trans(codepoints[i], ty);
|
2014-04-06 05:42:38 -07:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
termpty_cell_codepoint_att_fill(ty, g, ty->termstate.att,
|
|
|
|
&(cells[ty->cursor_state.cx]), 1);
|
2012-07-13 01:46:33 -07:00
|
|
|
#if defined(SUPPORT_DBLWIDTH)
|
2015-04-19 10:59:29 -07:00
|
|
|
cells[ty->cursor_state.cx].att.dblwidth = _termpty_is_dblwidth_get(ty, g);
|
|
|
|
if (EINA_UNLIKELY((cells[ty->cursor_state.cx].att.dblwidth) && (ty->cursor_state.cx < (ty->w - 1))))
|
2013-04-15 07:53:28 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
TERMPTY_FMTCLR(cells[ty->cursor_state.cx].att);
|
|
|
|
termpty_cell_codepoint_att_fill(ty, 0, cells[ty->cursor_state.cx].att,
|
|
|
|
&(cells[ty->cursor_state.cx + 1]), 1);
|
2013-04-15 07:53:28 -07:00
|
|
|
}
|
2015-04-19 10:59:29 -07:00
|
|
|
#endif
|
|
|
|
if (ty->termstate.wrap)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2013-10-28 02:55:53 -07:00
|
|
|
unsigned char offset = 1;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->termstate.wrapnext = 0;
|
2012-07-13 01:46:33 -07:00
|
|
|
#if defined(SUPPORT_DBLWIDTH)
|
2015-04-19 10:59:29 -07:00
|
|
|
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
2013-10-28 02:55:53 -07:00
|
|
|
offset = 2;
|
2012-07-13 01:46:33 -07:00
|
|
|
#endif
|
2015-04-19 10:59:29 -07:00
|
|
|
if (EINA_UNLIKELY(ty->cursor_state.cx >= (ty->w - offset)))
|
|
|
|
ty->termstate.wrapnext = 1;
|
|
|
|
else
|
2015-06-02 13:48:50 -07:00
|
|
|
{
|
|
|
|
ty->cursor_state.cx += offset;
|
|
|
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
|
|
|
}
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-28 02:55:53 -07:00
|
|
|
unsigned char offset = 1;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->termstate.wrapnext = 0;
|
2012-07-13 01:46:33 -07:00
|
|
|
#if defined(SUPPORT_DBLWIDTH)
|
2015-04-19 10:59:29 -07:00
|
|
|
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
2013-12-25 03:03:01 -08:00
|
|
|
offset = 2;
|
|
|
|
#endif
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->cursor_state.cx += offset;
|
|
|
|
if (ty->cursor_state.cx > (ty->w - offset))
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->cursor_state.cx = ty->w - offset;
|
2015-06-02 13:48:50 -07:00
|
|
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
2013-12-25 03:03:01 -08:00
|
|
|
return;
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
2015-06-02 13:48:50 -07:00
|
|
|
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_clear_line(Termpty *ty, Termpty_Clear mode, int limit)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
Termcell *cells;
|
|
|
|
int n = 0;
|
2015-04-19 10:59:29 -07:00
|
|
|
Evas_Coord x = 0, y = ty->cursor_state.cy;
|
2012-07-13 01:46:33 -07:00
|
|
|
|
2015-06-02 13:48:50 -07:00
|
|
|
assert (y >= 0 && y < ty->h);
|
|
|
|
|
2012-07-13 01:46:33 -07:00
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case TERMPTY_CLR_END:
|
2015-04-19 10:59:29 -07:00
|
|
|
n = ty->w - ty->cursor_state.cx;
|
|
|
|
x = ty->cursor_state.cx;
|
2012-07-13 01:46:33 -07:00
|
|
|
break;
|
|
|
|
case TERMPTY_CLR_BEGIN:
|
2015-04-19 10:59:29 -07:00
|
|
|
n = ty->cursor_state.cx + 1;
|
2012-07-13 01:46:33 -07:00
|
|
|
break;
|
|
|
|
case TERMPTY_CLR_ALL:
|
|
|
|
n = ty->w;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2013-11-11 09:08:02 -08:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, x, y));
|
2012-07-13 01:46:33 -07:00
|
|
|
if (n > limit) n = limit;
|
2013-11-11 09:08:02 -08:00
|
|
|
termio_content_change(ty->obj, x, y, n);
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, n);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_clear_screen(Termpty *ty, Termpty_Clear mode)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
Termcell *cells;
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case TERMPTY_CLR_END:
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_clear_line(ty, mode, ty->w);
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->cursor_state.cy < (ty->h - 1))
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
int l = ty->h - (ty->cursor_state.cy + 1);
|
2013-02-16 10:16:25 -08:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
termio_content_change(ty->obj, 0, ty->cursor_state.cy, l * ty->w);
|
2013-11-11 09:08:02 -08:00
|
|
|
|
2013-04-06 13:13:12 -07:00
|
|
|
while (l)
|
2013-02-16 10:16:25 -08:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, (ty->cursor_state.cy + l)));
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w);
|
2013-04-06 13:13:12 -07:00
|
|
|
l--;
|
2013-02-16 10:16:25 -08:00
|
|
|
}
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TERMPTY_CLR_BEGIN:
|
2015-04-19 10:59:29 -07:00
|
|
|
if (ty->cursor_state.cy > 0)
|
2013-11-10 13:13:19 -08:00
|
|
|
{
|
|
|
|
// First clear from circular > height, then from 0 to circular
|
2015-04-19 10:59:29 -07:00
|
|
|
int y = ty->cursor_state.cy + ty->circular_offset;
|
2013-11-10 13:13:19 -08:00
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
termio_content_change(ty->obj, 0, 0, ty->cursor_state.cy * ty->w);
|
2013-11-11 09:08:02 -08:00
|
|
|
|
2013-11-10 13:13:19 -08:00
|
|
|
cells = &(TERMPTY_SCREEN(ty, 0, 0));
|
|
|
|
|
|
|
|
if (y < ty->h)
|
|
|
|
{
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w * ty->cursor_state.cy);
|
2013-11-10 13:13:19 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int yt = y % ty->w;
|
|
|
|
int yb = ty->h - ty->circular_offset;
|
|
|
|
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, cells, ty->w * yb);
|
|
|
|
termpty_cells_clear(ty, ty->screen, ty->w * yt);
|
2013-11-10 13:13:19 -08:00
|
|
|
}
|
|
|
|
}
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_clear_line(ty, mode, ty->w);
|
2012-07-13 01:46:33 -07:00
|
|
|
break;
|
|
|
|
case TERMPTY_CLR_ALL:
|
2013-11-10 13:13:19 -08:00
|
|
|
ty->circular_offset = 0;
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cells_clear(ty, ty->screen, ty->w * ty->h);
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->termstate.scroll_y2 = 0;
|
2013-11-11 09:08:02 -08:00
|
|
|
if (ty->cb.cancel_sel.func)
|
|
|
|
ty->cb.cancel_sel.func(ty->cb.cancel_sel.data);
|
2012-07-13 01:46:33 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_clear_all(Termpty *ty)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
if (!ty->screen) return;
|
2013-01-29 07:54:47 -08:00
|
|
|
termpty_cell_fill(ty, NULL, ty->screen, ty->w * ty->h);
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_reset_att(Termatt *att)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
|
|
|
att->fg = COL_DEF;
|
|
|
|
att->bg = COL_DEF;
|
|
|
|
att->bold = 0;
|
|
|
|
att->faint = 0;
|
|
|
|
#if defined(SUPPORT_ITALIC)
|
|
|
|
att->italic = 0;
|
|
|
|
#elif defined(SUPPORT_DBLWIDTH)
|
|
|
|
att->dblwidth = 0;
|
|
|
|
#endif
|
|
|
|
att->underline = 0;
|
|
|
|
att->blink = 0;
|
|
|
|
att->blink2 = 0;
|
|
|
|
att->inverse = 0;
|
|
|
|
att->invisible = 0;
|
|
|
|
att->strike = 0;
|
|
|
|
att->fg256 = 0;
|
|
|
|
att->bg256 = 0;
|
|
|
|
att->fgintense = 0;
|
|
|
|
att->bgintense = 0;
|
|
|
|
att->autowrapped = 0;
|
|
|
|
att->newline = 0;
|
|
|
|
att->tab = 0;
|
2014-04-06 05:42:38 -07:00
|
|
|
att->fraktur = 0;
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_reset_state(Termpty *ty)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-06 09:08:23 -07:00
|
|
|
int backsize;
|
|
|
|
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->cursor_state.cx = 0;
|
|
|
|
ty->cursor_state.cy = 0;
|
|
|
|
ty->termstate.scroll_y1 = 0;
|
|
|
|
ty->termstate.scroll_y2 = 0;
|
|
|
|
ty->termstate.had_cr_x = 0;
|
|
|
|
ty->termstate.had_cr_y = 0;
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_reset_att(&(ty->termstate.att));
|
2015-04-19 10:59:29 -07:00
|
|
|
ty->termstate.charset = 0;
|
|
|
|
ty->termstate.charsetch = 'B';
|
|
|
|
ty->termstate.chset[0] = 'B';
|
|
|
|
ty->termstate.chset[1] = 'B';
|
|
|
|
ty->termstate.chset[2] = 'B';
|
|
|
|
ty->termstate.chset[3] = 'B';
|
|
|
|
ty->termstate.multibyte = 0;
|
|
|
|
ty->termstate.alt_kp = 0;
|
|
|
|
ty->termstate.insert = 0;
|
|
|
|
ty->termstate.appcursor = 0;
|
|
|
|
ty->termstate.wrap = 1;
|
|
|
|
ty->termstate.wrapnext = 0;
|
|
|
|
ty->termstate.crlf = 0;
|
|
|
|
ty->termstate.had_cr = 0;
|
|
|
|
ty->termstate.send_bs = 0;
|
|
|
|
ty->termstate.reverse = 0;
|
|
|
|
ty->termstate.no_autorepeat = 0;
|
|
|
|
ty->termstate.cjk_ambiguous_wide = 0;
|
|
|
|
ty->termstate.hide_cursor = 0;
|
2014-03-05 13:43:31 -08:00
|
|
|
ty->mouse_mode = MOUSE_OFF;
|
|
|
|
ty->mouse_ext = MOUSE_EXT_NONE;
|
2014-05-07 11:40:03 -07:00
|
|
|
ty->bracketed_paste = 0;
|
2014-12-08 11:32:27 -08:00
|
|
|
|
2015-06-28 14:37:04 -07:00
|
|
|
ty->backlog_beacon.screen_y = 0;
|
|
|
|
ty->backlog_beacon.backlog_y = 0;
|
|
|
|
|
2015-08-01 09:37:35 -07:00
|
|
|
termpty_backlog_lock();
|
2014-12-08 11:32:27 -08:00
|
|
|
if (ty->back)
|
|
|
|
{
|
2015-08-01 09:37:35 -07:00
|
|
|
size_t i;
|
2015-04-06 09:08:23 -07:00
|
|
|
for (i = 0; i < ty->backsize; i++)
|
|
|
|
termpty_save_free(&ty->back[i]);
|
2014-12-08 11:32:27 -08:00
|
|
|
free(ty->back);
|
|
|
|
ty->back = NULL;
|
|
|
|
}
|
|
|
|
ty->backpos = 0;
|
2015-04-06 09:08:23 -07:00
|
|
|
backsize = ty->backsize;
|
|
|
|
ty->backsize = 0;
|
2015-08-01 09:37:35 -07:00
|
|
|
termpty_backlog_size_set(ty, backsize);
|
|
|
|
termpty_backlog_unlock();
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-06-01 13:52:07 -07:00
|
|
|
termpty_cursor_copy(Termpty *ty, Eina_Bool save)
|
2012-07-13 01:46:33 -07:00
|
|
|
{
|
2015-04-19 10:59:29 -07:00
|
|
|
if (save)
|
|
|
|
{
|
|
|
|
ty->cursor_save.cx = ty->cursor_state.cx;
|
|
|
|
ty->cursor_save.cy = ty->cursor_state.cy;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ty->cursor_state.cx = ty->cursor_save.cx;
|
|
|
|
ty->cursor_state.cy = ty->cursor_save.cy;
|
|
|
|
}
|
2012-07-13 01:46:33 -07:00
|
|
|
}
|