[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kcalc] /: fix for bug #319115, the issue was two fold:
From: Evan Teran <eteran () alum ! rit ! edu>
Date: 2013-04-30 20:21:40
Message-ID: 20130430202140.53111A603F () git ! kde ! org
[Download RAW message or body]
Git commit 470bbf73c02ec47b43fdc3b4009e3534b621b4ce by Evan Teran.
Committed on 30/04/2013 at 22:20.
Pushed by teran into branch 'master'.
fix for bug #319115, the issue was two fold:
for 0.1234 and such
"^([+-]?\\d+)(%1\\d*)?(e([+-]?\\d+))?$"
to this
"^([+-]?\\d*)(%1\\d*)?(e([+-]?\\d+))?$"
(NOTE: %1 is the placeholder for the locale's decimal separator)
M +5 -2 kcalcdisplay.cpp
M +1 -1 knumber/knumber.cpp
http://commits.kde.org/kcalc/470bbf73c02ec47b43fdc3b4009e3534b621b4ce
diff --git a/kcalcdisplay.cpp b/kcalcdisplay.cpp
index 0e0d52b..a675e09 100644
--- a/kcalcdisplay.cpp
+++ b/kcalcdisplay.cpp
@@ -292,8 +292,11 @@ void KCalcDisplay::slotPaste(bool bClipboard) {
tmp_num_base = NB_BINARY;
tmp_str.remove(0, 2);
} else if (tmp_str.startsWith(QLatin1String("0"))) {
- tmp_num_base = NB_OCTAL;
- tmp_str.remove(0, 1);
+ // we don't want this to trigger on "0.xxxxxx" cases
+ if(tmp_str.length() < 2 || QString(tmp_str[1]) != KNumber::decimalSeparator()) {
+ tmp_num_base = NB_OCTAL;
+ tmp_str.remove(0, 1);
+ }
}
if (tmp_num_base != NB_DECIMAL) {
diff --git a/knumber/knumber.cpp b/knumber/knumber.cpp
index ac49573..752996b 100644
--- a/knumber/knumber.cpp
+++ b/knumber/knumber.cpp
@@ -278,7 +278,7 @@ KNumber::KNumber(const QString &s) : value_(0) {
const QRegExp special_regex(QLatin1String("^(inf|-inf|nan)$"));
const QRegExp integer_regex(QLatin1String("^[+-]?\\d+$"));
const QRegExp fraction_regex(QLatin1String("^[+-]?\\d+/\\d+$"));
- const QRegExp float_regex(QString(QLatin1String("^([+-]?\\d+)(%1\\d*)?(e([+-]?\\d+))?$")).arg(QRegExp::escape(DecimalSeparator)));
+ const QRegExp float_regex(QString(QLatin1String("^([+-]?\\d*)(%1\\d*)?(e([+-]?\\d+))?$")).arg(QRegExp::escape(DecimalSeparator)));
if (special_regex.exactMatch(s)) {
value_ = new detail::knumber_error(s);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic