# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1550733458 -10800
# Node ID 69cef4e37ef933c3e403c9b52c9f5bd2f49aeec4
# Parent  d6e0442a39864f918aea1a20f4529eb91bfcd0ec
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.

diff -r d6e0442a3986 -r 69cef4e37ef9 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: