summaryrefslogtreecommitdiff
path: root/Userland/Applications/HexEditor
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-04-12 18:59:23 +0200
committerLinus Groh <mail@linusgroh.de>2022-04-27 00:02:24 +0200
commite5736cdf2fd44d82adb95ef0b4f243fe334f51a6 (patch)
tree2bda153b4f881ecae3895b87f1377d1b42cc8a70 /Userland/Applications/HexEditor
parentda7a8a8711faa56514cd6c2c2788b5fe8ebaf869 (diff)
downloadserenity-e5736cdf2fd44d82adb95ef0b4f243fe334f51a6.zip
HexEditor: Add ASCII to the value inspector
This is kind of redundant but probably easier to read than the ASCII column. Also, it seems appropriate after we add other character encodings.
Diffstat (limited to 'Userland/Applications/HexEditor')
-rw-r--r--Userland/Applications/HexEditor/HexEditorWidget.cpp2
-rw-r--r--Userland/Applications/HexEditor/ValueInspectorModel.h4
2 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp
index a652e0a51a..b158939dc4 100644
--- a/Userland/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp
@@ -285,9 +285,11 @@ void HexEditorWidget::update_inspector_values(size_t position)
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, String::number(static_cast<i8>(unsigned_byte_value)));
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, String::number(unsigned_byte_value));
+ value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, String::formatted("{:c}", static_cast<char>(unsigned_byte_value)));
} else {
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, "");
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, "");
+ value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, "");
}
if (byte_read_count >= 2) {
diff --git a/Userland/Applications/HexEditor/ValueInspectorModel.h b/Userland/Applications/HexEditor/ValueInspectorModel.h
index de38cfd4fb..64fcbf20dc 100644
--- a/Userland/Applications/HexEditor/ValueInspectorModel.h
+++ b/Userland/Applications/HexEditor/ValueInspectorModel.h
@@ -26,6 +26,7 @@ public:
UnsignedLong,
Float,
Double,
+ ASCII,
__Count
};
@@ -90,6 +91,8 @@ public:
return "Float";
case Double:
return "Double";
+ case ASCII:
+ return "ASCII";
default:
return "";
}
@@ -112,6 +115,7 @@ public:
switch (selected_type) {
case SignedByte:
case UnsignedByte:
+ case ASCII:
return 1;
case SignedShort:
case UnsignedShort: