summaryrefslogtreecommitdiff
path: root/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-03-17 08:47:26 -0400
committerAndreas Kling <kling@serenityos.org>2022-03-18 01:12:26 +0100
commit5c27ce2561ad60af4a16a1f6b3dda9ea49b99250 (patch)
treecf095e2bf7bf1efc2745d112d9fc6fd09687e86a /Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
parent17b16f39976fb81465a42b46ff39702ab8afe508 (diff)
downloadserenity-5c27ce2561ad60af4a16a1f6b3dda9ea49b99250.zip
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.
Diffstat (limited to 'Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp')
-rw-r--r--Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
index 27f9f7cb7f..57d2211511 100644
--- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
+++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
@@ -85,9 +85,17 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
}
if (data_and_type.mime_type.starts_with("glyph/")) {
StringBuilder builder;
- builder.append("[");
- builder.append(data_and_type.metadata.get("count").value_or("?"));
- builder.append(" glyph(s)]");
+ auto count = data_and_type.metadata.get("count").value().to_uint().value_or(0);
+ auto start = data_and_type.metadata.get("start").value().to_uint().value_or(0);
+ 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 "<...>";