Fix macro playback inseting/removing characters randomly.

Fix macro playback inseting/removing characters randomly due to
auto-insert interfering during macro recording and playing back. (fixes
#649, fixes #970, fixes #304, fixes #992)
This commit is contained in:
Don Ho 2015-10-07 17:55:29 +02:00
parent 35adb1910b
commit 981ee5ed72
3 changed files with 17 additions and 10 deletions

View File

@ -369,6 +369,7 @@ private:
// Keystroke macro recording and playback // Keystroke macro recording and playback
Macro _macro; Macro _macro;
bool _recordingMacro = false; bool _recordingMacro = false;
bool _playingBackMacro = false;
RunMacroDlg _runMacroDlg; RunMacroDlg _runMacroDlg;
// For hotspot // For hotspot

View File

@ -637,7 +637,11 @@ void Notepad_plus::command(int id)
case IDM_MACRO_PLAYBACKRECORDEDMACRO: case IDM_MACRO_PLAYBACKRECORDEDMACRO:
if (!_recordingMacro) // if we're not currently recording, then playback the recorded keystrokes if (!_recordingMacro) // if we're not currently recording, then playback the recorded keystrokes
{
_playingBackMacro = true;
macroPlayback(_macro); macroPlayback(_macro);
_playingBackMacro = false;
}
break; break;
case IDM_MACRO_RUNMULTIMACRODLG : case IDM_MACRO_RUNMULTIMACRODLG :

View File

@ -514,6 +514,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
case SCN_CHARADDED: case SCN_CHARADDED:
{
if (!_recordingMacro && !_playingBackMacro) // No macro recording or playing back
{ {
const NppGUI & nppGui = NppParameters::getInstance()->getNppGUI(); const NppGUI & nppGui = NppParameters::getInstance()->getNppGUI();
bool indentMaintain = nppGui._maitainIndent; bool indentMaintain = nppGui._maitainIndent;
@ -525,7 +527,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (nppGui._matchedPairConf.hasAnyPairsPair() && !isColumnMode) if (nppGui._matchedPairConf.hasAnyPairsPair() && !isColumnMode)
autoC->insertMatchedChars(notification->ch, nppGui._matchedPairConf); autoC->insertMatchedChars(notification->ch, nppGui._matchedPairConf);
autoC->update(notification->ch); autoC->update(notification->ch);
}
break; break;
} }