mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-05 21:45:25 +00:00
use split_iterator
This commit is contained in:
@@ -336,6 +336,18 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
|
||||
return sentinel{};
|
||||
}
|
||||
|
||||
typename iterator::value_type next() noexcept
|
||||
{
|
||||
const auto part = value();
|
||||
advance();
|
||||
return part;
|
||||
}
|
||||
|
||||
typename iterator::value_type remaining() noexcept
|
||||
{
|
||||
return { _it, _end };
|
||||
}
|
||||
|
||||
private:
|
||||
bool valid() const noexcept
|
||||
{
|
||||
|
||||
@@ -3863,21 +3863,15 @@ void AdaptDispatch::DoUrxvtAction(const std::wstring_view string)
|
||||
return;
|
||||
}
|
||||
|
||||
const auto action = til::at(parts, 0);
|
||||
|
||||
til::split_iterator split { string, L';' };
|
||||
const auto action = split.next();
|
||||
if (action == L"notify")
|
||||
{
|
||||
const auto title = parts.size() >= 2 ? til::at(parts, 1) : std::wstring_view{};
|
||||
// The body is everything after "notify;title;". We can't just use
|
||||
// parts[2] because the body itself may contain semicolons.
|
||||
std::wstring_view body;
|
||||
if (parts.size() >= 3)
|
||||
{
|
||||
const auto bodyStart = til::at(parts, 2).data();
|
||||
const auto stringEnd = string.data() + string.size();
|
||||
body = { bodyStart, static_cast<size_t>(stringEnd - bodyStart) };
|
||||
}
|
||||
_api.ShowNotification(title, body);
|
||||
const auto title = split.next();
|
||||
const auto body = split.remaining();
|
||||
_api.ShowNotification(title, body);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user