From 823862979573cef19d7fa6902716fe4f3ce4b267 Mon Sep 17 00:00:00 2001 From: Helio Guilherme Date: Thu, 12 Oct 2023 20:40:44 +0100 Subject: [PATCH 1/2] Fix double actions Ctrl-V in Windows on Text Editor --- src/robotide/editor/texteditor.py | 2 +- src/robotide/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/robotide/editor/texteditor.py b/src/robotide/editor/texteditor.py index df59a4f21..5865d7777 100644 --- a/src/robotide/editor/texteditor.py +++ b/src/robotide/editor/texteditor.py @@ -89,8 +89,8 @@ def f(event): if IS_MAC: # Mac needs this key binding self.register_shortcut('CtrlCmd-A', focused(lambda e: self._editor.select_all())) - if IS_WINDOWS or IS_MAC: # Linux does not need this key binding self.register_shortcut('CtrlCmd-V', focused(lambda e: self._editor.paste())) + # IS_WINDOWS and Linux does not need this key binding self.register_shortcut('CtrlCmd-S', focused(lambda e: self.on_saving(e))) self.register_shortcut('CtrlCmd-F', focused(lambda e: self._editor.search_field.SetFocus())) # To avoid double actions these moved to on_key_down diff --git a/src/robotide/version.py b/src/robotide/version.py index 43232babe..afcea282d 100644 --- a/src/robotide/version.py +++ b/src/robotide/version.py @@ -14,4 +14,4 @@ # limitations under the License. # # Automatically generated by `tasks.py`. -VERSION = 'v2.0.8dev21' +VERSION = 'v2.0.8dev22' From 5530965beafcab9c4667e0af3140dd78fcc5b727 Mon Sep 17 00:00:00 2001 From: Helio Guilherme Date: Thu, 12 Oct 2023 22:07:55 +0100 Subject: [PATCH 2/2] Fix navigation from selected item on Tree in Text Editor, on Windows --- src/robotide/editor/texteditor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/robotide/editor/texteditor.py b/src/robotide/editor/texteditor.py index 5865d7777..aed49e849 100644 --- a/src/robotide/editor/texteditor.py +++ b/src/robotide/editor/texteditor.py @@ -91,7 +91,7 @@ def f(event): self.register_shortcut('CtrlCmd-A', focused(lambda e: self._editor.select_all())) self.register_shortcut('CtrlCmd-V', focused(lambda e: self._editor.paste())) # IS_WINDOWS and Linux does not need this key binding - self.register_shortcut('CtrlCmd-S', focused(lambda e: self.on_saving(e))) + # self.register_shortcut('CtrlCmd-S', focused(lambda e: self.on_saving(e))) self.register_shortcut('CtrlCmd-F', focused(lambda e: self._editor.search_field.SetFocus())) # To avoid double actions these moved to on_key_down # self.register_shortcut('CtrlCmd-G', focused(lambda e: self._editor.on_find(e))) @@ -163,6 +163,7 @@ def on_tree_selection(self, message): if self._editor.datafile_controller == message.item.datafile_controller == next_datafile_controller: # print(f"DEBUG: OnTreeSelection Same FILE item type={type(message.item)}") self._editor.locate_tree_item(message.item) + return if self._editor.dirty and not self._apply_txt_changes_to_model(): if self._editor.datafile_controller != next_datafile_controller: self.tree.select_controller_node(self._editor.datafile_controller) @@ -601,16 +602,19 @@ def locate_tree_item(self, item): section_start = 0 name_to_locate = r'^'+item.name position = self.source_editor.FindText(section_start, search_end, name_to_locate, STC_FIND_REGEXP) + # print(f"DEBUG: TextEditor locate_tree_item name_to_locate={name_to_locate} position={position}") if position[0] != -1: # DEBUG: Make colours configurable? self.source_editor.SetSelBackground(True, Colour('orange')) self.source_editor.SetSelForeground(True, Colour('white')) + self.source_editor.SetFocus() self.source_editor.GotoPos(position[1]+1) self.source_editor.SetCurrentPos(position[1]) self.source_editor.SetAnchor(position[0]) self.source_editor.SetSelection(position[0], position[1]) + self.source_editor.SetFocusFromKbd() self.source_editor_parent.SetFocus() - self.SetFocusFromKbd() + self.source_editor.Update() def on_content_assist(self, event): """