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

@ -515,17 +515,19 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_CHARADDED: case SCN_CHARADDED:
{ {
const NppGUI & nppGui = NppParameters::getInstance()->getNppGUI(); if (!_recordingMacro && !_playingBackMacro) // No macro recording or playing back
bool indentMaintain = nppGui._maitainIndent; {
if (indentMaintain) const NppGUI & nppGui = NppParameters::getInstance()->getNppGUI();
maintainIndentation(static_cast<TCHAR>(notification->ch)); bool indentMaintain = nppGui._maitainIndent;
if (indentMaintain)
AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub; maintainIndentation(static_cast<TCHAR>(notification->ch));
bool isColumnMode = _pEditView->execute(SCI_GETSELECTIONS) > 1; // Multi-Selection || Column mode)
if (nppGui._matchedPairConf.hasAnyPairsPair() && !isColumnMode)
autoC->insertMatchedChars(notification->ch, nppGui._matchedPairConf);
autoC->update(notification->ch);
AutoCompletion * autoC = isFromPrimary ? &_autoCompleteMain : &_autoCompleteSub;
bool isColumnMode = _pEditView->execute(SCI_GETSELECTIONS) > 1; // Multi-Selection || Column mode)
if (nppGui._matchedPairConf.hasAnyPairsPair() && !isColumnMode)
autoC->insertMatchedChars(notification->ch, nppGui._matchedPairConf);
autoC->update(notification->ch);
}
break; break;
} }