Skip to content

Commit

Permalink
Merge pull request #2657 from HelioGuilherme66/misc_fixes
Browse files Browse the repository at this point in the history
Fixes double Ctrl-V and Navigation from Tree in Text Editor and Windows
  • Loading branch information
HelioGuilherme66 authored Oct 12, 2023
2 parents ea8ce76 + 5530965 commit d45ca67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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'

0 comments on commit d45ca67

Please sign in to comment.