When rewriting the data structure FileDict, it can occur that the lines
in the 'line_list' list are not sorted anymore. To ensure reliability
for the 'bisect_right' call in the 'get_line_info_raw', the list is now
sorted after each insertion.
Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
codeface/fileCommit.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/codeface/fileCommit.py b/codeface/fileCommit.py
index c6b530a..08b1274 100644
--- a/codeface/fileCommit.py
+++ b/codeface/fileCommit.py
@@ -78,6 +78,11 @@ class FileDict:
if line_nr < self.lastItem:
raise ValueError("can only incrementally add items")
self.line_list.append(line_nr)
+
+ # to ensure reliability for the 'bisect_right' call in the function
+ # 'get_line_info_raw', make sure the lines in the line_list are sorted
+ self.line_list.sort()
+
self.line_dict[line_nr] = info
def values(self):
--
2.10.2