mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 20:35:13 +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
|
@ -65,3 +65,18 @@ inline const LogStream& operator<<(const LogStream& stream, const TextPosition&
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<>
|
||||
struct Formatter<GUI::TextPosition> : Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const GUI::TextPosition& value)
|
||||
{
|
||||
if (value.is_valid())
|
||||
Formatter<StringView>::format(params, builder, String::formatted("({},{})", value.line(), value.column()));
|
||||
else
|
||||
Formatter<StringView>::format(params, builder, "GUI::TextPosition(Invalid)");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue