Skip to content

Commit

Permalink
Merge pull request #2853 from HelioGuilherme66/text_improvements
Browse files Browse the repository at this point in the history
Fix not overwriting selected text in Text Editor
  • Loading branch information
HelioGuilherme66 authored Aug 16, 2024
2 parents d945651 + 050b7ea commit 6bdfbce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 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 <= 3.12) Install current development version (**2.1dev68**) with:
(3.8 <= python <= 3.12) Install current development version (**2.1dev69**) with:

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

Expand Down
2 changes: 1 addition & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 15/August/2024.</p>
<p>RIDE {VERSION} was released on 16/August/2024.</p>
<!-- <br/>
<h3>May The Fourth Be With You!</h3>
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>
Expand Down
17 changes: 9 additions & 8 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def on_data_changed(self, message):
# Workaround for remarked dirty with Ctrl-S
if self.is_focused() and self._save_flag == 0 and isinstance(message, RideSaving):
self._save_flag = 1
RideBeforeSaving().publish()
if self.is_focused() and self._save_flag == 1 and isinstance(message, RideDataDirtyCleared):
self._save_flag = 2
if self.is_focused() and self._save_flag == 2 and isinstance(message, RideSaved):
Expand All @@ -235,7 +236,7 @@ def on_data_changed(self, message):
# if self.is_focused() and self._save_flag == 3 and isinstance(message, RideDataChangedToDirty):
# self._save_flag = 4
# wx.CallAfter(self._editor.mark_file_dirty, False)
if self.is_focused() and isinstance(message, RideBeforeSaving):
if isinstance(message, RideBeforeSaving):
self._editor.is_saving = False
# Reset counter for Workaround for remarked dirty with Ctrl-S
self._save_flag = 0
Expand Down Expand Up @@ -1242,20 +1243,20 @@ def on_editor_key(self, event):
keycode = event.GetKeyCode()
keyvalue = event.GetUnicodeKey()
# print(f"DEBUG: TextEditor key up focused={self.is_focused()} modify {self.source_editor.GetModify()}")
if keycode == wx.WXK_DELETE: # DEBUG on Windows we only get here, single Text Editor
if keycode in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
self.mark_file_dirty(self.source_editor.GetModify())
return
if keyvalue == wx.WXK_NONE and keycode in [wx.WXK_CONTROL, wx.WXK_RAW_CONTROL]:
self.source_editor.hide_kw_doc()
elif keycode == wx.WXK_DELETE or (keyvalue != wx.WXK_NONE and keycode > keyvalue):
# DEBUG on Windows we only get here, single Text Editor
selected = self.source_editor.GetSelection()
if selected[0] == selected[1]:
pos = self.source_editor.GetInsertionPoint()
if pos != self.source_editor.GetLastPosition():
self.source_editor.DeleteRange(selected[0], 1)
else:
self.source_editor.DeleteRange(selected[0], selected[1] - selected[0])
self.mark_file_dirty(self.source_editor.GetModify())
if keycode in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
self.mark_file_dirty(self.source_editor.GetModify())
return
if keyvalue == wx.WXK_NONE and keycode in [wx.WXK_CONTROL, wx.WXK_RAW_CONTROL]:
self.source_editor.hide_kw_doc()
if self.is_focused(): # DEBUG and keycode != wx.WXK_CONTROL and keyvalue >= ord(' ') and self.dirty:
self.mark_file_dirty(self.source_editor.GetModify())
event.Skip()
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.1dev68'
VERSION = 'v2.1dev69'

0 comments on commit 6bdfbce

Please sign in to comment.