Skip to content

Commit

Permalink
Fix cursor position and editor, on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Jun 16, 2024
1 parent 3c746ad commit 65b7e18
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.1, but RIDE is known to work w

`pip install -U robotframework-ride`

(3.8 < python &lt;= 3.12) Install current development version (**2.1dev49**) with:
(3.8 < python &lt;= 3.12) Install current development version (**2.1dev50**) with:

`pip install -U https://github.com/robotframework/RIDE/archive/master.zip`

Expand Down
12 changes: 12 additions & 0 deletions src/robotide/editor/kweditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,11 @@ def _col_label_left_click(self, event):

def on_move_cursor_down(self, event=None):
self._move_cursor_down(event)
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())

def on_insert_rows(self, event):
self._execute(add_rows(self.selection.rows()))
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self.ClearSelection()
self._resize_grid()
self._skip_except_on_mac(event)
Expand All @@ -488,6 +490,7 @@ def on_insert_cells(self, event=None):
# print(f"DEBUG: kweditor.py KeywordEditor on_insert_cells start, end"
# f" {self._icells[0].row}:{self._icells[0].col}, {self._icells[1].row}:{self._icells[1].col}")
self._execute(insert_cells(*self._icells))
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self._counter = 1
self._resize_grid()
self._skip_except_on_mac(event)
Expand All @@ -501,6 +504,7 @@ def on_delete_cells(self, event=None):
return
self._dcells = (self.selection.topleft, self.selection.bottomright)
self._execute(delete_cells(*self._dcells))
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self._counter = 1
self._resize_grid()
self._skip_except_on_mac(event)
Expand Down Expand Up @@ -645,6 +649,7 @@ def _format_comments(data):

def cell_value_edited(self, row, col, value):
self._execute(ChangeCellValue(row, col, value))
self.GoToCell(self.grid_cursor)
wx.CallAfter(self.AutoSizeColumn, col, False)
wx.CallAfter(self.AutoSizeRow, row, False)

Expand Down Expand Up @@ -753,6 +758,7 @@ def save(self):
cell_editor.EndEdit(self.selection.topleft.row, self.selection.topleft.col, self)

def show_content_assist(self):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
if self.IsCellEditControlShown():
self.GetCellEditor(*self.selection.cell).show_content_assist(self.selection.cell)

Expand All @@ -765,12 +771,14 @@ def _calculate_position():
return x, y + 20

def on_editor(self, event):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self._tooltips.hide()
row_height = self.GetRowSize(self.selection.topleft.row)
self.GetCellEditor(*self.selection.cell).SetHeight(row_height)
event.Skip()

def _move_cursor_down(self, event):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self.DisableCellEditControl()
if event:
try:
Expand Down Expand Up @@ -953,6 +961,7 @@ def _move_rows(self, keycode):
self.on_move_rows_down()

def _move_grid_cursor(self, event, keycode):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self.DisableCellEditControl()
if keycode == wx.WXK_RETURN:
self.MoveCursorRight(event.ShiftDown())
Expand All @@ -961,6 +970,7 @@ def _move_grid_cursor(self, event, keycode):

def move_grid_cursor_and_edit(self):
# self.MoveCursorRight(False)
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
self.open_cell_editor()

def on_key_up(self, event):
Expand All @@ -974,6 +984,7 @@ def _get_cell_editor(self):
return self.GetCellEditor(self.GetGridCursorCol(), row)

def open_cell_editor(self):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
if not self.IsCellEditControlEnabled():
self.EnableCellEditControl()
cell_editor = self._get_cell_editor()
Expand Down Expand Up @@ -1172,6 +1183,7 @@ def on_rename_keyword(self, event):

# Add one new Dialog to edit pretty json String TODO: use better editor with more functions
def on_json_editor(self, event=None):
self.grid_cursor = (self.GetGridCursorRow(), self.GetGridCursorCol())
if event:
event.Skip()
dialog = RIDEDialog()
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#
# Automatically generated by `tasks.py`.

VERSION = 'v2.1dev49'
VERSION = 'v2.1dev50'

0 comments on commit 65b7e18

Please sign in to comment.