Skip to content

Commit d589ab0

Browse files
Improve auto complete (#2590)
* Improve auto-suggestions in Grid and Text Editors * Simplify showing newlines in cell editor
1 parent 8b0dcb3 commit d589ab0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/robotide/editor/kweditor.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,17 +1077,21 @@ def BeginEdit(self, row, col, gridd):
10771077
self._tc.SetForegroundColour(self.color_foreground_text)
10781078
self._tc.set_row(row)
10791079
self._original_value = gridd.GetCellValue(row, col)
1080-
self._tc.SetValue(self._original_value.replace('\n', '\\n'))
1080+
if self._original_value:
1081+
temp_value = self._original_value.replace("\n", "\\n")
1082+
self._tc.SetValue(temp_value)
10811083
self._tc.SetSelection(0, self._tc.GetLastPosition())
10821084
self._tc.SetFocus()
10831085
self._grid = gridd
10841086

10851087
def EndEdit(self, row, col, gridd, *ignored):
1086-
value = self._get_value().replace('\\n', '\n')
1088+
value = self._get_value() # .replace('\\n', '\n')
1089+
if value:
1090+
temp_value = value.replace("\\n", "\n")
1091+
value = temp_value
10871092
if value != self._original_value:
10881093
self._value = value
1089-
# print(f"DEBUG: kweditor returning ContentAssistCellEditor.EndEdit {value} and moving right")
1090-
wx.CallAfter(self._grid.move_grid_cursor_and_edit)
1094+
# DEBUG: this is not needed wx.CallAfter(self._grid.move_grid_cursor_and_edit)
10911095
return value
10921096
else:
10931097
self._tc.hide()

0 commit comments

Comments
 (0)