[BUG_FIXED] Fix macro recording bug for the non-ASCII characters.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@676 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-10-05 21:33:37 +00:00
parent e420ae3707
commit cfe63a2048
4 changed files with 19 additions and 8 deletions

View File

@ -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:

View File

@ -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<char *>(lParameter);
TCHAR tch = ch;
sParameter = tch;
char *ch = reinterpret_cast<char *>(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<LPARAM>(sParameter.c_str());
{
::WideCharToMultiByte(pEditView->execute(SCI_GETCODEPAGE), 0, sParameter.c_str(), -1, ansiBuffer, 3, NULL, NULL);
lParam = reinterpret_cast<LPARAM>(ansiBuffer);
}
pEditView->execute(message, wParameter, lParam);
if ( (message == SCI_SETTEXT)
|| (message == SCI_REPLACESEL)

View File

@ -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)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="Notepad++"
ProjectGUID="{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}"
RootNamespace="Notepad++"
@ -895,6 +895,10 @@
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
>