mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
LibLine: Add support for user-controlled masking
This commit is contained in:
parent
c257d27f0b
commit
78dc77f7e4
5 changed files with 212 additions and 59 deletions
|
@ -21,17 +21,7 @@ struct StringMetrics {
|
|||
Vector<MaskedChar> masked_chars;
|
||||
size_t length { 0 };
|
||||
|
||||
size_t total_length(ssize_t offset = -1) const
|
||||
{
|
||||
size_t length = this->length;
|
||||
for (auto& mask : masked_chars) {
|
||||
if (offset < 0 || mask.position <= (size_t)offset) {
|
||||
length -= mask.original_length;
|
||||
length += mask.masked_length;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
size_t total_length() const { return length; }
|
||||
};
|
||||
|
||||
Vector<LineMetrics> line_metrics;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue