Browse Source

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.
kleines Filmröllchen 3 years ago
parent
commit
e5736cdf2f

+ 2 - 0
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::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::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 {
     } else {
         value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, "");
         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::UnsignedByte, "");
+        value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, "");
     }
     }
 
 
     if (byte_read_count >= 2) {
     if (byte_read_count >= 2) {

+ 4 - 0
Userland/Applications/HexEditor/ValueInspectorModel.h

@@ -26,6 +26,7 @@ public:
         UnsignedLong,
         UnsignedLong,
         Float,
         Float,
         Double,
         Double,
+        ASCII,
         __Count
         __Count
     };
     };
 
 
@@ -90,6 +91,8 @@ public:
             return "Float";
             return "Float";
         case Double:
         case Double:
             return "Double";
             return "Double";
+        case ASCII:
+            return "ASCII";
         default:
         default:
             return "";
             return "";
         }
         }
@@ -112,6 +115,7 @@ public:
             switch (selected_type) {
             switch (selected_type) {
             case SignedByte:
             case SignedByte:
             case UnsignedByte:
             case UnsignedByte:
+            case ASCII:
                 return 1;
                 return 1;
             case SignedShort:
             case SignedShort:
             case UnsignedShort:
             case UnsignedShort: