mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d
.
It replaced "codepoint" with "code_points", not "code_point".
This commit is contained in:
parent
9664bac281
commit
19ac1f6368
45 changed files with 449 additions and 449 deletions
|
@ -37,25 +37,25 @@ Line::Line(u16 length)
|
|||
Line::~Line()
|
||||
{
|
||||
if (m_utf32)
|
||||
delete[] m_code_pointss.as_u32;
|
||||
delete[] m_codepoints.as_u32;
|
||||
else
|
||||
delete[] m_code_pointss.as_u8;
|
||||
delete[] m_codepoints.as_u8;
|
||||
delete[] m_attributes;
|
||||
}
|
||||
|
||||
template<typename CodepointType>
|
||||
static CodepointType* create_new_code_points_array(size_t new_length, const CodepointType* old_code_pointss, size_t old_length)
|
||||
static CodepointType* create_new_codepoint_array(size_t new_length, const CodepointType* old_codepoints, size_t old_length)
|
||||
{
|
||||
auto* new_code_pointss = new CodepointType[new_length];
|
||||
auto* new_codepoints = new CodepointType[new_length];
|
||||
for (size_t i = 0; i < new_length; ++i)
|
||||
new_code_pointss[i] = ' ';
|
||||
if (old_code_pointss) {
|
||||
new_codepoints[i] = ' ';
|
||||
if (old_codepoints) {
|
||||
for (size_t i = 0; i < min(old_length, new_length); ++i) {
|
||||
new_code_pointss[i] = old_code_pointss[i];
|
||||
new_codepoints[i] = old_codepoints[i];
|
||||
}
|
||||
}
|
||||
delete[] old_code_pointss;
|
||||
return new_code_pointss;
|
||||
delete[] old_codepoints;
|
||||
return new_codepoints;
|
||||
}
|
||||
|
||||
void Line::set_length(u16 new_length)
|
||||
|
@ -64,9 +64,9 @@ void Line::set_length(u16 new_length)
|
|||
return;
|
||||
|
||||
if (m_utf32)
|
||||
m_code_pointss.as_u32 = create_new_code_points_array<u32>(new_length, m_code_pointss.as_u32, m_length);
|
||||
m_codepoints.as_u32 = create_new_codepoint_array<u32>(new_length, m_codepoints.as_u32, m_length);
|
||||
else
|
||||
m_code_pointss.as_u8 = create_new_code_points_array<u8>(new_length, m_code_pointss.as_u8, m_length);
|
||||
m_codepoints.as_u8 = create_new_codepoint_array<u8>(new_length, m_codepoints.as_u8, m_length);
|
||||
|
||||
auto* new_attributes = new Attribute[new_length];
|
||||
if (m_attributes) {
|
||||
|
@ -82,15 +82,15 @@ void Line::clear(Attribute attribute)
|
|||
{
|
||||
if (m_dirty) {
|
||||
for (u16 i = 0; i < m_length; ++i) {
|
||||
set_code_points(i, ' ');
|
||||
set_codepoint(i, ' ');
|
||||
m_attributes[i] = attribute;
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (unsigned i = 0; i < m_length; ++i) {
|
||||
if (code_points(i) != ' ')
|
||||
if (codepoint(i) != ' ')
|
||||
m_dirty = true;
|
||||
set_code_points(i, ' ');
|
||||
set_codepoint(i, ' ');
|
||||
}
|
||||
for (unsigned i = 0; i < m_length; ++i) {
|
||||
if (m_attributes[i] != attribute)
|
||||
|
@ -115,12 +115,12 @@ bool Line::has_only_one_background_color() const
|
|||
void Line::convert_to_utf32()
|
||||
{
|
||||
ASSERT(!m_utf32);
|
||||
auto* new_code_pointss = new u32[m_length];
|
||||
auto* new_codepoints = new u32[m_length];
|
||||
for (size_t i = 0; i < m_length; ++i) {
|
||||
new_code_pointss[i] = m_code_pointss.as_u8[i];
|
||||
new_codepoints[i] = m_codepoints.as_u8[i];
|
||||
}
|
||||
delete m_code_pointss.as_u8;
|
||||
m_code_pointss.as_u32 = new_code_pointss;
|
||||
delete m_codepoints.as_u8;
|
||||
m_codepoints.as_u32 = new_codepoints;
|
||||
m_utf32 = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,22 +90,22 @@ public:
|
|||
|
||||
u16 length() const { return m_length; }
|
||||
|
||||
u32 code_points(size_t index) const
|
||||
u32 codepoint(size_t index) const
|
||||
{
|
||||
if (m_utf32)
|
||||
return m_code_pointss.as_u32[index];
|
||||
return m_code_pointss.as_u8[index];
|
||||
return m_codepoints.as_u32[index];
|
||||
return m_codepoints.as_u8[index];
|
||||
}
|
||||
|
||||
void set_code_points(size_t index, u32 code_points)
|
||||
void set_codepoint(size_t index, u32 codepoint)
|
||||
{
|
||||
if (!m_utf32 && code_points & 0xffffff80u)
|
||||
if (!m_utf32 && codepoint & 0xffffff80u)
|
||||
convert_to_utf32();
|
||||
|
||||
if (m_utf32)
|
||||
m_code_pointss.as_u32[index] = code_points;
|
||||
m_codepoints.as_u32[index] = codepoint;
|
||||
else
|
||||
m_code_pointss.as_u8[index] = code_points;
|
||||
m_codepoints.as_u8[index] = codepoint;
|
||||
}
|
||||
|
||||
bool is_dirty() const { return m_dirty; }
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
union {
|
||||
u8* as_u8;
|
||||
u32* as_u32;
|
||||
} m_code_pointss { nullptr };
|
||||
} m_codepoints { nullptr };
|
||||
Attribute* m_attributes { nullptr };
|
||||
bool m_dirty { false };
|
||||
bool m_utf32 { false };
|
||||
|
|
|
@ -361,7 +361,7 @@ void Terminal::escape$b(const ParamVector& params)
|
|||
return;
|
||||
|
||||
for (unsigned i = 0; i < params[0]; ++i)
|
||||
put_character_at(m_cursor_row, m_cursor_column++, m_last_code_points);
|
||||
put_character_at(m_cursor_row, m_cursor_column++, m_last_codepoint);
|
||||
}
|
||||
|
||||
void Terminal::escape$d(const ParamVector& params)
|
||||
|
@ -537,11 +537,11 @@ void Terminal::escape$P(const ParamVector& params)
|
|||
|
||||
// Move n characters of line to the left
|
||||
for (int i = m_cursor_column; i < line.length() - num; i++)
|
||||
line.set_code_points(i, line.code_points(i + num));
|
||||
line.set_codepoint(i, line.codepoint(i + num));
|
||||
|
||||
// Fill remainder of line with blanks
|
||||
for (int i = line.length() - num; i < line.length(); i++)
|
||||
line.set_code_points(i, ' ');
|
||||
line.set_codepoint(i, ' ');
|
||||
|
||||
line.set_dirty(true);
|
||||
}
|
||||
|
@ -768,17 +768,17 @@ void Terminal::set_cursor(unsigned a_row, unsigned a_column)
|
|||
invalidate_cursor();
|
||||
}
|
||||
|
||||
void Terminal::put_character_at(unsigned row, unsigned column, u32 code_points)
|
||||
void Terminal::put_character_at(unsigned row, unsigned column, u32 codepoint)
|
||||
{
|
||||
ASSERT(row < rows());
|
||||
ASSERT(column < columns());
|
||||
auto& line = m_lines[row];
|
||||
line.set_code_points(column, code_points);
|
||||
line.set_codepoint(column, codepoint);
|
||||
line.attributes()[column] = m_current_attribute;
|
||||
line.attributes()[column].flags |= Attribute::Touched;
|
||||
line.set_dirty(true);
|
||||
|
||||
m_last_code_points = code_points;
|
||||
m_last_codepoint = codepoint;
|
||||
}
|
||||
|
||||
void Terminal::NEL()
|
||||
|
@ -820,14 +820,14 @@ void Terminal::on_input(u8 ch)
|
|||
|
||||
auto fail_utf8_parse = [this] {
|
||||
m_parser_state = Normal;
|
||||
on_code_points('%');
|
||||
on_codepoint('%');
|
||||
};
|
||||
|
||||
auto advance_utf8_parse = [this, ch] {
|
||||
m_parser_code_points <<= 6;
|
||||
m_parser_code_points |= ch & 0x3f;
|
||||
m_parser_codepoint <<= 6;
|
||||
m_parser_codepoint |= ch & 0x3f;
|
||||
if (m_parser_state == UTF8Needs1Byte) {
|
||||
on_code_points(m_parser_code_points);
|
||||
on_codepoint(m_parser_codepoint);
|
||||
m_parser_state = Normal;
|
||||
} else {
|
||||
m_parser_state = (ParserState)(m_parser_state + 1);
|
||||
|
@ -928,17 +928,17 @@ void Terminal::on_input(u8 ch)
|
|||
break;
|
||||
if ((ch & 0xe0) == 0xc0) {
|
||||
m_parser_state = UTF8Needs1Byte;
|
||||
m_parser_code_points = ch & 0x1f;
|
||||
m_parser_codepoint = ch & 0x1f;
|
||||
return;
|
||||
}
|
||||
if ((ch & 0xf0) == 0xe0) {
|
||||
m_parser_state = UTF8Needs2Bytes;
|
||||
m_parser_code_points = ch & 0x0f;
|
||||
m_parser_codepoint = ch & 0x0f;
|
||||
return;
|
||||
}
|
||||
if ((ch & 0xf8) == 0xf0) {
|
||||
m_parser_state = UTF8Needs3Bytes;
|
||||
m_parser_code_points = ch & 0x07;
|
||||
m_parser_codepoint = ch & 0x07;
|
||||
return;
|
||||
}
|
||||
fail_utf8_parse();
|
||||
|
@ -978,26 +978,26 @@ void Terminal::on_input(u8 ch)
|
|||
return;
|
||||
}
|
||||
|
||||
on_code_points(ch);
|
||||
on_codepoint(ch);
|
||||
}
|
||||
|
||||
void Terminal::on_code_points(u32 code_points)
|
||||
void Terminal::on_codepoint(u32 codepoint)
|
||||
{
|
||||
auto new_column = m_cursor_column + 1;
|
||||
if (new_column < columns()) {
|
||||
put_character_at(m_cursor_row, m_cursor_column, code_points);
|
||||
put_character_at(m_cursor_row, m_cursor_column, codepoint);
|
||||
set_cursor(m_cursor_row, new_column);
|
||||
return;
|
||||
}
|
||||
if (m_stomp) {
|
||||
m_stomp = false;
|
||||
newline();
|
||||
put_character_at(m_cursor_row, m_cursor_column, code_points);
|
||||
put_character_at(m_cursor_row, m_cursor_column, codepoint);
|
||||
set_cursor(m_cursor_row, 1);
|
||||
} else {
|
||||
// Curious: We wait once on the right-hand side
|
||||
m_stomp = true;
|
||||
put_character_at(m_cursor_row, m_cursor_column, code_points);
|
||||
put_character_at(m_cursor_row, m_cursor_column, codepoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ void Terminal::handle_key_press(KeyCode key, u32 code_point, u8 flags)
|
|||
emit_string("\033");
|
||||
|
||||
StringBuilder sb;
|
||||
sb.append_code_points(code_point);
|
||||
sb.append_codepoint(code_point);
|
||||
|
||||
emit_string(sb.to_string());
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
private:
|
||||
typedef Vector<unsigned, 4> ParamVector;
|
||||
|
||||
void on_code_points(u32);
|
||||
void on_codepoint(u32);
|
||||
|
||||
void scroll_up();
|
||||
void scroll_down();
|
||||
|
@ -193,13 +193,13 @@ private:
|
|||
};
|
||||
|
||||
ParserState m_parser_state { Normal };
|
||||
u32 m_parser_code_points { 0 };
|
||||
u32 m_parser_codepoint { 0 };
|
||||
Vector<u8> m_parameters;
|
||||
Vector<u8> m_intermediates;
|
||||
Vector<u8> m_xterm_parameters;
|
||||
Vector<bool> m_horizontal_tabs;
|
||||
u8 m_final { 0 };
|
||||
u32 m_last_code_points { 0 };
|
||||
u32 m_last_codepoint { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event)
|
|||
painter.clear_rect(row_rect, color_from_rgb(line.attributes()[0].background_color).with_alpha(m_opacity));
|
||||
|
||||
for (size_t column = 0; column < line.length(); ++column) {
|
||||
u32 code_points = line.code_points(column);
|
||||
u32 codepoint = line.codepoint(column);
|
||||
bool should_reverse_fill_for_cursor_or_selection = m_cursor_blink_state
|
||||
&& m_has_logical_focus
|
||||
&& visual_row == row_with_cursor
|
||||
|
@ -342,12 +342,12 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
if (code_points == ' ')
|
||||
if (codepoint == ' ')
|
||||
continue;
|
||||
|
||||
painter.draw_glyph_or_emoji(
|
||||
character_rect.location(),
|
||||
code_points,
|
||||
codepoint,
|
||||
attribute.flags & VT::Attribute::Bold ? bold_font() : font(),
|
||||
text_color);
|
||||
}
|
||||
|
@ -524,16 +524,16 @@ void TerminalWidget::doubleclick_event(GUI::MouseEvent& event)
|
|||
|
||||
auto position = buffer_position_at(event.position());
|
||||
auto& line = m_terminal.line(position.row());
|
||||
bool want_whitespace = line.code_points(position.column()) == ' ';
|
||||
bool want_whitespace = line.codepoint(position.column()) == ' ';
|
||||
|
||||
int start_column = 0;
|
||||
int end_column = 0;
|
||||
|
||||
for (int column = position.column(); column >= 0 && (line.code_points(column) == ' ') == want_whitespace; --column) {
|
||||
for (int column = position.column(); column >= 0 && (line.codepoint(column) == ' ') == want_whitespace; --column) {
|
||||
start_column = column;
|
||||
}
|
||||
|
||||
for (int column = position.column(); column < m_terminal.columns() && (line.code_points(column) == ' ') == want_whitespace; ++column) {
|
||||
for (int column = position.column(); column < m_terminal.columns() && (line.codepoint(column) == ' ') == want_whitespace; ++column) {
|
||||
end_column = column;
|
||||
}
|
||||
|
||||
|
@ -715,10 +715,10 @@ String TerminalWidget::selected_text() const
|
|||
}
|
||||
// FIXME: This is a bit hackish.
|
||||
if (line.is_utf32()) {
|
||||
u32 code_points = line.code_points(column);
|
||||
builder.append(Utf32View(&code_points, 1));
|
||||
u32 codepoint = line.codepoint(column);
|
||||
builder.append(Utf32View(&codepoint, 1));
|
||||
} else {
|
||||
builder.append(line.code_points(column));
|
||||
builder.append(line.codepoint(column));
|
||||
}
|
||||
if (column == line.length() - 1 || (m_rectangle_selection && column == last_column)) {
|
||||
builder.append('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue