diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index c987581a..f2b70949 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -622,7 +622,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; case SCN_MACRORECORD: - _macro.push_back(recordedMacroStep(notification->message, notification->wParam, notification->lParam)); + _macro.push_back(recordedMacroStep(notification->message, notification->wParam, notification->lParam, _pEditView->execute(SCI_GETCODEPAGE))); break; case SCN_PAINTED: diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index f3d0f67d..75250d7f 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -537,7 +537,7 @@ void Accelerator::updateMenuItemByCommand(CommandShortcut csc) { ::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str()); } -recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam) +recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam, int codepage) : message(iMessage), wParameter(wParam), lParameter(lParam), MacroType(mtUseLParameter) { if (lParameter) { @@ -563,9 +563,10 @@ recordedMacroStep::recordedMacroStep(int iMessage, long wParam, long lParam) case IDD_FINDINFILES_DIR_COMBO: case IDD_FINDINFILES_FILTERS_COMBO: { - char ch = *reinterpret_cast(lParameter); - TCHAR tch = ch; - sParameter = tch; + char *ch = reinterpret_cast(lParameter); + TCHAR tch[2]; + ::MultiByteToWideChar(codepage, 0, ch, -1, tch, 2); + sParameter = *tch; MacroType = mtUseSParameter; lParameter = 0; @@ -587,8 +588,14 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView) else { long lParam = lParameter; + char ansiBuffer[3]; + if (MacroType == mtUseSParameter) - lParam = reinterpret_cast(sParameter.c_str()); + { + ::WideCharToMultiByte(pEditView->execute(SCI_GETCODEPAGE), 0, sParameter.c_str(), -1, ansiBuffer, 3, NULL, NULL); + lParam = reinterpret_cast(ansiBuffer); + } + pEditView->execute(message, wParameter, lParam); if ( (message == SCI_SETTEXT) || (message == SCI_REPLACESEL) diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.h b/PowerEditor/src/WinControls/shortcut/shortcut.h index 4fa011ef..a4178f4f 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.h +++ b/PowerEditor/src/WinControls/shortcut/shortcut.h @@ -268,7 +268,7 @@ struct recordedMacroStep { generic_string sParameter; MacroTypeIndex MacroType; - recordedMacroStep(int iMessage, long wParam, long lParam); + recordedMacroStep(int iMessage, long wParam, long lParam, int codepage); recordedMacroStep(int iCommandID) : message(0), wParameter(iCommandID), lParameter(0), MacroType(mtMenuCommand) {}; recordedMacroStep(int iMessage, long wParam, long lParam, const TCHAR *sParam, int type) diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index 57afd4cd..8a224ae3 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -1,7 +1,7 @@ + +