Skip to content

Commit

Permalink
Add Shortcut Alt+Z to wrap lines action
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerle committed Nov 19, 2022
1 parent 51e6300 commit 0e47823
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@
'editor/close split panel': "Alt+Shift+W",
'editor/docstring': "Ctrl+Alt+D",
'editor/autoformatting': "Ctrl+Alt+I",
'editor/wrap lines': "Alt+Z",
'editor/show in external file explorer': '',
# -- In Breakpoints
'_/switch to breakpoints': "Ctrl+Shift+B",
Expand Down
7 changes: 4 additions & 3 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,8 @@ def get_plugin_actions(self):
'underline_errors', 'set_underline_errors_enabled')

wrap_lines_action = self._create_checkable_action(
_("Wrap lines"), 'wrap', 'set_wrap_enabled')
_("Wrap lines"), 'wrap', 'set_wrap_enabled',
shortcut=CONF.get_shortcut('editor', 'wrap lines'))

self.checkable_actions = {
'blank_spaces': showblanks_action,
Expand Down Expand Up @@ -1362,7 +1363,7 @@ def set_ancestor(self, ancestor):
except RuntimeError:
pass

def _create_checkable_action(self, text, conf_name, method=''):
def _create_checkable_action(self, text, conf_name, method='', shortcut=None):
"""Helper function to create a checkable action.
Args:
Expand All @@ -1376,7 +1377,7 @@ def toogle(checked):
self.switch_to_plugin()
self._toggle_checkable_action(checked, method, conf_name)

action = create_action(self, text, toggled=toogle)
action = create_action(self, text, toggled=toogle, shortcut=shortcut)
action.blockSignals(True)

if conf_name not in ['pycodestyle', 'pydocstyle']:
Expand Down

0 comments on commit 0e47823

Please sign in to comment.