nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

Add the ability to remap shortcuts

Open eteran opened this issue 8 years ago • 14 comments

This may end up being very complex to do well, but I think it's a worthy goal. I personally love nedit's keyboard bindings, but if we want to be the best editor possible, we should be able to accommodate other people's preferences.

eteran avatar Feb 03 '17 01:02 eteran

Hi,

My bindkey for "Comment" was mapped to Alt+z. For ex, I can comment out some selected lines in a Perl or .csh script using it. In the first version of nedit-ng, I couldn't use it as it was mapped to the "Shell => make" command. After I've imported my .nedit/nedit.rc file with nedit-import, this key is no more mapped to "Shell => make" , I can see it in my macro menu but it does not work (nothing happens). The "Uncomment" bindkey (Shift+Alt+z) is working fine. Do you know how I can do the get my "Alt+Z" bindkey work again ?

Regards.

xuo.

ericxuo avatar Dec 26 '17 15:12 ericxuo

Can you set it in the UI correctly?

eteran avatar Dec 26 '17 23:12 eteran

Hmm, I've noticed a small bug in the UI regarding shortcuts. Let me see if I can make things work as expected...

eteran avatar Dec 26 '17 23:12 eteran

OK, a bug was fixed involving the Accelerator widget. Previously it would not respect clearing the widget correctly, now it can be done:

When I set the accelerator for make to nothing, and then set the accelerator for "Comment #" to "Alt+Z", it appears to work as expected. Please note, that the default version of this macro requires a selection.

eteran avatar Dec 27 '17 00:12 eteran

Hi,

I'm currently using the master branch for nedit-ng. I've updated and recompiled but I still have the same problem.

Regards.

Xuo.

ericxuo avatar Dec 27 '17 08:12 ericxuo

Maybe post your config.ini?

eteran avatar Dec 27 '17 23:12 eteran

Hi,

Here it is (renamed as .log as I couldn't load it with the .ini extension).

Xuo.

config.log

ericxuo avatar Dec 28 '17 09:12 ericxuo

Hmm, so looking at your config, it looks like you intended to have Alt+Z bound to "tagstack -> pop tag"; is that correct?

I don't know what this macro does, but I can say that if I add a t_print("MACRO") to the end of that macro, and then use Alt+Z I do see that message in the console.

Can you verify this behavior? If that is the case, is it possible that this is a bug introduced in the macro system that I need to investigate?

eteran avatar Jan 02 '18 02:01 eteran

Hi,

I've removed the Alt+Z shortcut for "pop tag" in the config.ini file. The Alt+Z bindkey for "comments" now works. If I add it again (Alt+Z for "pop tag"), then the bindkey for "comments" does not work. This was working with the native nedit. But it can be considered as a bug as it means that the same bindkey is linked to 2 different actions. The pop tag was a macro that (if I remeber well) was used when a tag file was loaded. For ex, I could load a Verilog tag file and when I was opening the top file, then I could go down in the hierarchy using the "find tag" macro and go back the the previous hierarchy level (and previous file) using the "pop tag" macro. I don't use it anymore so I can keep the "Alt+Z" bindkey commented out for "pop tag". The diffrenerce between the 2 "Alt+Z" bindkeys behavior was that the one that is bound to the "Comment" needs a selection while the other one do not need any selection (the "find tag" macro needs a selection).

Regards.

Xuo.

ericxuo avatar Jan 02 '18 19:01 ericxuo

Ah, OK. Yea, Qt will not allow the same shortcut on two different enabled actions. I can try to work around this just a little bit by dynamically enabling and disabling actions that require a selection.

Which would probably help in this particular scenario, but fundamentally setting the same shortcut on two different actions is not advisable.

eteran avatar Jan 02 '18 20:01 eteran

Hi,

So, forget it (for the moment). I couldn't compile nedit-ng at work. Too difficult for me. I'll try to install CentOS 6.6 on some pc and to compile nedit-ng and use the executable at work.

Regards.

Xuo.

ericxuo avatar Jan 03 '18 17:01 ericxuo

Indeed, allowing to remap shortcuts, is useful if you don't like the default. But even more importantly, it is also, I think, the only way to access some NEdit functions which are not mapped at all by default.

As an example, here is the mouse_pan() function mapped to my mouse right click on the X11 version. I see no way to use it right now with nedit-ng:

ezgif-5-7930b14f9d

afeblot avatar Feb 11 '18 11:02 afeblot

Right, currently, nedit-ng supports this via Ctrl + Right Click.

I think that Qt might swap Command and Ctrl, so you may want to give Command + (Whatever qualifies as a right-click) to see if you can trigger it that way.

eteran avatar Feb 11 '18 15:02 eteran

You're damn right :-)

afeblot avatar Feb 11 '18 16:02 afeblot