mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
ClipboardHistory: Show ranges and max dimensions for copied glyphs
Makes copy history a bit more informative by showing the code point range of the selection copied, or the individual character if the selection contains only one glyph.
This commit is contained in:
parent
17b16f3997
commit
5c27ce2561
Notes:
sideshowbarker
2024-07-17 17:14:11 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/5c27ce2561 Pull-request: https://github.com/SerenityOS/serenity/pull/13089
1 changed files with 11 additions and 3 deletions
|
@ -85,9 +85,17 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
|
||||||
}
|
}
|
||||||
if (data_and_type.mime_type.starts_with("glyph/")) {
|
if (data_and_type.mime_type.starts_with("glyph/")) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("[");
|
auto count = data_and_type.metadata.get("count").value().to_uint().value_or(0);
|
||||||
builder.append(data_and_type.metadata.get("count").value_or("?"));
|
auto start = data_and_type.metadata.get("start").value().to_uint().value_or(0);
|
||||||
builder.append(" glyph(s)]");
|
auto width = data_and_type.metadata.get("width").value().to_uint().value_or(0);
|
||||||
|
auto height = data_and_type.metadata.get("height").value().to_uint().value_or(0);
|
||||||
|
if (count > 1) {
|
||||||
|
builder.appendff("U+{:04X}..U+{:04X} ({} glyphs) [{}x{}]", start, start + count - 1, count, width, height);
|
||||||
|
} else {
|
||||||
|
builder.appendff("U+{:04X} (", start);
|
||||||
|
builder.append_code_point(start);
|
||||||
|
builder.appendff(") [{}x{}]", width, height);
|
||||||
|
}
|
||||||
return builder.to_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
return "<...>";
|
return "<...>";
|
||||||
|
|
Loading…
Reference in a new issue