From 8457bc4efb87ec375a45d2ab5ee9fe6b6892fe9f Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 13 Feb 2015 15:47:29 +0100 Subject: [PATCH 1/3] bug fix: storage view in debug pane broken for long values. --- libethcore/CommonJS.cpp | 11 ++++++++--- libethcore/CommonJS.h | 2 +- mix/qml/Debugger.qml | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libethcore/CommonJS.cpp b/libethcore/CommonJS.cpp index 3ed4e2796..aa39c8e0c 100644 --- a/libethcore/CommonJS.cpp +++ b/libethcore/CommonJS.cpp @@ -97,7 +97,7 @@ std::string fromRaw(h256 _n, unsigned* _inc) return ""; } -std::string prettyU256(u256 _n) +std::string prettyU256(u256 _n, bool _abridged) { unsigned inc = 0; std::string raw; @@ -110,11 +110,16 @@ std::string prettyU256(u256 _n) { Address a = right160(_n); - std::string n = a.abridged(); + std::string n; + if (_abridged) + n = a.abridged(); + else + n = toHex(a.ref()); + if (n.empty()) s << "0x" << a; else - s << n << "(0x" << a.abridged() << ")"; + s << n << "(0x" << n << ")"; } else if ((raw = fromRaw((h256)_n, &inc)).size()) return "\"" + raw + "\"" + (inc ? " + " + std::to_string(inc) : ""); diff --git a/libethcore/CommonJS.h b/libethcore/CommonJS.h index ccc3b3103..2f82d8945 100644 --- a/libethcore/CommonJS.h +++ b/libethcore/CommonJS.h @@ -59,7 +59,7 @@ bytes unpadded(bytes _s); /// Remove all 0 byte on the head of @a _s. bytes unpadLeft(bytes _s); /// Convert u256 into user-readable string. Returns int/hex value of 64 bits int, hex of 160 bits FixedHash. As a fallback try to handle input as h256. -std::string prettyU256(u256 _n); +std::string prettyU256(u256 _n, bool _abridged = true); /// Convert h256 into user-readable string (by directly using std::string constructor). std::string fromRaw(h256 _n, unsigned* _inc = nullptr); /// Convert string to Address (h160), returns empty address if (_a.size != 40). diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index 644a7f975..1dd05574f 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -598,9 +598,11 @@ Rectangle { Layout.minimumWidth: parent.width / 2 Layout.maximumWidth: parent.width / 2 Text { + maximumLineCount: 1 + clip: true anchors.leftMargin: 5 width: parent.width - 5 - wrapMode: Text.NoWrap + wrapMode: Text.WrapAnywhere anchors.left: parent.left font.family: "monospace" anchors.verticalCenter: parent.verticalCenter From 2ff89547d6013a84dbfe78ae06909a7911d2930c Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 13 Feb 2015 16:48:40 +0100 Subject: [PATCH 2/3] Change in formatting storage values. --- libethcore/CommonJS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libethcore/CommonJS.cpp b/libethcore/CommonJS.cpp index aa39c8e0c..cc63785bc 100644 --- a/libethcore/CommonJS.cpp +++ b/libethcore/CommonJS.cpp @@ -117,9 +117,9 @@ std::string prettyU256(u256 _n, bool _abridged) n = toHex(a.ref()); if (n.empty()) - s << "0x" << a; + s << "0x0"; else - s << n << "(0x" << n << ")"; + s << "0x" << n <<; } else if ((raw = fromRaw((h256)_n, &inc)).size()) return "\"" + raw + "\"" + (inc ? " + " + std::to_string(inc) : ""); From 53e901930dfdaffc74f2e1f2d90061e7f0cac34d Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 13 Feb 2015 16:52:10 +0100 Subject: [PATCH 3/3] small changes --- libethcore/CommonJS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libethcore/CommonJS.cpp b/libethcore/CommonJS.cpp index cc63785bc..388738528 100644 --- a/libethcore/CommonJS.cpp +++ b/libethcore/CommonJS.cpp @@ -117,9 +117,9 @@ std::string prettyU256(u256 _n, bool _abridged) n = toHex(a.ref()); if (n.empty()) - s << "0x0"; + s << "0"; else - s << "0x" << n <<; + s << _n << "(0x" << n << ")"; } else if ((raw = fromRaw((h256)_n, &inc)).size()) return "\"" + raw + "\"" + (inc ? " + " + std::to_string(inc) : "");