always support double-width
This commit is contained in:
parent
84177b5f46
commit
9c4167f74f
|
@ -59,9 +59,7 @@ _row_set(Evas_Object *o, int y, const char *txt)
|
||||||
tc[x].bg_extended = 0;
|
tc[x].bg_extended = 0;
|
||||||
tc[x].underline = 0;
|
tc[x].underline = 0;
|
||||||
tc[x].strikethrough = 0;
|
tc[x].strikethrough = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
tc[x].double_width = 0;
|
tc[x].double_width = 0;
|
||||||
#endif
|
|
||||||
tc[x].fg_extended = 0;
|
tc[x].fg_extended = 0;
|
||||||
tc[x].bg_extended = 0;
|
tc[x].bg_extended = 0;
|
||||||
|
|
||||||
|
|
|
@ -2098,13 +2098,11 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y,
|
||||||
}
|
}
|
||||||
for (x = start_x; x <= end_x; x++)
|
for (x = start_x; x <= end_x; x++)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth))
|
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth))
|
||||||
{
|
{
|
||||||
if (x < end_x) x++;
|
if (x < end_x) x++;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (x >= w) break;
|
if (x >= w) break;
|
||||||
if (cells[x].att.newline)
|
if (cells[x].att.newline)
|
||||||
{
|
{
|
||||||
|
@ -2165,14 +2163,12 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y,
|
||||||
|
|
||||||
for (x = end_x + 1; x < w; x++)
|
for (x = end_x + 1; x < w; x++)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if ((cells[x].codepoint == 0) &&
|
if ((cells[x].codepoint == 0) &&
|
||||||
(cells[x].att.dblwidth))
|
(cells[x].att.dblwidth))
|
||||||
{
|
{
|
||||||
if (x < (w - 1)) x++;
|
if (x < (w - 1)) x++;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (((cells[x].codepoint != 0) &&
|
if (((cells[x].codepoint != 0) &&
|
||||||
(cells[x].codepoint != ' ')) ||
|
(cells[x].codepoint != ' ')) ||
|
||||||
(cells[x].att.newline) ||
|
(cells[x].att.newline) ||
|
||||||
|
@ -2192,14 +2188,12 @@ termio_selection_get(Evas_Object *obj, int c1x, int c1y, int c2x, int c2y,
|
||||||
{
|
{
|
||||||
for (x = last0; x <= end_x; x++)
|
for (x = last0; x <= end_x; x++)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if ((cells[x].codepoint == 0) &&
|
if ((cells[x].codepoint == 0) &&
|
||||||
(cells[x].att.dblwidth))
|
(cells[x].att.dblwidth))
|
||||||
{
|
{
|
||||||
if (x < (w - 1)) x++;
|
if (x < (w - 1)) x++;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (x >= w) break;
|
if (x >= w) break;
|
||||||
if (_sb_add(&sb, " ", 1) < 0) goto err;
|
if (_sb_add(&sb, " ", 1) < 0) goto err;
|
||||||
}
|
}
|
||||||
|
@ -2924,11 +2918,9 @@ _sel_word(Termio *sd, int cx, int cy)
|
||||||
{
|
{
|
||||||
for (; x >= 0; x--)
|
for (; x >= 0; x--)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
||||||
(x > 0))
|
(x > 0))
|
||||||
x--;
|
x--;
|
||||||
#endif
|
|
||||||
if (_codepoint_is_wordsep(cells[x].codepoint))
|
if (_codepoint_is_wordsep(cells[x].codepoint))
|
||||||
{
|
{
|
||||||
done = EINA_TRUE;
|
done = EINA_TRUE;
|
||||||
|
@ -2970,14 +2962,12 @@ _sel_word(Termio *sd, int cx, int cy)
|
||||||
{
|
{
|
||||||
for (; x < w; x++)
|
for (; x < w; x++)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
||||||
(x < (w - 1)))
|
(x < (w - 1)))
|
||||||
{
|
{
|
||||||
sd->pty->selection.end.x = x;
|
sd->pty->selection.end.x = x;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (_codepoint_is_wordsep(cells[x].codepoint))
|
if (_codepoint_is_wordsep(cells[x].codepoint))
|
||||||
{
|
{
|
||||||
done = EINA_TRUE;
|
done = EINA_TRUE;
|
||||||
|
@ -3294,13 +3284,8 @@ _sel_to(Termio *sd, int cx, int cy, Eina_Bool extend)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_selection_dbl_fix(Termio *sd
|
_selection_dbl_fix(Termio *sd)
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
EINA_UNUSED
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
int start_x, start_y, end_x, end_y;
|
int start_x, start_y, end_x, end_y;
|
||||||
ssize_t w = 0;
|
ssize_t w = 0;
|
||||||
Termcell *cells;
|
Termcell *cells;
|
||||||
|
@ -3382,8 +3367,6 @@ _selection_dbl_fix(Termio *sd
|
||||||
sd->pty->selection.start.y = start_y;
|
sd->pty->selection.start.y = start_y;
|
||||||
sd->pty->selection.end.x = end_x;
|
sd->pty->selection.end.x = end_x;
|
||||||
sd->pty->selection.end.y = end_y;
|
sd->pty->selection.end.y = end_y;
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4713,9 +4696,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[x].strikethrough = 0;
|
tc[x].strikethrough = 0;
|
||||||
tc[x].bold = 0;
|
tc[x].bold = 0;
|
||||||
tc[x].italic = 0;
|
tc[x].italic = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
tc[x].double_width = 0;
|
tc[x].double_width = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4733,9 +4714,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[x].strikethrough = 0;
|
tc[x].strikethrough = 0;
|
||||||
tc[x].bold = 0;
|
tc[x].bold = 0;
|
||||||
tc[x].italic = 0;
|
tc[x].italic = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
tc[x].double_width = 0;
|
tc[x].double_width = 0;
|
||||||
#endif
|
|
||||||
tc[x].fg = COL_INVIS;
|
tc[x].fg = COL_INVIS;
|
||||||
tc[x].bg = COL_INVIS;
|
tc[x].bg = COL_INVIS;
|
||||||
blk = termpty_block_get(sd->pty, bid);
|
blk = termpty_block_get(sd->pty, bid);
|
||||||
|
@ -4769,9 +4748,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[x].strikethrough = 0;
|
tc[x].strikethrough = 0;
|
||||||
tc[x].bold = 0;
|
tc[x].bold = 0;
|
||||||
tc[x].italic = 0;
|
tc[x].italic = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
tc[x].double_width = cells[x].att.dblwidth;
|
tc[x].double_width = cells[x].att.dblwidth;
|
||||||
#endif
|
|
||||||
if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
|
if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
|
||||||
(ch2 == x - 1))
|
(ch2 == x - 1))
|
||||||
ch2 = x;
|
ch2 = x;
|
||||||
|
@ -4823,9 +4800,7 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[x].strikethrough = cells[x].att.strike;
|
tc[x].strikethrough = cells[x].att.strike;
|
||||||
tc[x].bold = cells[x].att.bold;
|
tc[x].bold = cells[x].att.bold;
|
||||||
tc[x].italic = cells[x].att.italic;
|
tc[x].italic = cells[x].att.italic;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
tc[x].double_width = cells[x].att.dblwidth;
|
tc[x].double_width = cells[x].att.dblwidth;
|
||||||
#endif
|
|
||||||
tc[x].fg = fg;
|
tc[x].fg = fg;
|
||||||
tc[x].bg = bg;
|
tc[x].bg = bg;
|
||||||
tc[x].codepoint = codepoint;
|
tc[x].codepoint = codepoint;
|
||||||
|
@ -4859,10 +4834,8 @@ _smart_apply(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
jump = 1;
|
jump = 1;
|
||||||
g = uni[i];
|
g = uni[i];
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
dbl = _termpty_is_dblwidth_get(sd->pty, g);
|
dbl = _termpty_is_dblwidth_get(sd->pty, g);
|
||||||
if (dbl) jump = 2;
|
if (dbl) jump = 2;
|
||||||
#endif
|
|
||||||
backx = 0;
|
backx = 0;
|
||||||
if ((x + jump) > sd->grid.w)
|
if ((x + jump) > sd->grid.w)
|
||||||
{
|
{
|
||||||
|
@ -4889,7 +4862,6 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[xx].strikethrough = 0;
|
tc[xx].strikethrough = 0;
|
||||||
tc[xx].double_width = dbl;
|
tc[xx].double_width = dbl;
|
||||||
tc[xx].codepoint = g;
|
tc[xx].codepoint = g;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if (dbl)
|
if (dbl)
|
||||||
{
|
{
|
||||||
xx = x - backx + 1;
|
xx = x - backx + 1;
|
||||||
|
@ -4903,7 +4875,6 @@ _smart_apply(Evas_Object *obj)
|
||||||
tc[xx].double_width = 0;
|
tc[xx].double_width = 0;
|
||||||
tc[xx].codepoint = 0;
|
tc[xx].codepoint = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
evas_object_textgrid_cellrow_set(sd->grid.obj, y, tc);
|
evas_object_textgrid_cellrow_set(sd->grid.obj, y, tc);
|
||||||
if (x >= sd->grid.w)
|
if (x >= sd->grid.w)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,8 +36,6 @@ typedef struct _Termexp Termexp;
|
||||||
#define MOUSE_EXT_SGR 2
|
#define MOUSE_EXT_SGR 2
|
||||||
#define MOUSE_EXT_URXVT 3
|
#define MOUSE_EXT_URXVT 3
|
||||||
|
|
||||||
#define SUPPORT_DBLWIDTH 1
|
|
||||||
|
|
||||||
// Only for testing purpose
|
// Only for testing purpose
|
||||||
//#define SUPPORT_80_132_COLUMNS 1
|
//#define SUPPORT_80_132_COLUMNS 1
|
||||||
|
|
||||||
|
@ -51,11 +49,7 @@ struct _Termatt
|
||||||
unsigned short bold : 1;
|
unsigned short bold : 1;
|
||||||
unsigned short faint : 1;
|
unsigned short faint : 1;
|
||||||
unsigned short italic : 1;
|
unsigned short italic : 1;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
unsigned short dblwidth : 1;
|
unsigned short dblwidth : 1;
|
||||||
#else
|
|
||||||
unsigned short bit_padding_0 : 1;
|
|
||||||
#endif
|
|
||||||
unsigned short underline : 1;
|
unsigned short underline : 1;
|
||||||
unsigned short blink : 1; // don't intend to support this currently
|
unsigned short blink : 1; // don't intend to support this currently
|
||||||
unsigned short blink2 : 1; // don't intend to support this currently
|
unsigned short blink2 : 1; // don't intend to support this currently
|
||||||
|
|
|
@ -6,7 +6,6 @@ Eina_Bool _termpty_is_dblwidth_slow_get(Termpty *ty, int g);
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
_termpty_is_dblwidth_get(Termpty *ty, int g)
|
_termpty_is_dblwidth_get(Termpty *ty, int g)
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
// check for east asian full-width (F), half-width (H), wide (W),
|
// check for east asian full-width (F), half-width (H), wide (W),
|
||||||
// narrow (Na) or ambiguous (A) codepoints
|
// narrow (Na) or ambiguous (A) codepoints
|
||||||
// ftp://ftp.unicode.org/Public/UNIDATA/EastAsianWidth.txt
|
// ftp://ftp.unicode.org/Public/UNIDATA/EastAsianWidth.txt
|
||||||
|
@ -21,9 +20,6 @@ _termpty_is_dblwidth_get(Termpty *ty, int g)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
||||||
return _termpty_is_dblwidth_slow_get(ty, g);
|
return _termpty_is_dblwidth_slow_get(ty, g);
|
||||||
#else
|
|
||||||
return EINA_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -915,9 +915,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
|
||||||
cells[x].att.blink2 = 0;
|
cells[x].att.blink2 = 0;
|
||||||
cells[x].att.inverse = 0;
|
cells[x].att.inverse = 0;
|
||||||
cells[x].att.strike = 0;
|
cells[x].att.strike = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
cells[x].att.dblwidth = 0;
|
cells[x].att.dblwidth = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,6 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
||||||
|
|
||||||
termpty_cell_codepoint_att_fill(ty, g, ty->termstate.att,
|
termpty_cell_codepoint_att_fill(ty, g, ty->termstate.att,
|
||||||
&(cells[ty->cursor_state.cx]), 1);
|
&(cells[ty->cursor_state.cx]), 1);
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
cells[ty->cursor_state.cx].att.dblwidth = _termpty_is_dblwidth_get(ty, g);
|
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))))
|
if (EINA_UNLIKELY((cells[ty->cursor_state.cx].att.dblwidth) && (ty->cursor_state.cx < (ty->w - 1))))
|
||||||
{
|
{
|
||||||
|
@ -182,16 +181,13 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
||||||
termpty_cell_codepoint_att_fill(ty, 0, 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);
|
&(cells[ty->cursor_state.cx + 1]), 1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (ty->termstate.wrap)
|
if (ty->termstate.wrap)
|
||||||
{
|
{
|
||||||
unsigned char offset = 1;
|
unsigned char offset = 1;
|
||||||
|
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
||||||
offset = 2;
|
offset = 2;
|
||||||
#endif
|
|
||||||
if (EINA_UNLIKELY(ty->cursor_state.cx >= (ty->w - offset)))
|
if (EINA_UNLIKELY(ty->cursor_state.cx >= (ty->w - offset)))
|
||||||
ty->termstate.wrapnext = 1;
|
ty->termstate.wrapnext = 1;
|
||||||
else
|
else
|
||||||
|
@ -205,10 +201,8 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
|
||||||
unsigned char offset = 1;
|
unsigned char offset = 1;
|
||||||
|
|
||||||
ty->termstate.wrapnext = 0;
|
ty->termstate.wrapnext = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
|
||||||
offset = 2;
|
offset = 2;
|
||||||
#endif
|
|
||||||
ty->cursor_state.cx += offset;
|
ty->cursor_state.cx += offset;
|
||||||
if (ty->cursor_state.cx > (ty->w - offset))
|
if (ty->cursor_state.cx > (ty->w - offset))
|
||||||
{
|
{
|
||||||
|
@ -326,9 +320,7 @@ termpty_reset_att(Termatt *att)
|
||||||
att->bold = 0;
|
att->bold = 0;
|
||||||
att->faint = 0;
|
att->faint = 0;
|
||||||
att->italic = 0;
|
att->italic = 0;
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
|
||||||
att->dblwidth = 0;
|
att->dblwidth = 0;
|
||||||
#endif
|
|
||||||
att->underline = 0;
|
att->underline = 0;
|
||||||
att->blink = 0;
|
att->blink = 0;
|
||||||
att->blink2 = 0;
|
att->blink2 = 0;
|
||||||
|
|
Loading…
Reference in New Issue