Skip to content

Commit

Permalink
Text editor fixes (#2646)
Browse files Browse the repository at this point in the history
* Improvements in double-actions on Linux. WIP, unit test failing

* Skipped some tests for TextEditor in Windows

* Add Actions to use in Text Edit standalone. WIP, repeated actions

* Add move rows up/down. WIP missing content help

* Improve menu in Text Editor. Still need fixes, cursor pos in autocomplete and double actions

* Improvements on autocomplete in Text Editor
  • Loading branch information
HelioGuilherme66 authored Oct 2, 2023
1 parent 0caa339 commit 6ac4bd4
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 106 deletions.
12 changes: 11 additions & 1 deletion src/robotide/editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
Delete Cells | Delete Cells | Ctrlcmd-Shift-D
Insert Rows | Insert Rows | Ctrlcmd-I
Delete Rows | Delete Rows | Ctrlcmd-D
Move Rows Up | Move Rows Up | Alt-Up
Move Rows Down | Move Rows Down | Alt-Down
[Tools]
Content Assistance (Ctrl-Space or Ctrl-Alt-Space) | Show possible keyword and variable completions | | | POSITION-70
"""
Expand Down Expand Up @@ -108,7 +110,7 @@ def unregister_context_menu_hook_to_grid(self, hook):
def _show_editor(self):
if not self._tab:
self._tab = _EditorTab(self)
self.add_tab(self._tab, 'Edit', allow_closing=False)
self.add_tab(self._tab, self._tab.plugin.name, allow_closing=False)
if self.is_focused():
self._editor = self._create_editor()
self._tab.show_editor(self._editor)
Expand Down Expand Up @@ -230,6 +232,14 @@ def on_delete_rows(self, event):
_ = event
wx.CallAfter(self.editor.delete_rows)

def on_move_rows_up(self, event):
_ = event
self.editor.on_move_rows_up()

def on_move_rows_down(self, event):
_ = event
self.editor.on_move_rows_down()

def on_delete(self, event):
_ = event
self.editor.delete()
Expand Down
10 changes: 7 additions & 3 deletions src/robotide/editor/kweditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,6 @@ def _call_direct_function(self, event: object, keycode: int):
def _call_alt_function(self, event, keycode: int):
if keycode == wx.WXK_SPACE:
self._open_cell_editor_with_content_assist() # Mac CMD
elif keycode in [wx.WXK_DOWN, wx.WXK_UP]:
# Mac Option key(⌥)
self._move_rows(keycode)
elif keycode == wx.WXK_RETURN:
if self.IsCellEditControlShown():
event.GetEventObject().WriteText(linesep)
Expand All @@ -690,6 +687,13 @@ def _call_alt_function(self, event, keycode: int):
return False # event must not be skipped in this case
return True

"""
elif keycode in [wx.WXK_DOWN, wx.WXK_UP]:
print(f"DEBUG kweditor call move_rews ky={keycode}")
# Mac Option key(⌥)
self._move_rows(keycode)
"""

def on_key_down(self, event):
keycode = event.GetUnicodeKey() or event.GetKeyCode()
if event.ControlDown():
Expand Down
6 changes: 6 additions & 0 deletions src/robotide/editor/macroeditors.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def insert_rows(self):
def delete_rows(self):
self.kweditor.on_delete_rows(None) # DEBUG python 3

def on_move_rows_up(self):
self.kweditor.on_move_rows_up()

def on_move_rows_down(self):
self.kweditor.on_move_rows_down()

def delete(self):
self.kweditor.on_delete()

Expand Down
Loading

0 comments on commit 6ac4bd4

Please sign in to comment.