Fix plugin shortcut configuration lost problem by using option -noPlugin. (closes #589)
Solution: save shortcut.xml only if shortcuts have been modified.pull/824/merge
parent
d7ca1eaaf6
commit
4fc06e2bc1
|
@ -1,15 +1,9 @@
|
|||
Notepad++ v6.8.2 bug-fixes:
|
||||
Notepad++ v6.8.3 bug-fixes:
|
||||
|
||||
1. Fix the crash by using wild card (*) to open files on command line.
|
||||
2. Fix the problem of display refresh missing on exit.
|
||||
3. Fix plugin shortcut configuration lost problem by using option -noPlugin.
|
||||
|
||||
1. Remove Source Code Pro font du to the different issues.
|
||||
2. Add back "Notepad++ Community (Forum)" menu item.
|
||||
3. Fix a visual glitch on starup and on exit.
|
||||
4. Fix "Open in/Move to new instance" issue (to memorize the language and the position).
|
||||
5. Fix Preferences dialog loses focus issue while enabling document list panel.
|
||||
6. Fix the narrow columns problem in Ascii Insert Panel under a high DPI.
|
||||
7. Fix the list items' squeezed height problem in function list panel and project panel under a high DPI.
|
||||
8. Fix panel caption squeezed display under a high DPI.
|
||||
9. Fixed buffer overrun when opening a recent file.
|
||||
10. Make toolbar refresh properly while switching over small/big icons.
|
||||
|
||||
|
||||
Included plugins:
|
||||
|
|
|
@ -2934,7 +2934,9 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
|
|||
|
||||
void NppParameters::writeShortcuts()
|
||||
{
|
||||
if (!_pXmlShortcutDoc)
|
||||
if (not _isAnyShortcutModified) return;
|
||||
|
||||
if (not _pXmlShortcutDoc)
|
||||
{
|
||||
//do the treatment
|
||||
_pXmlShortcutDoc = new TiXmlDocument(_shortcutsPath);
|
||||
|
|
|
@ -1626,7 +1626,10 @@ private:
|
|||
WNDPROC _enableThemeDialogTextureFuncAddr;
|
||||
bool _isLocal;
|
||||
|
||||
|
||||
public:
|
||||
void setShortcutDirty() { _isAnyShortcutModified = true; };
|
||||
private:
|
||||
bool _isAnyShortcutModified = false;
|
||||
std::vector<CommandShortcut> _shortcuts; //main menu shortuts. Static size
|
||||
std::vector<int> _customizedShortcuts; //altered main menu shortcuts. Indices static. Needed when saving alterations
|
||||
std::vector<MacroShortcut> _macros; //macro shortcuts, dynamic size, defined on loading macros and adding/deleting them
|
||||
|
|
|
@ -230,59 +230,78 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
NppParameters *nppParam = NppParameters::getInstance();
|
||||
int row = _babygrid.getSelectedRow();
|
||||
|
||||
switch(_currentState) {
|
||||
case STATE_MENU: {
|
||||
switch(_currentState)
|
||||
{
|
||||
case STATE_MENU:
|
||||
{
|
||||
//Get CommandShortcut corresponding to row
|
||||
vector<CommandShortcut> & shortcuts = nppParam->getUserShortcuts();
|
||||
CommandShortcut csc = shortcuts[row - 1], prevcsc = shortcuts[row - 1];
|
||||
csc.init(_hInst, _hSelf);
|
||||
if (csc.doDialog() != -1 && prevcsc != csc) { //shortcut was altered
|
||||
if (csc.doDialog() != -1 && prevcsc != csc)
|
||||
{
|
||||
//shortcut was altered
|
||||
nppParam->addUserModifiedIndex(row-1);
|
||||
shortcuts[row - 1] = csc;
|
||||
_babygrid.setText(row, 2, csc.toString().c_str());
|
||||
//Notify current Accelerator class to update everything
|
||||
nppParam->getAccelerator()->updateShortcuts();
|
||||
|
||||
nppParam->setShortcutDirty();
|
||||
}
|
||||
break; }
|
||||
case STATE_MACRO: {
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_MACRO:
|
||||
{
|
||||
//Get MacroShortcut corresponding to row
|
||||
vector<MacroShortcut> & shortcuts = nppParam->getMacroList();
|
||||
MacroShortcut msc = shortcuts[row - 1], prevmsc = shortcuts[row - 1];
|
||||
msc.init(_hInst, _hSelf);
|
||||
if (msc.doDialog() != -1 && prevmsc != msc) { //shortcut was altered
|
||||
if (msc.doDialog() != -1 && prevmsc != msc)
|
||||
{
|
||||
//shortcut was altered
|
||||
shortcuts[row - 1] = msc;
|
||||
_babygrid.setText(row, 1, msc.getName());
|
||||
_babygrid.setText(row, 2, msc.toString().c_str());
|
||||
|
||||
//Notify current Accelerator class to update everything
|
||||
nppParam->getAccelerator()->updateShortcuts();
|
||||
|
||||
nppParam->setShortcutDirty();
|
||||
}
|
||||
break; }
|
||||
case STATE_USER: {
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_USER:
|
||||
{
|
||||
//Get UserCommand corresponding to row
|
||||
vector<UserCommand> & shortcuts = nppParam->getUserCommandList();
|
||||
UserCommand ucmd = shortcuts[row - 1], prevucmd = shortcuts[row - 1];
|
||||
ucmd.init(_hInst, _hSelf);
|
||||
prevucmd = ucmd;
|
||||
if (ucmd.doDialog() != -1 && prevucmd != ucmd) { //shortcut was altered
|
||||
if (ucmd.doDialog() != -1 && prevucmd != ucmd)
|
||||
{
|
||||
//shortcut was altered
|
||||
shortcuts[row - 1] = ucmd;
|
||||
_babygrid.setText(row, 1, ucmd.getName());
|
||||
_babygrid.setText(row, 2, ucmd.toString().c_str());
|
||||
|
||||
//Notify current Accelerator class to update everything
|
||||
nppParam->getAccelerator()->updateShortcuts();
|
||||
|
||||
nppParam->setShortcutDirty();
|
||||
}
|
||||
break; }
|
||||
case STATE_PLUGIN: {
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_PLUGIN:
|
||||
{
|
||||
//Get PluginCmdShortcut corresponding to row
|
||||
vector<PluginCmdShortcut> & shortcuts = nppParam->getPluginCommandList();
|
||||
PluginCmdShortcut pcsc = shortcuts[row - 1], prevpcsc = shortcuts[row - 1];
|
||||
pcsc.init(_hInst, _hSelf);
|
||||
prevpcsc = pcsc;
|
||||
if (pcsc.doDialog() != -1 && prevpcsc != pcsc) { //shortcut was altered
|
||||
if (pcsc.doDialog() != -1 && prevpcsc != pcsc)
|
||||
{
|
||||
//shortcut was altered
|
||||
nppParam->addPluginModifiedIndex(row-1);
|
||||
shortcuts[row - 1] = pcsc;
|
||||
_babygrid.setText(row, 2, pcsc.toString().c_str());
|
||||
|
@ -297,9 +316,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
shortcut._key = pcsc.getKeyCombo()._key;
|
||||
|
||||
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, (LPARAM)&shortcut);
|
||||
nppParam->setShortcutDirty();
|
||||
}
|
||||
break; }
|
||||
case STATE_SCINTILLA: {
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_SCINTILLA:
|
||||
{
|
||||
//Get ScintillaKeyMap corresponding to row
|
||||
vector<ScintillaKeyMap> & shortcuts = nppParam->getScintillaKeyList();
|
||||
ScintillaKeyMap skm = shortcuts[row - 1], prevskm = shortcuts[row-1];
|
||||
|
@ -313,12 +336,14 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
|
||||
//Notify current Accelerator class to update key
|
||||
nppParam->getScintillaAccelerator()->updateKeys();
|
||||
nppParam->setShortcutDirty();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDM_BABYGRID_DELETE :
|
||||
{
|
||||
NppParameters *nppParam = NppParameters::getInstance();
|
||||
|
@ -341,6 +366,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
return FALSE; //this is bad
|
||||
}
|
||||
|
||||
case STATE_MACRO:
|
||||
{
|
||||
vector<MacroShortcut> & theMacros = nppParam->getMacroList();
|
||||
|
@ -362,6 +388,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_USER:
|
||||
{
|
||||
vector<UserCommand> & theUserCmds = nppParam->getUserCommandList();
|
||||
|
@ -387,6 +414,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
|
||||
// updateShortcuts() will update all menu item - the menu items will be shifted
|
||||
nppParam->getAccelerator()->updateShortcuts();
|
||||
nppParam->setShortcutDirty();
|
||||
|
||||
// All menu items are shifted up. So we delete the last item
|
||||
::RemoveMenu(hMenu, posBase + nbElem, MF_BYPOSITION);
|
||||
|
|
Loading…
Reference in New Issue