Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Text Editor help call to use Ctrl. #2639

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni

=== Added

- Added content help pop-up on Text Editor by pressing ``Ctrl-M`` for text at cursor position
- Added content help pop-up on Text Editor by pressing ``Ctrl-M`` for text at cursor position or selected autocomplete list item
- Added Exclude option in context nenu for Test files, previously was only possible for Test Suites folders
- Added exclusion of monitoring filesystem changes for files and directories excluded in Preferences
- Added variables creation shortcuts (``Ctrl-1,2,5``) to fields Arguments in Grid Editor
Expand Down
2 changes: 1 addition & 1 deletion src/robotide/application/CHANGELOG.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Changelog</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id1337"></a>Changelog</h2></div></div><hr /></div><p>All notable changes to this project will be documented in this file.</p><p>The format is based on <a class="ulink" href="http://keepachangelog.com/en/1.0.0/" target="_top">Keep a Changelog</a>
and this project adheres to <a class="ulink" href="http://semver.org/spec/v2.0.0.html" target="_top">Semantic Versioning</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ulink_url_https_github_com_robotframework_ride_unreleased_ulink"></a>1. <a class="ulink" href="https://github.com/robotframework/RIDE" target="_top">Unreleased</a></h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_added"></a>1.1. Added</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Added content help pop-up on Text Editor by pressing ``Ctrl-M`` for text at cursor position
Added content help pop-up on Text Editor by pressing ``Ctrl-M`` for text at cursor position or selected autocomplete list item
</li><li class="listitem">
Added Exclude option in context nenu for Test files, previously was only possible for Test Suites folders
</li><li class="listitem">
Expand Down
4 changes: 2 additions & 2 deletions src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def set_content(self, html_win, content):
</ul>
<p><strong>New Features and Fixes Highlights</strong></p>
<ul class="simple">
<li>Added content help pop-up on Text Editor by pressing <b>Ctrl-M</b> for text at cursor position</li>
<li>Added content help pop-up on Text Editor by pressing <b>Ctrl-M</b> for text at cursor position or selected autocomplete list item</li>
<li>Added Exclude option in context nenu for Test files, previously was only possible for Test Suites folders</li>
<li>Added exclusion of monitoring filesystem changes for files and directories excluded in Preferences</li>
<li>Fixed exception when finding GREY color for excluded files and directories in Project Tree</li>
Expand Down Expand Up @@ -237,6 +237,6 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 18/Sep/2023.</p>
<p>RIDE {VERSION} was released on 19/Sep/2023.</p>
</div>
"""
4 changes: 2 additions & 2 deletions src/robotide/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ def bind_keys_to_evt_menu(target, actions):
<td>Suggestions and auto completion</td>
</tr>
<tr>
<td>CtrlCmd-M</td>
<td>Help for content at cursor</td>
<td>CtrlCmd</td>
<td>Help for content at cursor or selected autocomplete list item</td>
</tr>
<tr>
<td>CtrlCmd-T</td>
Expand Down
47 changes: 15 additions & 32 deletions src/robotide/editor/texteditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ def revert(self):

def on_editor_key(self, event):
keycode = event.GetKeyCode()
keyvalue = event.GetUnicodeKey()
if keycode == wx.WXK_DELETE: # DEBUG on Windows we only get here, single Text Editor
selected = self.source_editor.GetSelection()
if selected[0] == selected[1]:
Expand All @@ -896,6 +897,8 @@ def on_editor_key(self, event):
return
if self.is_focused() and keycode != wx.WXK_CONTROL and self._dirty == 0:
self._mark_file_dirty(self.source_editor.GetModify())
if keyvalue == wx.WXK_NONE and keycode in [wx.WXK_CONTROL, wx.WXK_RAW_CONTROL]:
self.source_editor.hide_kw_doc()
event.Skip()

def on_key_down(self, event):
Expand Down Expand Up @@ -938,7 +941,7 @@ def on_key_down(self, event):
self.delete_cell(event)
else:
self.delete_row(event)
elif keycode == ord('M') and event.ControlDown():
elif event.ControlDown() and keycode == 0:
self.source_editor.show_kw_doc()
else:
event.Skip()
Expand Down Expand Up @@ -1511,19 +1514,22 @@ def __init__(self, parent, readonly=False):
self.RegisterImage(3, wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16, 16)))

def show_kw_doc(self):
cursor_pos = self.GetCurrentPos()
if cursor_pos != self.old_position:
self.old_position = cursor_pos
if self.AutoCompActive():
selected = [self.AutoCompGetCurrentText()]
else:
selected = self.get_selected_or_near_text(keep_cursor_pos=True)
if self.old_select != selected:
for kw in selected:
self._show_keyword_details(kw)
for kw in selected:
self._show_keyword_details(kw)

def hide_kw_doc(self):
if self._information_popup:
self._information_popup.hide()
self._information_popup = None

def on_key_pressed(self, event):
if self.CallTipActive():
self.CallTipCancel()
if self._information_popup:
self._information_popup.hide()
self.hide_kw_doc()
key = event.GetKeyCode()
if key == 32 and event.ControlDown():
pos = self.GetCurrentPos()
Expand All @@ -1540,29 +1546,6 @@ def on_key_pressed(self, event):
"""
# Code completion
else:
if self._information_popup:
self._information_popup.hide()
"""
kw = list(keyword.kwlist[:])
kw.append("zzzzzz?2")
kw.append("aaaaa?2")
kw.append("__init__?3")
kw.append("zzaaaaa?2")
kw.append("zzbaaaa?2")
kw.append("this_is_a_longer_value")
# kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")

kw.sort() # Python sorts are case-sensitive
self.AutoCompSetIgnoreCase(True) # so this needs to match

# Images are specified with an appended "?type"
for i in range(len(kw)):
if kw[i] in keyword.kwlist:
kw[i] = kw[i] + "?1"
self.AutoCompSetDropRestOfWord(True)
self.AutoCompSetSeparator(ord(';'))
self.AutoCompShow(0, ";".join(kw))
"""
selected = self.get_selected_or_near_text()
sugs = []
for start in selected:
Expand Down