mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 14:15:07 +00:00
LibGUI: Add formatters for TextPosition and TextRange.
This commit is contained in:
parent
08585bc7e9
commit
6ed3a4b5fe
2 changed files with 30 additions and 0 deletions
|
@ -93,3 +93,18 @@ inline const LogStream& operator<<(const LogStream& stream, const TextRange& val
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<>
|
||||
struct Formatter<GUI::TextRange> : Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const GUI::TextRange& value)
|
||||
{
|
||||
if (value.is_valid())
|
||||
Formatter<StringView>::format(params, builder, String::formatted("{}-{}", value.start(), value.end()));
|
||||
else
|
||||
Formatter<StringView>::format(params, builder, "GUI::TextRange(Invalid)");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue