Skip to content

Commit 467c3b9

Browse files
committed
1 parent abaac2f commit 467c3b9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

PythonScript/src/NotepadPlusWrapper.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,14 @@ void NotepadPlusWrapper::activateBufferID(intptr_t bufferID)
790790
{
791791
notAllowedInScintillaCallback("activateBufferID() cannot be called in a synchronous editor callback. "
792792
"Use an asynchronous callback, or avoid using activateBufferID() in the callback handler");
793-
idx_t index = (idx_t)callNotepad(NPPM_GETPOSFROMBUFFERID, static_cast<WPARAM>(bufferID));
794-
UINT view = (index & 0xC0000000) >> 30;
795-
index = index & 0x3FFFFFFF;
793+
idx_t index = (idx_t)callNotepad(NPPM_GETPOSFROMBUFFERID, static_cast<WPARAM>(bufferID), static_cast<LPARAM>(getCurrentView()));
794+
if (index != -1)
795+
{
796+
UINT view = (index & 0xC0000000) >> 30;
797+
index = index & 0x3FFFFFFF;
796798

797-
callNotepad(NPPM_ACTIVATEDOC, view, (LPARAM)index);
799+
callNotepad(NPPM_ACTIVATEDOC, view, (LPARAM)index);
800+
}
798801
}
799802

800803
boost::python::str NotepadPlusWrapper::getBufferFilename(intptr_t bufferID)

0 commit comments

Comments
 (0)