mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 18:11:39 -05:00
Add support for autodetecting URLs and making hyperlinks (#7691)
This pull request is the initial implementation of hyperlink auto detection Overall design: - Upon startup, TerminalCore gives the TextBuffer some patterns it should know about - Whenever something in the viewport changes (i.e. text output/scrolling), TerminalControl tells TerminalCore (through a throttled function for performance) to retrieve the visible pattern locations from the TextBuffer - When the renderer encounters a region that is associated with a pattern, it paints that region differently References #5001 Closes #574
This commit is contained in:
@@ -133,6 +133,32 @@ const std::wstring Microsoft::Terminal::Core::Terminal::GetHyperlinkCustomId(uin
|
||||
return _buffer->GetCustomIdFromId(id);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Gets the regex pattern ids of a location
|
||||
// Arguments:
|
||||
// - The location
|
||||
// Return value:
|
||||
// - The pattern IDs of the location
|
||||
const std::vector<size_t> Terminal::GetPatternId(const COORD location) const noexcept
|
||||
{
|
||||
// Look through our interval tree for this location
|
||||
const auto intervals = _patternIntervalTree.findOverlapping(COORD{ location.X + 1, location.Y }, location);
|
||||
if (intervals.size() == 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<size_t> result{};
|
||||
for (const auto& interval : intervals)
|
||||
{
|
||||
result.emplace_back(interval.value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<Microsoft::Console::Types::Viewport> Terminal::GetSelectionRects() noexcept
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user