# HG changeset patch # User Edouard Tisserant # Date 1724109194 -7200 # Node ID 42730c1cb8794fe146087d002b8e05ba31e11369 # Parent 5d46adf7bbbad245941c2bd40ef4fb749e46d8ab IDE: fix completion uses ctrl key on Mac update internal variable list before listing them avoid exception if empty list apply selection when pressing return or enter diff -r 5d46adf7bbba -r 42730c1cb879 editors/TextViewer.py --- a/editors/TextViewer.py Tue Aug 20 00:35:00 2024 +0200 +++ b/editors/TextViewer.py Tue Aug 20 01:13:14 2024 +0200 @@ -877,13 +877,15 @@ lineText = self.Editor.GetTextRange(start_pos, end_pos).replace("\t", " ") # Code completion - if key == wx.WXK_SPACE and event.ControlDown(): + if key == wx.WXK_SPACE and event.RawControlDown(): words = lineText.split(" ") words = [word for i, word in enumerate(words) if word != '' or i == len(words) - 1] kw = [] + self.RefreshVariableTree() + if self.TextSyntax == "IL": if len(words) == 1: kw = self.Keywords @@ -898,13 +900,17 @@ kw = self.Keywords + list(self.Variables.keys()) + list(self.Functions.keys()) if len(kw) > 0: if len(words[-1]) > 0: - kw = [keyword for keyword in kw if keyword.startswith(words[-1])] + kw = [keyword for keyword in kw if keyword.startswith(words[-1].upper())] + if len(kw) > 0: kw.sort() self.Editor.AutoCompSetIgnoreCase(True) self.Editor.AutoCompShow(len(words[-1]), " ".join(kw)) key_handled = True elif key == wx.WXK_RETURN or key == wx.WXK_NUMPAD_ENTER: - if self.TextSyntax in ["ST", "ALL"]: + if self.Editor.AutoCompActive(): + self.Editor.AutoCompComplete() + key_handled = True + elif self.TextSyntax in ["ST", "ALL"]: indent = self.Editor.GetLineIndentation(line) if LineStartswith(lineText.strip(), self.BlockStartKeywords): indent = (indent // 2 + 1) * 2