mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibVT+Terminal: Support hyperlinks in the terminal :^)
We now support basic hyperlinking in the terminal with <OSC>;8;;URL<ST> Links are opened via LaunchServer on Ctrl+LeftMouse.
This commit is contained in:
parent
427863f275
commit
f596b12a04
7 changed files with 62 additions and 6 deletions
|
@ -61,7 +61,8 @@ void Terminal::Line::set_length(u16 new_length)
|
|||
memset(new_characters, ' ', new_length);
|
||||
if (characters && attributes) {
|
||||
memcpy(new_characters, characters, min(m_length, new_length));
|
||||
memcpy(new_attributes, attributes, min(m_length, new_length) * sizeof(Attribute));
|
||||
for (size_t i = 0; i < min(m_length, new_length); ++i)
|
||||
new_attributes[i] = attributes[i];
|
||||
}
|
||||
delete[] characters;
|
||||
delete[] attributes;
|
||||
|
@ -605,6 +606,11 @@ void Terminal::execute_xterm_command()
|
|||
case 2:
|
||||
m_client.set_window_title(params[1]);
|
||||
break;
|
||||
case 8:
|
||||
m_current_attribute.href = params[2];
|
||||
// FIXME: Respect the provided ID
|
||||
m_current_attribute.href_id = String::format("%u", m_next_href_id++);
|
||||
break;
|
||||
default:
|
||||
unimplemented_xterm_escape();
|
||||
break;
|
||||
|
@ -1076,4 +1082,16 @@ void Terminal::execute_hashtag(u8 hashtag)
|
|||
}
|
||||
}
|
||||
|
||||
Attribute Terminal::attribute_at(const Position& position) const
|
||||
{
|
||||
if (!position.is_valid())
|
||||
return {};
|
||||
if (position.row() >= static_cast<int>(m_lines.size()))
|
||||
return {};
|
||||
auto& line = this->line(position.row());
|
||||
if (position.column() >= line.m_length)
|
||||
return {};
|
||||
return line.attributes[position.column()];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue