Commit 66534dfc authored by Christian Persch's avatar Christian Persch

ring: Store cell attributes together in an uint32_t

Instead of using a bitfield, use an uint32_t and set/get
the values manually. This allows to check for multiple
values at once with just one operation instead of
checking each bitfield member separately.,
parent 615d5fac
#!/usr/bin/env bash
# Test deco color support
# Copyright © 2014 Egmont Koblinger
# Copyright © 2018 Christian Persch
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
sep=":"
sepsep="::"
if [ "$1" = "-colon" -o "$1" = "-official" -o "$1" = "-dejure" ]; then
shift
elif [ "$1" = "-semicolon" -o "$1" = "-common" -o "$1" = "-defacto" ]; then
sep=";"
sepsep=";" # no empty param for legacy format
shift
fi
if [ $# != 0 ]; then
echo 'Usage: deco.sh [FORMAT]' >&2
echo >&2
echo ' -colon|-official|-dejure: Official format (default) CSI 58:2::R:G:Bm' >&2
echo ' -semicolon|-common|-defacto: Commonly used format CSI 58;2;R;G;Bm' >&2
exit 1
fi
row() {
local format="$1"
local n="$2"
local v;
for m in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
v=$(($n * 16 + $m))
printf "\e[${format};4m%02X\e[0m%.0s%.0s%.0s" 38 $v $v $v $v $v $v
done
printf "\t"
for m in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
v=$(($n * 16 + $m))
printf "\e[${format};4m%02X\e[0m%.0s%.0s%.0s" 48 $v $v $v $v $v $v
done
printf "\n"
}
cubes() {
local format1="$1"
local format2="$2"
local format="%d${sep}2${sepsep}${format1};58${sep}2${sepsep}${format2}"
for n in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
row "$format" $n
done
}
printf "\e[0m"
cubes "%d${sep}0${sep}0" "%d${sep}0${sep}0"
printf "\n"
cubes "0${sep}%d${sep}0" "0${sep}%d${sep}0"
printf "\n"
cubes "0${sep}0${sep}%d" "0${sep}0${sep}%d"
printf "\n"
cubes "%d${sep}0${sep}0" "0${sep}%d${sep}0"
printf "\n"
cubes "%d${sep}0${sep}0" "0${sep}0${sep}%d"
printf "\n"
cubes "0${sep}%d${sep}0" "%d${sep}0${sep}0"
printf "\n"
cubes "0${sep}%d${sep}0" "0${sep}0${sep}%d"
printf "\n"
cubes "0${sep}0${sep}%d" "%d${sep}0${sep}0"
printf "\n"
cubes "0${sep}0${sep}%d" "0${sep}%d${sep}0"
printf "\n"
printf "\e[0m"
exit 0
......@@ -45,6 +45,7 @@ libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \
vte/vtepty.h \
vte/vteregex.h \
vte/vteterminal.h \
attr.hh \
buffer.h \
caps.hh \
caps-list.hh \
......
/*
* Copyright © 2018 Christian Persch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>
#define VTE_ATTR_VALUE_MASK(bits) ((1U << (bits)) - 1U)
#define VTE_ATTR_MASK(shift,bits) (VTE_ATTR_VALUE_MASK(bits) << (shift))
/* Number of visible columns (as determined by g_unicode_iswide(c)).
* Also (ab)used for tabs; bug 353610.
*/
#define VTE_ATTR_COLUMNS_SHIFT (0)
#define VTE_ATTR_COLUMNS_BITS (4) /* Has to be able to store the value of 8. */
#define VTE_ATTR_COLUMNS_MASK (VTE_ATTR_MASK(VTE_ATTR_COLUMNS_SHIFT, VTE_ATTR_COLUMNS_BITS))
#define VTE_ATTR_COLUMNS_VALUE_MASK (VTE_ATTR_VALUE_MASK(VTE_ATTR_COLUMNS_BITS))
#define VTE_ATTR_COLUMNS(v) ((v) << VTE_ATTR_COLUMNS_SHIFT)
/* A continuation cell */
#define VTE_ATTR_FRAGMENT_SHIFT (VTE_ATTR_COLUMNS_SHIFT + VTE_ATTR_COLUMNS_BITS)
#define VTE_ATTR_FRAGMENT_BITS (1)
#define VTE_ATTR_FRAGMENT_MASK (VTE_ATTR_MASK(VTE_ATTR_FRAGMENT_SHIFT, VTE_ATTR_FRAGMENT_BITS))
#define VTE_ATTR_FRAGMENT (1U << VTE_ATTR_FRAGMENT_SHIFT)
#define VTE_ATTR_BOLD_SHIFT (VTE_ATTR_FRAGMENT_SHIFT + VTE_ATTR_FRAGMENT_BITS)
#define VTE_ATTR_BOLD_BITS (1)
#define VTE_ATTR_BOLD_MASK (VTE_ATTR_MASK(VTE_ATTR_BOLD_SHIFT, VTE_ATTR_BOLD_BITS))
#define VTE_ATTR_BOLD (1U << VTE_ATTR_BOLD_SHIFT)
#define VTE_ATTR_ITALIC_SHIFT (VTE_ATTR_BOLD_SHIFT + VTE_ATTR_BOLD_BITS)
#define VTE_ATTR_ITALIC_BITS (1)
#define VTE_ATTR_ITALIC_MASK (VTE_ATTR_MASK(VTE_ATTR_ITALIC_SHIFT, VTE_ATTR_ITALIC_BITS))
#define VTE_ATTR_ITALIC (1U << VTE_ATTR_ITALIC_SHIFT)
/* 0: none, 1: single, 2: double, 3: curly */
#define VTE_ATTR_UNDERLINE_SHIFT (VTE_ATTR_ITALIC_SHIFT + VTE_ATTR_ITALIC_BITS)
#define VTE_ATTR_UNDERLINE_BITS (2)
#define VTE_ATTR_UNDERLINE_MASK (VTE_ATTR_MASK(VTE_ATTR_UNDERLINE_SHIFT, VTE_ATTR_UNDERLINE_BITS))
#define VTE_ATTR_UNDERLINE_VALUE_MASK (VTE_ATTR_VALUE_MASK(VTE_ATTR_UNDERLINE_BITS))
#define VTE_ATTR_UNDERLINE(v) ((v) << VTE_ATTR_UNDERLINE_SHIFT)
#define VTE_ATTR_STRIKETHROUGH_SHIFT (VTE_ATTR_UNDERLINE_SHIFT + VTE_ATTR_UNDERLINE_BITS)
#define VTE_ATTR_STRIKETHROUGH_BITS (1)
#define VTE_ATTR_STRIKETHROUGH_MASK (VTE_ATTR_MASK(VTE_ATTR_STRIKETHROUGH_SHIFT, VTE_ATTR_STRIKETHROUGH_BITS))
#define VTE_ATTR_STRIKETHROUGH (1U << VTE_ATTR_STRIKETHROUGH_SHIFT)
#define VTE_ATTR_OVERLINE_SHIFT (VTE_ATTR_STRIKETHROUGH_SHIFT + VTE_ATTR_STRIKETHROUGH_BITS)
#define VTE_ATTR_OVERLINE_BITS (1)
#define VTE_ATTR_OVERLINE_MASK (VTE_ATTR_MASK(VTE_ATTR_OVERLINE_SHIFT, VTE_ATTR_OVERLINE_BITS))
#define VTE_ATTR_OVERLINE (1U << VTE_ATTR_OVERLINE_SHIFT)
#define VTE_ATTR_REVERSE_SHIFT (VTE_ATTR_OVERLINE_SHIFT + VTE_ATTR_OVERLINE_BITS)
#define VTE_ATTR_REVERSE_BITS (1)
#define VTE_ATTR_REVERSE_MASK (VTE_ATTR_MASK(VTE_ATTR_REVERSE_SHIFT, VTE_ATTR_REVERSE_BITS))
#define VTE_ATTR_REVERSE (1U << VTE_ATTR_REVERSE_SHIFT)
#define VTE_ATTR_BLINK_SHIFT (VTE_ATTR_REVERSE_SHIFT + VTE_ATTR_REVERSE_BITS)
#define VTE_ATTR_BLINK_BITS (1)
#define VTE_ATTR_BLINK_MASK (VTE_ATTR_MASK(VTE_ATTR_BLINK_SHIFT, VTE_ATTR_BLINK_BITS))
#define VTE_ATTR_BLINK (1U << VTE_ATTR_BLINK_SHIFT)
/* also known as faint, half intensity etc. */
#define VTE_ATTR_DIM_SHIFT (VTE_ATTR_BLINK_SHIFT + VTE_ATTR_BLINK_BITS)
#define VTE_ATTR_DIM_BITS (1)
#define VTE_ATTR_DIM_MASK (VTE_ATTR_MASK(VTE_ATTR_DIM_SHIFT, VTE_ATTR_DIM_BITS))
#define VTE_ATTR_DIM (1U << VTE_ATTR_DIM_SHIFT)
#define VTE_ATTR_INVISIBLE_SHIFT (VTE_ATTR_DIM_SHIFT + VTE_ATTR_DIM_BITS)
#define VTE_ATTR_INVISIBLE_BITS (1)
#define VTE_ATTR_INVISIBLE_MASK (VTE_ATTR_MASK(VTE_ATTR_INVISIBLE_SHIFT, VTE_ATTR_INVISIBLE_BITS))
#define VTE_ATTR_INVISIBLE (1U << VTE_ATTR_INVISIBLE_SHIFT)
/* Used internally only */
#define VTE_ATTR_BOXED_SHIFT (31)
#define VTE_ATTR_BOXED_BITS (1)
#define VTE_ATTR_BOXED_MASK (VTE_ATTR_MASK(VTE_ATTR_BOXED_SHIFT, VTE_ATTR_BOXED_BITS))
#define VTE_ATTR_BOXED (1U << VTE_ATTR_BOXED_SHIFT)
/* All attributes except DIM and BOXED */
#define VTE_ATTR_ALL_MASK (VTE_ATTR_BOLD_MASK | \
VTE_ATTR_ITALIC_MASK | \
VTE_ATTR_UNDERLINE_MASK | \
VTE_ATTR_STRIKETHROUGH_MASK | \
VTE_ATTR_OVERLINE_MASK | \
VTE_ATTR_REVERSE_MASK | \
VTE_ATTR_BLINK_MASK | \
VTE_ATTR_INVISIBLE_MASK)
#define VTE_ATTR_NONE (0U)
#define VTE_ATTR_DEFAULT (VTE_ATTR_COLUMNS(1))
static constexpr inline void vte_attr_set_bool(uint32_t* attr,
uint32_t mask,
bool value)
{
if (value)
*attr |= mask;
else
*attr &= ~mask;
}
static constexpr inline void vte_attr_set_value(uint32_t* attr,
uint32_t mask,
unsigned int shift,
uint32_t value)
{
g_assert_cmpuint(value << shift, <=, mask); /* assurance */
*attr = (*attr & ~mask) | ((value << shift) & mask /* assurance */);
}
static constexpr inline bool vte_attr_get_bool(uint32_t attr,
unsigned int shift)
{
return (attr >> shift) & 1U;
}
static constexpr inline unsigned int vte_attr_get_value(uint32_t attr,
uint32_t value_mask,
unsigned int shift)
{
return (attr >> shift) & value_mask;
}
......@@ -362,7 +362,7 @@ _vte_ring_freeze_row (VteRing *ring, gulong position, const VteRowData *row)
* the text in real UTF-8.
*/
attr = cell->attr;
if (G_LIKELY (!attr.fragment)) {
if (G_LIKELY (!attr.fragment())) {
VteCellAttrChange attr_change;
guint16 hyperlink_length;
......@@ -389,7 +389,7 @@ _vte_ring_freeze_row (VteRing *ring, gulong position, const VteRowData *row)
num_chars = _vte_unistr_strlen (cell->c);
if (num_chars > 1) {
/* Combining chars */
attr.columns = 0;
attr.set_columns(0);
ring->last_attr_text_start_offset = record.text_start_offset + buffer->len
+ g_unichar_to_utf8 (_vte_unistr_get_base (cell->c), NULL);
memset(&attr_change, 0, sizeof (attr_change));
......@@ -514,7 +514,7 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
_VTE_DEBUG_IF(VTE_DEBUG_RING | VTE_DEBUG_HYPERLINK) {
/* Debug: Reverse the colors for the stream's contents. */
if (!do_truncate) {
cell.attr.reverse = !cell.attr.reverse;
cell.attr.attr ^= VTE_ATTR_REVERSE;
}
}
cell.c = g_utf8_get_char (p);
......@@ -523,12 +523,12 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
record.text_start_offset += q - p;
p = q;
if (G_UNLIKELY (cell.attr.columns == 0)) {
if (G_UNLIKELY (cell.attr.columns() == 0)) {
if (G_LIKELY (row->len)) {
/* Combine it */
row->cells[row->len - 1].c = _vte_unistr_append_unichar (row->cells[row->len - 1].c, cell.c);
} else {
cell.attr.columns = 1;
cell.attr.set_columns(1);
if (row->len == hyperlink_column && hyperlink != NULL)
*hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf);
_vte_row_data_append (row, &cell);
......@@ -537,11 +537,11 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
if (row->len == hyperlink_column && hyperlink != NULL)
*hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf);
_vte_row_data_append (row, &cell);
if (cell.attr.columns > 1) {
if (cell.attr.columns() > 1) {
/* Add the fragments */
int i, columns = cell.attr.columns;
cell.attr.fragment = 1;
cell.attr.columns = 1;
int i, columns = cell.attr.columns();
cell.attr.set_fragment(true);
cell.attr.set_columns(1);
for (i = 1; i < columns; i++) {
if (row->len == hyperlink_column && hyperlink != NULL)
*hyperlink = strcpy(ring->hyperlink_buf, hyperlink_readbuf);
......@@ -1043,8 +1043,8 @@ _vte_frozen_row_column_to_text_offset (VteRing *ring,
offset->eol_cells = -1;
num_chars = 0;
for (i = 0, cell = row->cells; i < row->len && i < column; i++, cell++) {
if (G_LIKELY (!cell->attr.fragment)) {
if (G_UNLIKELY (i + cell->attr.columns > column)) {
if (G_LIKELY (!cell->attr.fragment())) {
if (G_UNLIKELY (i + cell->attr.columns() > column)) {
offset->fragment_cells = column - i;
break;
}
......@@ -1125,7 +1125,7 @@ _vte_frozen_row_text_offset_to_column (VteRing *ring,
/* count the number of columns for the given number of characters */
for (i = 0, cell = row->cells; i < row->len; i++, cell++) {
if (G_LIKELY (!cell->attr.fragment)) {
if (G_LIKELY (!cell->attr.fragment())) {
if (num_chars == 0) break;
nc = _vte_unistr_strlen(cell->c);
if (nc > num_chars) break;
......@@ -1280,13 +1280,13 @@ _vte_ring_rewrap (VteRing *ring,
}
runlength = MIN(paragraph_len, attr_change.text_end_offset - text_offset);
if (G_UNLIKELY (attr_change.attr.columns == 0)) {
if (G_UNLIKELY (attr_change.attr.columns() == 0)) {
/* Combining characters all fit in the current row */
text_offset += runlength;
paragraph_len -= runlength;
} else {
while (runlength) {
if (col >= columns - attr_change.attr.columns + 1) {
if (col >= columns - attr_change.attr.columns() + 1) {
/* Wrap now, write the soft wrapped row's record */
new_record.soft_wrapped = 1;
_vte_stream_append(new_row_stream, (const char *) &new_record, sizeof (new_record));
......@@ -1319,7 +1319,7 @@ _vte_ring_rewrap (VteRing *ring,
/* Process one character only. */
char textbuf[6]; /* fits at least one UTF-8 character */
int textbuf_len;
col += attr_change.attr.columns;
col += attr_change.attr.columns();
/* Find beginning of next UTF-8 character */
text_offset++; paragraph_len--; runlength--;
textbuf_len = MIN(runlength, sizeof (textbuf));
......@@ -1414,7 +1414,7 @@ _vte_ring_write_row (VteRing *ring,
* TODO Should unify one day */
g_string_set_size (buffer, 0);
for (i = 0, cell = row->cells; i < row->len; i++, cell++) {
if (G_LIKELY (!cell->attr.fragment))
if (G_LIKELY (!cell->attr.fragment()))
_vte_unistr_append_to_string (cell->c, buffer);
}
if (!row->attr.soft_wrapped)
......
This diff is collapsed.
......@@ -848,15 +848,9 @@ public:
uint32_t deco,
bool clear,
bool draw_default_bg,
bool bold,
bool italic,
guint underline,
bool strikethrough,
bool overline,
bool blink,
uint32_t attr,
bool hyperlink,
bool hilite,
bool boxed,
int column_width,
int row_height);
void fudge_pango_colors(GSList *attributes,
......
......@@ -21,19 +21,18 @@
#ifndef vterowdata_h_included
#define vterowdata_h_included
#include <cstdint>
#include <string.h>
#include "vteunistr.h"
#include "vtemacros.h"
#include "vtedefines.hh"
#include "attr.hh"
#include "color-triple.hh"
G_BEGIN_DECLS
#define VTE_TAB_WIDTH_BITS 4 /* Has to be able to store the value of 8. */
#define VTE_TAB_WIDTH_MAX ((1 << VTE_TAB_WIDTH_BITS) - 1)
#define VTE_TAB_WIDTH_MAX ((1 << VTE_ATTR_COLUMNS_BITS) - 1)
#define VTE_CELL_ATTR_COMMON_BYTES 12 /* The number of common bytes in VteCellAttr and VteStreamCellAttr */
......@@ -45,22 +44,30 @@ G_BEGIN_DECLS
* Also don't forget to update basic_cell below!
*/
#define CELL_ATTR_BOOL(lname,uname) \
inline constexpr void set_##lname(bool value) \
{ \
vte_attr_set_bool(&attr, VTE_ATTR_##uname##_MASK, value); \
} \
\
inline constexpr bool lname() const \
{ \
return vte_attr_get_bool(attr, VTE_ATTR_##uname##_SHIFT); \
}
#define CELL_ATTR_UINT(lname,uname) \
inline constexpr void set_##lname(unsigned int value) \
{ \
vte_attr_set_value(&attr, VTE_ATTR_##uname##_MASK, VTE_ATTR_##uname##_SHIFT, value); \
} \
\
inline constexpr uint32_t lname() const \
{ \
return vte_attr_get_value(attr, VTE_ATTR_##uname##_VALUE_MASK, VTE_ATTR_##uname##_SHIFT); \
}
typedef struct _VTE_GNUC_PACKED VteCellAttr {
uint32_t fragment : 1; /* A continuation cell. */
uint32_t columns : VTE_TAB_WIDTH_BITS; /* Number of visible columns
* (as determined by g_unicode_iswide(c)).
* Also abused for tabs; bug 353610
*/
uint32_t bold : 1;
uint32_t italic : 1;
uint32_t underline : 2; /* 0: none, 1: single, 2: double, 3: curly */
uint32_t strikethrough : 1;
uint32_t reverse : 1;
uint32_t blink : 1;
uint32_t dim : 1; /* also known as faint, half intensity etc. */
uint32_t invisible : 1;
uint32_t overline : 1;
uint32_t padding_unused : 17;
uint32_t attr;
/* 4-byte boundary (8-byte boundary in VteCell) */
uint64_t m_colors; /* fore, back and deco (underline) colour */
......@@ -74,6 +81,8 @@ typedef struct _VTE_GNUC_PACKED VteCellAttr {
(currently the height rounded up to the next power of two, times width)
for supported VTE sizes, and update VTE_HYPERLINK_IDX_TARGET_IN_STREAM. */
/* Methods */
inline constexpr uint64_t colors() const { return m_colors; }
inline constexpr void copy_colors(VteCellAttr const& other)
......@@ -96,6 +105,39 @@ typedef struct _VTE_GNUC_PACKED VteCellAttr {
CELL_ATTR_COLOR(back)
CELL_ATTR_COLOR(deco)
#undef CELL_ATTR_COLOR
inline constexpr bool has_any(uint32_t mask) const
{
return !!(attr & mask);
}
inline constexpr bool has_all(uint32_t mask) const
{
return (attr & mask) == mask;
}
inline constexpr bool has_none(uint32_t mask) const
{
return !(attr & mask);
}
inline constexpr void unset(uint32_t mask)
{
attr &= ~mask;
}
CELL_ATTR_UINT(columns, COLUMNS)
CELL_ATTR_BOOL(fragment, FRAGMENT)
CELL_ATTR_BOOL(bold, BOLD)
CELL_ATTR_BOOL(italic, ITALIC)
CELL_ATTR_UINT(underline, UNDERLINE)
CELL_ATTR_BOOL(strikethrough, STRIKETHROUGH)
CELL_ATTR_BOOL(overline, OVERLINE)
CELL_ATTR_BOOL(reverse, REVERSE)
CELL_ATTR_BOOL(blink, BLINK)
CELL_ATTR_BOOL(dim, DIM)
CELL_ATTR_BOOL(invisible, INVISIBLE)
/* ATTR_BOOL(boxed, BOXED) */
} VteCellAttr;
G_STATIC_ASSERT (sizeof (VteCellAttr) == 16);
G_STATIC_ASSERT (offsetof (VteCellAttr, hyperlink_idx) == VTE_CELL_ATTR_COMMON_BYTES);
......@@ -108,19 +150,24 @@ G_STATIC_ASSERT (offsetof (VteCellAttr, hyperlink_idx) == VTE_CELL_ATTR_COMMON_B
*/
typedef struct _VTE_GNUC_PACKED _VteStreamCellAttr {
uint32_t fragment : 1;
uint32_t columns : VTE_TAB_WIDTH_BITS;
uint32_t remaining_main_attributes_1 : 27; /* All the non-hyperlink related attributes from VteCellAttr, part 1.
We don't individually access them in the stream, so there's
no point in repeating each field separately. */
uint32_t attr; /* Same as VteCellAttr. We only access columns
* and fragment, however.
*/
/* 4-byte boundary */
uint64_t colors;
/* 12-byte boundary */
guint16 hyperlink_length; /* make sure it fits VTE_HYPERLINK_TOTAL_LENGTH_MAX */
/* Methods */
CELL_ATTR_UINT(columns, COLUMNS)
CELL_ATTR_BOOL(fragment, FRAGMENT)
} VteStreamCellAttr;
G_STATIC_ASSERT (sizeof (VteStreamCellAttr) == 14);
G_STATIC_ASSERT (offsetof (VteStreamCellAttr, hyperlink_length) == VTE_CELL_ATTR_COMMON_BYTES);
#undef CELL_ATTR_BOOL
#undef CELL_ATTR_UINT
/*
* VteCell: A single cell's data
*/
......@@ -134,18 +181,7 @@ G_STATIC_ASSERT (sizeof (VteCell) == 20);
static const VteCell basic_cell = {
0,
{
0, /* fragment */
1, /* columns */
0, /* bold */
0, /* italic */
0, /* underline */
0, /* strikethrough */
0, /* reverse */
0, /* blink */
0, /* dim */
0, /* invisible */
0, /* overline */
0, /* padding_unused */
VTE_ATTR_DEFAULT, /* attr */
VTE_COLOR_TRIPLE_INIT_DEFAULT, /* colors */
0, /* hyperlink_idx */
}
......
......@@ -1724,7 +1724,7 @@ VteTerminalPrivate::move_cursor_tab()
glong i;
VteCell *cell = _vte_row_data_get_writable (rowdata, col);
VteCell tab = *cell;
tab.attr.columns = newcol - col;
tab.attr.set_columns(newcol - col);
tab.c = '\t';
/* Save tab char */
*cell = tab;
......@@ -1732,8 +1732,8 @@ VteTerminalPrivate::move_cursor_tab()
for (i = col + 1; i < newcol; i++) {
cell = _vte_row_data_get_writable (rowdata, i);
cell->c = '\t';
cell->attr.columns = 1;
cell->attr.fragment = 1;
cell->attr.set_columns(1);
cell->attr.set_fragment(true);
}
}
......@@ -1879,7 +1879,7 @@ VteTerminalPrivate::seq_character_attributes(vte::parser::Params const& params)
switch (param0) {
case 4:
if (subparams.number_at(1, param1) && param1 >= 0 && param1 <= 3)
m_defaults.attr.underline = param1;
m_defaults.attr.set_underline(param1);
break;
case 38: {
unsigned int index = 1;
......@@ -1916,53 +1916,52 @@ VteTerminalPrivate::seq_character_attributes(vte::parser::Params const& params)
reset_default_attributes(false);
break;
case 1:
m_defaults.attr.bold = 1;
m_defaults.attr.set_bold(true);
break;
case 2:
m_defaults.attr.dim = 1;
m_defaults.attr.set_dim(true);
break;
case 3:
m_defaults.attr.italic = 1;
m_defaults.attr.set_italic(true);
break;
case 4:
m_defaults.attr.underline = 1;
m_defaults.attr.set_underline(1);
break;
case 5:
m_defaults.attr.blink = 1;
m_defaults.attr.set_blink(true);
break;
case 7:
m_defaults.attr.reverse = 1;
m_defaults.attr.set_reverse(true);
break;
case 8:
m_defaults.attr.invisible = 1;
m_defaults.attr.set_invisible(true);
break;
case 9:
m_defaults.attr.strikethrough = 1;
m_defaults.attr.set_strikethrough(true);
break;
case 21:
m_defaults.attr.underline = 2;
m_defaults.attr.set_underline(2);
break;
case 22: /* ECMA 48. */
m_defaults.attr.bold = 0;
m_defaults.attr.dim = 0;
m_defaults.attr.unset(VTE_ATTR_BOLD_MASK | VTE_ATTR_DIM_MASK);
break;
case 23:
m_defaults.attr.italic = 0;
m_defaults.attr.set_italic(false);
break;
case 24:
m_defaults.attr.underline = 0;
m_defaults.attr.set_underline(0);
break;
case 25:
m_defaults.attr.blink = 0;
m_defaults.attr.set_blink(false);
break;
case 27:
m_defaults.attr.reverse = 0;
m_defaults.attr.set_reverse(false);
break;
case 28:
m_defaults.attr.invisible = 0;
m_defaults.attr.set_invisible(false);
break;
case 29:
m_defaults.attr.strikethrough = 0;
m_defaults.attr.set_strikethrough(false);
break;
case 30:
case 31:
......@@ -2033,10 +2032,10 @@ VteTerminalPrivate::seq_character_attributes(vte::parser::Params const& params)
m_defaults.attr.set_back(VTE_DEFAULT_BG);
break;
case 53:
m_defaults.attr.overline = 1;
m_defaults.attr.set_overline(true);
break;
case 55:
m_defaults.attr.overline = 0;
m_defaults.attr.set_overline(false);
break;
/* case 58: was handled above at 38 to avoid code duplication */
case 59:
......@@ -2682,7 +2681,7 @@ VteTerminalPrivate::seq_screen_alignment_test(vte::parser::Params const& params)
VteCell cell;
cell.c = 'E';
cell.attr = basic_cell.attr;
cell.attr.columns = 1;
cell.attr.set_columns(1);
_vte_row_data_fill(rowdata, &cell, m_column_count);
emit_text_inserted();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment