diff --git a/source/views/view_pattern.cpp b/source/views/view_pattern.cpp index 6a80742a8..7d3b0e762 100644 --- a/source/views/view_pattern.cpp +++ b/source/views/view_pattern.cpp @@ -139,7 +139,7 @@ namespace hex { s32 ViewPattern::highlightUsingDecls(std::vector &ast, lang::ASTNodeTypeDecl* currTypeDeclNode, lang::ASTNodeVariableDecl* currVarDecl, u64 offset) { if (currTypeDeclNode->getAssignedType() != lang::Token::TypeToken::Type::CustomType) { - size_t size = (static_cast(currTypeDeclNode->getAssignedType()) >> 4) * currVarDecl->getArraySize(); + size_t size = (static_cast(currTypeDeclNode->getAssignedType()) >> 4); this->setHighlight(offset, size, currVarDecl->getVariableName()); offset += size; @@ -191,19 +191,22 @@ namespace hex { offset += size; } - offset += size; foundType = true; break; } for (auto &typeDeclNode : findNodes(lang::ASTNode::Type::TypeDecl, ast)) if (typeDeclNode->getTypeName() == var->getCustomVariableTypeName()) { - auto size = this->highlightUsingDecls(ast, typeDeclNode, var, offset); + size_t size = 0; + for (size_t i = 0; i < var->getArraySize(); i++) { + size = this->highlightUsingDecls(ast, typeDeclNode, var, offset); - if (size == -1) - return -1; + if (size == -1) + return -1; + + offset += size; + } - offset = size; foundType = true; break; }