Fix non-marking as manually forced floating point variable if the value isn't integer
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 21 Feb 2019 10:17:38 +0300
changeset 2512 69cef4e37ef9
parent 2511 d6e0442a3986
child 2513 1ee326651a74
Fix non-marking as manually forced floating point variable if the value isn't integer

For example, if user in debug variable panel set any floating point
variable to 34.3, then it's not shown as forced (blue color) and user
can't release this enforcement.

If user changes the value to 34.0, then enforcement shows
correctly. This is done because binary representation of floating point
numbers in IDE and runtime can be slightly different (double vs float)
and as a result values aren't equal.
ProjectController.py
--- a/ProjectController.py	Thu Feb 14 10:27:24 2019 +0300
+++ b/ProjectController.py	Thu Feb 21 10:17:38 2019 +0300
@@ -1515,8 +1515,10 @@
                                 IECdebug_data = self.IECdebug_datas.get(
                                     IECPath, None)
                                 if IECdebug_data is not None and value is not None:
-                                    forced = IECdebug_data[2:4] == [
-                                        "Forced", value]
+                                    forced = (IECdebug_data[2] == "Forced") \
+                                        and (value is not None) and \
+                                        (IECdebug_data[3] is not None)
+
                                     if not IECdebug_data[4] and len(values_buffer) > 0:
                                         values_buffer[-1] = (value, forced)
                                     else: