Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes double Ctrl-V and Navigation from Tree in Text Editor and Windows #2657

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ 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()))
self.register_shortcut('CtrlCmd-S', focused(lambda e: self.on_saving(e)))
# 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
# self.register_shortcut('CtrlCmd-G', focused(lambda e: self._editor.on_find(e)))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#
# Automatically generated by `tasks.py`.
VERSION = 'v2.0.8dev21'
VERSION = 'v2.0.8dev22'