always support double-width

devs/zehortigoza/user-title
Boris Faure 7 years ago
parent 84177b5f46
commit 9c4167f74f
  1. 6
      src/bin/options_themepv.c
  2. 31
      src/bin/termio.c
  3. 6
      src/bin/termpty.h
  4. 4
      src/bin/termptydbl.h
  5. 2
      src/bin/termptyesc.c
  6. 8
      src/bin/termptyops.c

@ -54,17 +54,15 @@ _row_set(Evas_Object *o, int y, const char *txt)
if (*s != 0) codepoint = *s;
else s = NULL;
}
tc[x].fg_extended = 0;
tc[x].bg_extended = 0;
tc[x].underline = 0;
tc[x].strikethrough = 0;
#if defined(SUPPORT_DBLWIDTH)
tc[x].double_width = 0;
#endif
tc[x].fg_extended = 0;
tc[x].bg_extended = 0;
tc[x].fg = fg;
tc[x].bg = bg;
tc[x].codepoint = codepoint;

@ -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++)
{
#if defined(SUPPORT_DBLWIDTH)
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth))
{
if (x < end_x) x++;
else break;
}
#endif
if (x >= w) break;
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++)
{
#if defined(SUPPORT_DBLWIDTH)
if ((cells[x].codepoint == 0) &&
(cells[x].att.dblwidth))
{
if (x < (w - 1)) x++;
else break;
}
#endif
if (((cells[x].codepoint != 0) &&
(cells[x].codepoint != ' ')) ||
(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++)
{
#if defined(SUPPORT_DBLWIDTH)
if ((cells[x].codepoint == 0) &&
(cells[x].att.dblwidth))
{
if (x < (w - 1)) x++;
else break;
}
#endif
if (x >= w) break;
if (_sb_add(&sb, " ", 1) < 0) goto err;
}
@ -2924,11 +2918,9 @@ _sel_word(Termio *sd, int cx, int cy)
{
for (; x >= 0; x--)
{
#if defined(SUPPORT_DBLWIDTH)
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
(x > 0))
x--;
#endif
if (_codepoint_is_wordsep(cells[x].codepoint))
{
done = EINA_TRUE;
@ -2970,14 +2962,12 @@ _sel_word(Termio *sd, int cx, int cy)
{
for (; x < w; x++)
{
#if defined(SUPPORT_DBLWIDTH)
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
(x < (w - 1)))
{
sd->pty->selection.end.x = x;
x++;
}
#endif
if (_codepoint_is_wordsep(cells[x].codepoint))
{
done = EINA_TRUE;
@ -3294,13 +3284,8 @@ _sel_to(Termio *sd, int cx, int cy, Eina_Bool extend)
}
static void
_selection_dbl_fix(Termio *sd
#if defined(SUPPORT_DBLWIDTH)
EINA_UNUSED
#endif
)
_selection_dbl_fix(Termio *sd)
{
#if defined(SUPPORT_DBLWIDTH)
int start_x, start_y, end_x, end_y;
ssize_t w = 0;
Termcell *cells;
@ -3382,8 +3367,6 @@ _selection_dbl_fix(Termio *sd
sd->pty->selection.start.y = start_y;
sd->pty->selection.end.x = end_x;
sd->pty->selection.end.y = end_y;
#endif
}
static void
@ -4713,9 +4696,7 @@ _smart_apply(Evas_Object *obj)
tc[x].strikethrough = 0;
tc[x].bold = 0;
tc[x].italic = 0;
#if defined(SUPPORT_DBLWIDTH)
tc[x].double_width = 0;
#endif
}
else
{
@ -4733,9 +4714,7 @@ _smart_apply(Evas_Object *obj)
tc[x].strikethrough = 0;
tc[x].bold = 0;
tc[x].italic = 0;
#if defined(SUPPORT_DBLWIDTH)
tc[x].double_width = 0;
#endif
tc[x].fg = COL_INVIS;
tc[x].bg = COL_INVIS;
blk = termpty_block_get(sd->pty, bid);
@ -4769,9 +4748,7 @@ _smart_apply(Evas_Object *obj)
tc[x].strikethrough = 0;
tc[x].bold = 0;
tc[x].italic = 0;
#if defined(SUPPORT_DBLWIDTH)
tc[x].double_width = cells[x].att.dblwidth;
#endif
if ((tc[x].double_width) && (tc[x].codepoint == 0) &&
(ch2 == x - 1))
ch2 = x;
@ -4823,9 +4800,7 @@ _smart_apply(Evas_Object *obj)
tc[x].strikethrough = cells[x].att.strike;
tc[x].bold = cells[x].att.bold;
tc[x].italic = cells[x].att.italic;
#if defined(SUPPORT_DBLWIDTH)
tc[x].double_width = cells[x].att.dblwidth;
#endif
tc[x].fg = fg;
tc[x].bg = bg;
tc[x].codepoint = codepoint;
@ -4859,10 +4834,8 @@ _smart_apply(Evas_Object *obj)
{
jump = 1;
g = uni[i];
#if defined(SUPPORT_DBLWIDTH)
dbl = _termpty_is_dblwidth_get(sd->pty, g);
if (dbl) jump = 2;
#endif
backx = 0;
if ((x + jump) > sd->grid.w)
{
@ -4889,7 +4862,6 @@ _smart_apply(Evas_Object *obj)
tc[xx].strikethrough = 0;
tc[xx].double_width = dbl;
tc[xx].codepoint = g;
#if defined(SUPPORT_DBLWIDTH)
if (dbl)
{
xx = x - backx + 1;
@ -4903,7 +4875,6 @@ _smart_apply(Evas_Object *obj)
tc[xx].double_width = 0;
tc[xx].codepoint = 0;
}
#endif
evas_object_textgrid_cellrow_set(sd->grid.obj, y, tc);
if (x >= sd->grid.w)
{

@ -36,8 +36,6 @@ typedef struct _Termexp Termexp;
#define MOUSE_EXT_SGR 2
#define MOUSE_EXT_URXVT 3
#define SUPPORT_DBLWIDTH 1
// Only for testing purpose
//#define SUPPORT_80_132_COLUMNS 1
@ -51,11 +49,7 @@ struct _Termatt
unsigned short bold : 1;
unsigned short faint : 1;
unsigned short italic : 1;
#if defined(SUPPORT_DBLWIDTH)
unsigned short dblwidth : 1;
#else
unsigned short bit_padding_0 : 1;
#endif
unsigned short underline : 1;
unsigned short blink : 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
_termpty_is_dblwidth_get(Termpty *ty, int g)
{
#if defined(SUPPORT_DBLWIDTH)
// check for east asian full-width (F), half-width (H), wide (W),
// narrow (Na) or ambiguous (A) codepoints
// ftp://ftp.unicode.org/Public/UNIDATA/EastAsianWidth.txt
@ -21,9 +20,6 @@ _termpty_is_dblwidth_get(Termpty *ty, int g)
return EINA_TRUE;
return _termpty_is_dblwidth_slow_get(ty, g);
#else
return EINA_FALSE;
#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.inverse = 0;
cells[x].att.strike = 0;
#if defined(SUPPORT_DBLWIDTH)
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,
&(cells[ty->cursor_state.cx]), 1);
#if defined(SUPPORT_DBLWIDTH)
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))))
{
@ -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,
&(cells[ty->cursor_state.cx + 1]), 1);
}
#endif
if (ty->termstate.wrap)
{
unsigned char offset = 1;
ty->termstate.wrapnext = 0;
#if defined(SUPPORT_DBLWIDTH)
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
offset = 2;
#endif
if (EINA_UNLIKELY(ty->cursor_state.cx >= (ty->w - offset)))
ty->termstate.wrapnext = 1;
else
@ -205,10 +201,8 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
unsigned char offset = 1;
ty->termstate.wrapnext = 0;
#if defined(SUPPORT_DBLWIDTH)
if (EINA_UNLIKELY(cells[ty->cursor_state.cx].att.dblwidth))
offset = 2;
#endif
ty->cursor_state.cx += offset;
if (ty->cursor_state.cx > (ty->w - offset))
{
@ -326,9 +320,7 @@ termpty_reset_att(Termatt *att)
att->bold = 0;
att->faint = 0;
att->italic = 0;
#if defined(SUPPORT_DBLWIDTH)
att->dblwidth = 0;
#endif
att->underline = 0;
att->blink = 0;
att->blink2 = 0;

Loading…
Cancel
Save