Skip to content

Commit

Permalink
Variable (pre)viewer: handle temp "equation" format (fix #287)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Oct 24, 2018
1 parent ea961e4 commit b9e725c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gui/qt/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ QString int2hex(uint32_t a, uint8_t l) {
}

std::string calc_var_content_string(const calc_var_t& var) {
const auto func = tivars::TIVarType::createFromID((uint)var.type).getHandlers().second;
tivars::stringFromData_handler_t func;
// We need to special case some specific temp-equ variables...
if (var.type == CALC_VAR_TYPE_EQU && var.name[0] == '$') {
func = &tivars::TH_TempEqu::makeStringFromData;
} else {
func = tivars::TIVarType::createFromID((uint)var.type).getHandlers().second;
}
const options_t opts = (var.type == CALC_VAR_TYPE_PROG || var.type == CALC_VAR_TYPE_STRING)
? options_t({ {"prettify", true} }) : options_t();
return func(data_t(var.data, var.data + var.size), opts);
Expand Down

0 comments on commit b9e725c

Please sign in to comment.