Skip to content

Commit e5736cd

Browse files
kleinesfilmroellchenlinusg
authored andcommitted
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.
1 parent da7a8a8 commit e5736cd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Userland/Applications/HexEditor/HexEditorWidget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ void HexEditorWidget::update_inspector_values(size_t position)
285285

286286
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, String::number(static_cast<i8>(unsigned_byte_value)));
287287
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, String::number(unsigned_byte_value));
288+
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, String::formatted("{:c}", static_cast<char>(unsigned_byte_value)));
288289
} else {
289290
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, "");
290291
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, "");
292+
value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, "");
291293
}
292294

293295
if (byte_read_count >= 2) {

Userland/Applications/HexEditor/ValueInspectorModel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ValueInspectorModel final : public GUI::Model {
2626
UnsignedLong,
2727
Float,
2828
Double,
29+
ASCII,
2930
__Count
3031
};
3132

@@ -90,6 +91,8 @@ class ValueInspectorModel final : public GUI::Model {
9091
return "Float";
9192
case Double:
9293
return "Double";
94+
case ASCII:
95+
return "ASCII";
9396
default:
9497
return "";
9598
}
@@ -112,6 +115,7 @@ class ValueInspectorModel final : public GUI::Model {
112115
switch (selected_type) {
113116
case SignedByte:
114117
case UnsignedByte:
118+
case ASCII:
115119
return 1;
116120
case SignedShort:
117121
case UnsignedShort:

0 commit comments

Comments
 (0)