Skip to content

Commit 6b9fb52

Browse files
committed
Scintilla view index must be 32-bit
Cf. https://github.com/notepad-plus-plus/notepad-plus-plus/blob/136c8d11978770b2a2d8c27f6de7dff2010a99bf/PowerEditor/src/NppBigSwitch.cpp#L1118 Also: ensure Scintilla API level is set **after** the version in known
1 parent f7722d5 commit 6b9fb52

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/Forms/resource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#include <windows.h>
1212

13-
#define HTMLTAG_VERSION L"1.5.1.1\0"
14-
#define HTMLTAG_VERSION_WORDS 1, 5, 1, 1
13+
#define HTMLTAG_VERSION L"1.5.1.2\0"
14+
#define HTMLTAG_VERSION_WORDS 1, 5, 1, 2
1515

1616
#define ID_ABOUT_HTML_TAG_DLG 0x1000
1717
#define ID_UNICODE_FMT_CONFIG_DLG 0x2000

src/LibNppPlugin/PluginBase.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ PluginBase::~PluginBase() {
2626
// --------------------------------------------------------------------------------------
2727
void PluginBase::setInfo(const NppData *data) {
2828
_data = *data;
29-
_editor = SciApplication::getApplication(data, apiLevel());
30-
3129
DWORD versionWords = static_cast<DWORD>(sendNppMessage(NPPM_GETNPPVERSION));
3230
div_t loWords = ::div((versionWords & 0xffff) * 10, 10);
3331
while (loWords.quot > 9) {
@@ -37,10 +35,11 @@ void PluginBase::setInfo(const NppData *data) {
3735
_nppVersion.major = ((versionWords >> 0x10) & 0xffff);
3836
_nppVersion.minor = loWords.quot;
3937
_nppVersion.revision = loWords.rem;
38+
_editor = SciApplication::getApplication(data, apiLevel());
4039
}
4140
// --------------------------------------------------------------------------------------
4241
HWND PluginBase::currentScintilla() const {
43-
intptr_t index = -1;
42+
DWORD_PTR index = 0;
4443
sendNppMessage(NPPM_GETCURRENTSCINTILLA, UNUSEDW, &index);
4544
return (index > 0) ? _data._scintillaSecondHandle : _data._scintillaMainHandle;
4645
}
@@ -161,7 +160,7 @@ path_t PluginBase::pluginNameFromModule(HMODULE hInstace) {
161160
// SciApplication
162161
// --------------------------------------------------------------------------------------
163162
SciActiveDocument const &SciApplication::getDocument() const {
164-
intptr_t index = -1;
163+
DWORD_PTR index = 0;
165164
sendMessage(NPPM_GETCURRENTSCINTILLA, UNUSEDW, &index);
166165
return getViews()[(index > 0)];
167166
}

0 commit comments

Comments
 (0)