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

Enable assigning shortcuts for cursor navigation on the Editor #729

Closed
spyder-bot opened this issue Feb 17, 2015 · 5 comments · Fixed by #2217
Closed

Enable assigning shortcuts for cursor navigation on the Editor #729

spyder-bot opened this issue Feb 17, 2015 · 5 comments · Fixed by #2217

Comments

@spyder-bot
Copy link
Collaborator

From [email protected] on 2011-08-09T12:00:10Z

Enable assigning shortcuts for cursor navigation

Currently, there is no way to make shortcuts for basic cursor navigation within the editor or console, for example:

  • Use CTRL+A (in addition to Home key) to "go to beginning of line"
  • Use CTRL+P (in addition to up arrow) to "go to previous line"

For users accustomed to Emacs (and Linux shells) it would be very useful to be able to navigate using these shortcuts.

I would like to contribute to this solution, but first I want to verify what the correct approach is (see comment below).

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=729

@spyder-bot
Copy link
Collaborator Author

From [email protected] on 2011-08-09T10:09:18Z

I see there could be different approaches and I'm not sure what the correct one is:

  • Should we add actions to spyder.MainWindow.init() and then use register_shortcut()?
  • or do we add the actions to the Editor.get_plugin_actions() ?
  • or should it be a lower level approach in which the keyPressEvent() method of the editor is evaluated to catch presses of the assigned shortcuts?

Ideally, we should be able to add shortcuts for most navigation and simple editing actions to make the editor behave close to Emacs and allow cursor navigation without the need of arrows and home/end keys.
Simple editing actions include "delete current line" and "delete next word".

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2011-08-09T11:48:34Z

Labels: -Type-Defect Type-Enhancement Cat-Editor

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2011-08-31T01:16:08Z

I think the lower level approach is the right one:

Actually users would probably want to customize these shortcuts as well, so we must think of a way to register them to the main window, but not with the 'register_shortcut' mechanism as it exists (because there won't be any QAction or QShortcut object associated to these low-level shortcuts).

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2011-08-31T01:40:18Z

Two more things:

  • supporting Emacs complex keyboard shortcut sequences (Ctrl+C + Ctrl+something else) would require to implement an event state filter (a first shortcut changes event filter's state and the second shortcut triggers an action)
  • "delete current line" or "delete next word" may be implemented at a higher level like the already existing shortcuts/actions "duplicate line" or "copy line"

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2012-03-18T14:10:29Z

Labels: -Type-Enhancement Type-Enh

@ccordoba12 ccordoba12 added this to the v2.4 milestone Mar 2, 2015
@ccordoba12 ccordoba12 changed the title Enable assigning shortcuts for cursor navigation Enable assigning shortcuts for cursor navigation on the Editor May 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants