Skip to content

Commit 1ff61a7

Browse files
Robert Di PardoRobert Di Pardo
authored andcommitted
Issue warning about minimum supported N++ version
1 parent 8993825 commit 1ff61a7

2 files changed

Lines changed: 91 additions & 22 deletions

File tree

README.textile

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ It originated in these requests on the Plugin Development forum on SourceForge.n
2222

2323
h2. Installation
2424

25+
===============================================================================================
26+
27+
h3. _Warning_
28+
29+
_*Always* check your Notepad++ version at "? > Debug Info" before installing plugins_
30+
_Notepad++ 8.3 is the *minimum required* version for 64-bit releases of HTML Tag 1.2 and newer_
31+
32+
You can safely use any 32-bit version of HTML Tag with any 32-bit version of Notepad++
33+
34+
===============================================================================================
35+
2536
As usual:
2637
Extract the DLL and accompanying files to the plugins folder under
2738
@%ProgramFiles%\Notepad++@ (or wherever you're running Notepad++ from) or @%AppData%\Notepad++@, and (re)start Np++.
@@ -57,8 +68,8 @@ _Up to version 1.1.0, plugin release bundles include all of the following:_
5768
h2. History
5869

5970
* 1.1.0 - 2017-09-04 20:15
60-
** Added: option to encode line break entities as well [689eef6cee]
61-
** Fixed: decoding a JS escape reduced the selection by one each time [e717ed1de5]
71+
** Added: option to encode line break entities as well "[689eef6cee]":689eef6cee
72+
** Fixed: decoding a JS escape reduced the selection by one each time "[e717ed1de5]":e717ed1de5
6273
* 1.0.0 - 2017-02-19 16:03
6374
** Added: 64-bit version
6475
** Several tiny bugfixes
@@ -92,12 +103,18 @@ h2. History
92103

93104
h3. To do
94105

95-
* [Request#1848503] Add a command to close the open tag at the current location
106+
* "[Request#1848503]":1848503 Add a command to close the open tag at the current location
96107
* Add command to encode entities in the contents only (only apply encoding when not inside tags;
97108
leave valid tags and entities alone)
98109
* Add command to select tags only (and leave the contents out of the selection)
99110
* Make it play nice(r) with PHP & ASP tags (either highlight those separately or ignore them)
100111
* Add option to encode entities 'as-you-type'
101112
* Add option to close tags 'as-you-type' (type '</' and the rest will be inserted automagically)
102-
* [Request#2147949] drop down a list of tags after '<'
103-
* [Request#2147949] drop down a list of attributes on space after a tag
113+
* "[Request#2147949]":2147949 drop down a list of tags after '<'
114+
* "[Request#2147949]":2147949 drop down a list of attributes on space after a tag
115+
116+
117+
[689eef6cee]https://fossil.2of4.net/npp_htmltag/info/689eef6cee
118+
[e717ed1de5]https://fossil.2of4.net/npp_htmltag/info/e717ed1de5
119+
[1848503]https://fossil.2of4.net/npp_htmltag/tktview?name=a3fc2e7864
120+
[2147949]https://fossil.2of4.net/npp_htmltag/tktview?name=43695affda

src/U_Npp_HTMLTag.pas

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ interface
66
uses
77
SysUtils, Windows,
88
NppPlugin, SciSupport,
9-
NppSimpleObjects;
9+
NppSimpleObjects, L_VersionInfoW;
1010

1111
type
1212
TNppPluginHTMLTag = class(TNppPlugin)
1313
private
1414
FApp: TApplication;
15+
FVersionInfo: TFileVersionInfo;
16+
FVersionStr: nppString;
17+
function SupportsBigFiles: Boolean;
1518
public
1619
constructor Create;
20+
destructor Destroy; override;
1721
procedure commandFindMatchingTag;
1822
procedure commandSelectTagContents;
1923
procedure commandSelectTagContentsOnly;
@@ -46,9 +50,9 @@ procedure _commandAbout(); cdecl;
4650
implementation
4751

4852
uses
49-
DateUtils,
53+
Strutils,
5054
ShellAPI,
51-
L_VersionInfoW, L_SpecialFolders,
55+
L_SpecialFolders,
5256
U_HTMLTagFinder, U_Entities, U_JSEncode;
5357

5458
{ ------------------------------------------------------------------------------------------------ }
@@ -152,13 +156,51 @@ constructor TNppPluginHTMLTag.Create;
152156
self.AddFuncSeparator;
153157

154158
self.AddFuncItem('&About...', _commandAbout);
159+
160+
try
161+
FVersionInfo := TFileVersionInfo.Create(TSpecialFolders.DLLFullName);
162+
FVersionStr := ChangeFileExt(ExtractFileName(TSpecialFolders.DLLFullName), '');
163+
FVersionStr :=
164+
Concat(FVersionStr,
165+
Format(' %d.%d.%d (%s bit)',
166+
[FVersionInfo.MajorVersion, FVersionInfo.MinorVersion, FVersionInfo.Revision,
167+
{$IFDEF CPUX64}'64'{$ELSE}'32'{$ENDIF}]));
168+
except
169+
FreeAndNil(FVersionInfo);
170+
end;
171+
172+
{$IFNDEF CPUX64}
173+
FVersionStr := ReplaceStr(FVersionStr, '_unicode', '');
174+
{$ENDIF}
175+
end;
176+
177+
{ ------------------------------------------------------------------------------------------------ }
178+
destructor TNppPluginHTMLTag.Destroy;
179+
begin
180+
if Assigned(FVersionInfo) then
181+
FreeAndNil(FVersionInfo);
182+
inherited;
155183
end;
156184

157185
{ ------------------------------------------------------------------------------------------------ }
158186
procedure TNppPluginHTMLTag.DoNppnToolbarModification;
187+
var
188+
Msg: string;
159189
begin
160190
inherited;
161191
FApp := GetApplication(@Self.NppData);
192+
193+
{$IFDEF CPUX64}
194+
try
195+
if not SupportsBigFiles then begin
196+
Msg := 'The installed version of HTML Tag requires Notepad++ 8.3 or newer.'#13#10
197+
+ 'Running any plugin command will crash the application!';
198+
MessageBox(App.WindowHandle, PChar(Msg), PChar(FVersionStr), MB_ICONWARNING);
199+
end;
200+
except
201+
HandleException(ExceptObject, ExceptAddr);
202+
end;
203+
{$ENDIF}
162204
end;
163205

164206
{ ------------------------------------------------------------------------------------------------ }
@@ -253,40 +295,50 @@ procedure TNppPluginHTMLTag.commandDecodeJS;
253295
{ ------------------------------------------------------------------------------------------------ }
254296
procedure TNppPluginHTMLTag.commandAbout;
255297
var
256-
Version: TFileVersionInfo;
257298
Text, DLLName: string;
258299
begin
259300
try
260301
DLLName := TSpecialFolders.DLLFullName;
261-
Version := TFileVersionInfo.Create(DLLName);
262-
try
263-
Text := Format('%s v%s %s'#10#10
302+
if not Assigned(FVersionInfo) then begin
303+
FVersionInfo := TFileVersionInfo.Create(DLLName);
304+
end;
305+
306+
Text := Format('%s'#10#10
264307
+ 'Plug-in location: %s'#10
265308
+ 'Config location: %s'#10
266309
+ 'Bugs: %s'#10
267310
+ 'Download: %s'#10#10
268311
+ #$00A9' 2011-2020 %s - %s'#10
269312
+ ' a.k.a. %s - %s (v0.1 - v1.1)'#10
270-
+ #$00A9' 2022 Robert Di Pardo (v1.2 -)'#10#10
313+
+ #$00A9' 2022 Robert Di Pardo (since v1.2)'#10#10
271314
+ 'Licensed under the %s - %s',
272-
[ExtractFileName(DLLName), Version.FileVersion,
273-
{$IFDEF WIN64}'(64-bits)'{$ELSE}'(32-bits)'{$ENDIF},
274-
ExtractFilePath(DLLName),
315+
[FVersionStr,
316+
ExtractFileDir(DLLName),
275317
App.ConfigFolder,
276-
Version.Comments,
318+
FVersionInfo.Comments,
277319
'https://bitbucket.org/rdipardo/htmltag/downloads',
278-
Version.LegalCopyright, 'http://fossil.2of4.net/npp_htmltag', // 'http://martijn.coppoolse.com/software',
320+
FVersionInfo.LegalCopyright, 'http://fossil.2of4.net/npp_htmltag', // 'http://martijn.coppoolse.com/software',
279321
'vor0nwe', 'http://sourceforge.net/users/vor0nwe',
280322
'MPL 1.1', 'http://www.mozilla.org/MPL/1.1']);
281-
MessageBox(App.WindowHandle, PChar(Text), PChar(Version.FileDescription), MB_ICONINFORMATION)
282-
finally
283-
FreeAndNil(Version);
284-
end;
323+
MessageBox(App.WindowHandle, PChar(Text), PChar(FVersionInfo.FileDescription), MB_ICONINFORMATION)
285324
except
286325
HandleException(ExceptObject, ExceptAddr);
287326
end;
288327
end {TNppPluginHTMLTag.commandAbout};
289328

329+
{ ------------------------------------------------------------------------------------------------ }
330+
function TNppPluginHTMLTag.SupportsBigFiles: Boolean;
331+
var
332+
NppVerison: Cardinal;
333+
begin
334+
NppVerison := FApp.SendMessage(NPPM_GETNPPVERSION);
335+
Result :=
336+
(HIWORD(NppVerison) > 8) or
337+
((HIWORD(NppVerison) = 8) and
338+
// 8.3 -> 8,3 (*not* 8,30)
339+
((LOWORD(NppVerison) = 3) or (LOWORD(NppVerison) > 21)));
340+
end {TNppPluginHTMLTag.SupportsBigFiles};
341+
290342

291343

292344

0 commit comments

Comments
 (0)