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

Ctrl-R in Insert Mode doesn't work? #50

Closed
Cito opened this issue Mar 21, 2012 · 12 comments
Closed

Ctrl-R in Insert Mode doesn't work? #50

Cito opened this issue Mar 21, 2012 · 12 comments

Comments

@Cito
Copy link

Cito commented Mar 21, 2012

Ctrl-R is not working for me in insert mode. When I press Ctrl-R in insert mode, I expect a quote character to be displayed on the status bar and vrapper waiting for a register key (see :h i_ctrl-r in vim), but that does not happen.

@keforbes
Copy link
Contributor

Anything involving the Ctrl key in Vrapper is always a pain. If Eclipse has a key binding for a Ctrl key then it performs that operation and never tells Vrapper the key was pressed. The only way for Vrapper to receive a Ctrl key press is if you explicitly unbind it from Eclipse first.

I'll accept this as a feature request but it's another feature where users would have to modify their Eclipse settings for it to work at all. That doesn't mean it's exceedingly difficult to implement, but most users probably wouldn't know it exists. And I'm just rambling/complaining, this is a valid feature request. :)

@Cito
Copy link
Author

Cito commented Mar 22, 2012

Thanks for the quick response.

Is this only a problem in insert mode? Because in normal mode, Ctrl-R works as expected (Redo) even though I didn't unbind Ctrl-R in Eclipse.

On the page http://vrapper.sourceforge.net/documentation/?page=3 there is already a passage about quirks (incompatibilities), but it seems to be somewhat incomplete or misleading. For instance, Ctrl-R should be added there, and where it says "visual mode" doesn't it really mean or include "normal mode"? The list should also differentiate between those things that will work when unbinding the corresponding Eclipse key, those that are not implemented yet, but may be implemented some day, and those that will probably never work because of some restrictions in the Eclipse environment. I think if this passage is made a bit more elaborate and detailed, it will help a lot.

@keforbes
Copy link
Contributor

Well I apologize... I was totally wrong. I thought Ctrl+R performing the redo was Eclipse's default action and that it wasn't implemented in Vrapper. I just looked at the code though (which I should do before opening my mouth) and Ctrl+R is mapped to the 'redo' operation only in NormalMode. That's why it only works in NormalMode and not InsertMode. If this was an Eclipse keybinding then the operation would be performed regardless because Eclipse doesn't know or care about Vrapper modes.

Also, I don't see any reference to Ctrl+R in our documentation. We really should define a list of the Ctrl keybindings that Vrapper defines which don't conflict with default Eclipse settings.

This feature request shouldn't be too bad now that I know we don't have to worry about Eclipse blocking us. And you're right, the documentation needs to be updated regarding Ctrl keybindings. Hopefully I'll be able to play with this over the weekend. Thanks!

@keforbes
Copy link
Contributor

You can ignore this comment, I just wanted a place to stick this until I have time to update the documentation. The following Ctrl keybindings are defined in Vrapper:

CDT/JDT optional plugins
Ctrl+] (go to declaration)

Normal Mode
Ctrl+f (page down)
Ctrl+b (page up)
Ctrl+d (page down)
Ctrl+u (page up)
Ctrl+y (scroll line up)
Ctrl+e (scroll line down)
Ctrl+i (forward navigation history)
Ctrl+o (backward navigation history)
Ctrl+r (redo)

Insert Mode
Ctrl+c (leave insert mode)

Visual Mode
Ctrl+c (leave visual mode)
Ctrl+f (page down)
Ctrl+b (page up)
Ctrl+d (page down)
Ctrl+u (page up)

Command Mode
Ctrl+c (leave command mode)
Ctrl+v (paste into command line)

Search Mode
Ctrl+c (leave search mode)

@keforbes
Copy link
Contributor

Ok, I've implemented this feature and updated the unstable update site to include it. Please install the unstable version of Vrapper (0.19.20120323) and play with it a bit. Let me know how it goes.

I still need to update the documentation so I won't close this Issue yet.

@Cito
Copy link
Author

Cito commented Mar 24, 2012

Thanks a lot. It works except that Ctrl-R " does not insert the default register.

Also, when I open an editor with the unstable version, I get an alter with an "Argument cannot be null" message. This is what I found in the logs:

!ENTRY org.eclipse.ui.workbench 4 2 2012-03-24 12:09:36.727
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.IllegalArgumentException: Argument cannot be null
    at org.eclipse.swt.SWT.error(SWT.java:4263)
    at org.eclipse.swt.SWT.error(SWT.java:4197)
    at org.eclipse.swt.SWT.error(SWT.java:4168)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
    at org.eclipse.swt.widgets.Text.setText(Text.java:1967)
    at net.sourceforge.vrapper.eclipse.ui.ModeContributionItem.fill(ModeContributionItem.java:48)
    at org.eclipse.jface.action.SubContributionItem.fill(SubContributionItem.java:59)
        ...
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

@keforbes
Copy link
Contributor

Thanks for testing this so quickly!

I've made a change to expose the default register " but I'm unable to reproduce your stack trace. Can you give me a set of specific steps to reproduce it? I tried just opening a new file and that didn't do it. I also tried copying some text from one file, then opening a new file and pasting the copied text. That also worked with no error.

Note that I committed my change for the " register but I haven't updated the unstable update site with that fix.

@keforbes
Copy link
Contributor

FYI. I updated http://vrapper.sourceforge.net/documentation/?page=3 with a better description of which Ctrl commands are available in which mode. I don't think it's exactly the type of information you were looking for but at least now it's more explicit about the fact that <C-R> is only available in NormalMode of the current stable version.

@Cito
Copy link
Author

Cito commented Mar 25, 2012

The better description is helpful, thanks.

After uninstalling vrapper and installing the current unstable version again, I can't reproduce the error any more. I'll open a separate bug report if it happens again.

@Cito
Copy link
Author

Cito commented Mar 25, 2012

After a while, the error happened again. Seems to occur only sporadically or under certain conditions like when Vrapper is disabled. Anyway, I have created a separate bug report #51 for this.

@keforbes
Copy link
Contributor

This feature is now implemented. Closing.

@Cito
Copy link
Author

Cito commented Mar 27, 2012

Thanks for the quick implementation. That's a really useful feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants