yaft: remove support for double-width characters

for our usecase (output of system commands), this is not necessary
This commit is contained in:
Stefan Seyfried
2018-01-27 16:44:42 +01:00
committed by Thilo Graf
parent 0485c2091f
commit 8adead92e1
4 changed files with 6 additions and 53 deletions

View File

@@ -335,8 +335,6 @@ void YaFT_p::set_mode(struct parm_t *parm)
mode |= MODE_AMRIGHT;
} else if (pmode == 25) {
mode |= MODE_CURSOR;
} else if (pmode == 8901) {
mode |= MODE_VWBS;
}
}
@@ -359,8 +357,6 @@ void YaFT_p::reset_mode(struct parm_t *parm)
wrap_occured = false;
} else if (pmode == 25) {
mode &= ~MODE_CURSOR;
} else if (pmode == 8901) {
mode &= ~MODE_VWBS;
}
}

View File

@@ -27,12 +27,7 @@
/* function for control character */
void YaFT_p::bs(void)
{
if (mode & MODE_VWBS
&& cursor.x - 1 >= 0
&& cells[cursor.y][cursor.x - 1].width == NEXT_TO_WIDE)
move_cursor(0, -2);
else
move_cursor(0, -1);
move_cursor(0, -1);
}
void YaFT_p::tab(void)

View File

@@ -116,7 +116,6 @@ void YaFT_p::erase_cell(int y, int x)
cellp->glyphp = glyph[DEFAULT_CHAR];
cellp->color_pair = color_pair; /* bce */
cellp->attribute = ATTR_RESET;
cellp->width = HALF;
line_dirty[y] = true;
}
@@ -126,20 +125,8 @@ void YaFT_p::copy_cell(int dst_y, int dst_x, int src_y, int src_x)
dst = &cells[dst_y][dst_x];
src = &cells[src_y][src_x];
if (src->width == NEXT_TO_WIDE) {
return;
} else if (src->width == WIDE && dst_x == (cols - 1)) {
erase_cell(dst_y, dst_x);
} else {
*dst = *src;
if (src->width == WIDE) {
dst = &cells[dst_y][dst_x + 1];
*dst = *src;
dst->width = NEXT_TO_WIDE;
}
line_dirty[dst_y] = true;
}
*dst = *src;
line_dirty[dst_y] = true;
}
int YaFT_p::set_cell(int y, int x, const struct glyph_t *glyphp)
@@ -161,23 +148,10 @@ int YaFT_p::set_cell(int y, int x, const struct glyph_t *glyphp)
}
cell.attribute = attribute;
cell.width = (glyph_width)glyphp->width;
cells[y][x] = cell;
line_dirty[y] = true;
if (cell.width == WIDE && x + 1 < cols) {
cell.width = NEXT_TO_WIDE;
cells[y][x + 1] = cell;
return WIDE;
}
if (cell.width == HALF /* isolated NEXT_TO_WIDE cell */
&& x + 1 < cols
&& cells[y][x + 1].width == NEXT_TO_WIDE) {
erase_cell(y, x + 1);
}
return HALF;
return 1;
}
void YaFT_p::swap_lines(int i, int j)
@@ -789,16 +763,12 @@ void YaFT_p::draw_line(int line)
col_pair = cellp->color_pair;
/* check wide character or not */
glyph_w = (cellp->width == HALF) ? CELL_WIDTH: CELL_WIDTH * 2;
glyph_w = CELL_WIDTH;
bdf_padding = my_ceil(glyph_w, BITS_PER_BYTE) * BITS_PER_BYTE - glyph_w;
if (cellp->width == WIDE)
bdf_padding += CELL_WIDTH;
/* check cursor positon */
if ((mode & MODE_CURSOR && line == cursor.y)
&& (col == cursor.x
|| (cellp->width == WIDE && (col + 1) == cursor.x)
|| (cellp->width == NEXT_TO_WIDE && (col - 1) == cursor.x))) {
&& col == cursor.x) {
col_pair.fg = DEFAULT_BG;
col_pair.bg = ACTIVE_CURSOR_COLOR;
}

View File

@@ -123,7 +123,6 @@ class YaFT_p
MODE_ORIGIN = 0x01, /* origin mode: DECOM */
MODE_CURSOR = 0x02, /* cursor visible: DECTCEM */
MODE_AMRIGHT = 0x04, /* auto wrap: DECAWM */
MODE_VWBS = 0x08, /* variable-width backspace */
};
struct esc_t {
@@ -132,17 +131,10 @@ class YaFT_p
enum esc_state state;
};
enum glyph_width {
NEXT_TO_WIDE = 0,
HALF,
WIDE,
};
struct cell_t {
const struct glyph_t *glyphp; /* pointer to glyph */
struct color_pair_t color_pair; /* color (fg, bg) */
int attribute; /* bold, underscore, etc... */
enum glyph_width width; /* wide char flag: WIDE, NEXT_TO_WIDE, HALF */
};
struct framebuffer_t {