Comments (6)
@d0vgan Are you talking about to modify the shortcut from within a nppexec script?
This is not done by PS, the user has to do it manually under Settings->Shortcut mapper -> Plugin commands. And a new entry is just available after a N++ restart.
For user changes via the n++ menu there is NPPN_SHORTCUTREMAPPED, which is already implemented by your plugin as far as I see.
Pythonscript could remove menu items calling python scripts in a setting menu and if a shortcut is assigned to that menu item it is also removed automatically.
from nppexec.
Yes, NppExec is also affected by this.
Indeed, the NPPM_REMOVESHORTCUTBYCMDID needs to be used.
from nppexec.
Well, an internal array of menu item ids for NppExec's scripts can be introduced, and the menu items listed in NppExec's Advanced Options can internally be associated with the menu item ids.
It will help in case of menu item deletion.
In case of menu items moving (up or down), however, I have no idea what to do. It does not look like NPPM_REMOVESHORTCUTBYCMDID helps here.
In general, all this situation does not look good to me. Currently, a plugin's internal logic does not deal with (and had no knowledge of) its menu item ids, so NPPM_REMOVESHORTCUTBYCMDID or similar is not an obvious way anyway.
from nppexec.
NppExec's Advanced Options additionally contains the following two buttons: [Move up] and [Move down].
Now imagine that the menu items being moved (one of them is moved down and another one is moved up) already have their shortcut keys. From NppExec's perspective, absolutely nothing is changed with regard to shortcut keys (because NppExec itself is just not aware of shortcut keys) of the corresponding menu items. However, from Notepad++'es perspective, the two menu items are switched whereas their corresponding shortcut keys are still mapped to the old menu item positions, not to items themselves. Saying the same in other words, this leads to the shortcut keys to become switched. Let me "illustrate" this:
Initial Position:
Menu Item A - Shortcut A
Menu Item B - Shortcut B
Position after moving the items:
Menu Item B - Shortcut A
Menu Item A - Shortcut B
And I have no idea how this can be fixed, because NPPM_REMOVESHORTCUTBYCMDID does not allow to deal with it - because the item is moved (its position is changed) rather than deleted.
That is why I'm saying that NPPM_REMOVESHORTCUTBYCMDID is not enough to deal with it and, moreover, it adds additional complication to plugins because now the plugin's code must be aware of the menu items positions (created by the plugin) and their associated shortcut keys. Currently NppExec does neither of both: it does not store the association between the scripts and their corresponding menu item positions, as well as it does not store the association between the scripts and their shortcut keys for the corresponding menu items.
from nppexec.
NPPM_REMOVESHORTCUTBYCMDID can't help with that. You would need a new callback to modify the shortcut <-> menu item mapping at n++ shortcut code.
from nppexec.
I was thinking about this issue again and again, and here is my conclusion: the proposed approach with NPPM_REMOVESHORTCUTBYCMDID is a completely wrong direction.
Here is why.
The source of a problem is not in plugins, it's in Notepad++ itself. Here is what I mean: the origin, the cause of the problem comes from the way how Notepad++ stores shortcuts for the plugins. Notepad++ maps the shortcut keys to the value of internalID
that is not e.g. a unique hash of plugin's menu item name, but something like a menu item's position. Obviously, when this position is changed, the mappings between these positions and shortcuts becomes wrong.
Now I'm asking a question: is it a plugin's fault? What if Notepad++ stored some unique hash keys to identify plugin's menu items disregarding the menu items' positions, would we face this problem?
And, by introducing NPPM_REMOVESHORTCUTBYCMDID , aren't we in fact trying to fix Notepad++'es internal issue in an external plugin's code? Isn't it strange?
Moreover, as it was discussed here, anyway some different fix is needed to deal with moving (not deleting) of menu items.
So my proposal is to fix it in Notepad++ itself: do it once, and for all the plugins.
from nppexec.
Related Issues (20)
- Notepad++ v8.4 and beyond (inclusive 8.4.2) CRASHES or doesn't work properly when applying a color on selected text using NppExec. HOT 9
- Techniques to restore cursor position within Notepad++ file HOT 2
- SCI_REPLACE has problem matching the beginning of line HOT 6
- Changing N++ themes results in error HOT 4
- Please add support for theme. I am using version 0.8.2 and the console is white. HOT 1
- Ipython does not have auto-indentation and colour for keywords. The same things work fine in normal command prompt. HOT 5
- encoding characters error HOT 2
- CAnyRichEdit::AddStr() is very slow and should be optimized HOT 1
- Search index for online version of NppExec Manual HOT 14
- How to clean HOT 1
- How to clean up/delete the list saved in F6 HOT 1
- [HTML docs] External links are not navigable HOT 4
- There is something wrong with the console output encoding. HOT 2
- How to get current dir name only (not full path) HOT 2
- License? HOT 4
- XBrackets release accidentally added to this repo? HOT 2
- Double clicking line in console output jumps to the first tab ocurrence if you have multiple tabs open with different files of the same name HOT 4
- im trying to compile a qc file and its saying : ERROR:bad or missing options HOT 1
- Issues getting NppExec console to work with Python's getpass module or third party pwinput module HOT 2
- Notepad++ dev build NPP_OPEN fails HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nppexec.