зеркало из https://github.com/microsoft/terminal.git
Родитель
faf21acbc7
Коммит
735ef2823e
|
@ -1425,6 +1425,11 @@ PointTree Terminal::_getPatterns(til::CoordType beg, til::CoordType end) const
|
|||
LR"(\b(?:https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|$!:,.;]*[A-Za-z0-9+&@#/%=~_|$])",
|
||||
};
|
||||
|
||||
if (!_detectURLs)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto text = ICU::UTextFromTextBuffer(_activeBuffer(), beg, end + 1);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
PointTree::interval_vector intervals;
|
||||
|
|
|
@ -607,6 +607,13 @@ void TerminalBufferTests::TestURLPatternDetection()
|
|||
constexpr auto urlStartX = BeforeStr.size();
|
||||
constexpr auto urlEndX = BeforeStr.size() + UrlStr.size() - 1;
|
||||
|
||||
// This is off by default; turn it on for the test.
|
||||
auto originalDetectURLs = term->_detectURLs;
|
||||
auto restoreDetectUrls = wil::scope_exit([&]() {
|
||||
term->_detectURLs = originalDetectURLs;
|
||||
});
|
||||
term->_detectURLs = true;
|
||||
|
||||
auto& termSm = *term->_stateMachine;
|
||||
termSm.ProcessString(fmt::format(FMT_COMPILE(L"{}{}{}"), BeforeStr, UrlStr, AfterStr));
|
||||
term->UpdatePatternsUnderLock();
|
||||
|
|
Загрузка…
Ссылка в новой задаче