Fix too small buffer issue during add text macro playback
Fix #7642, close #7730
This commit is contained in:
parent
1c4157109f
commit
53452d96e0
@ -834,9 +834,10 @@ void recordedMacroStep::PlayBack(Window* pNotepad, ScintillaEditView *pEditView)
|
|||||||
|
|
||||||
if (_macroType == mtUseSParameter)
|
if (_macroType == mtUseSParameter)
|
||||||
{
|
{
|
||||||
char ansiBuffer[3];
|
int byteBufferLength = ::WideCharToMultiByte(static_cast<UINT>(pEditView->execute(SCI_GETCODEPAGE)), 0, _sParameter.c_str(), -1, NULL, 0, NULL, NULL);
|
||||||
::WideCharToMultiByte(static_cast<UINT>(pEditView->execute(SCI_GETCODEPAGE)), 0, _sParameter.c_str(), -1, ansiBuffer, 3, NULL, NULL);
|
auto byteBuffer = std::make_unique< char[] >(byteBufferLength);
|
||||||
auto lParam = reinterpret_cast<LPARAM>(ansiBuffer);
|
::WideCharToMultiByte(static_cast<UINT>(pEditView->execute(SCI_GETCODEPAGE)), 0, _sParameter.c_str(), -1, byteBuffer.get(), byteBufferLength, NULL, NULL);
|
||||||
|
auto lParam = reinterpret_cast<LPARAM>(byteBuffer.get());
|
||||||
pEditView->execute(_message, _wParameter, lParam);
|
pEditView->execute(_message, _wParameter, lParam);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user