Skip to content

Commit 4a496ff

Browse files
Robert Di PardoRobert Di Pardo
authored andcommitted
Include 8.1.9.x patch releases in version check
Also compensate for shorter length returned by SCI_GETTEXT (since 5.1.5)
1 parent e16708a commit 4a496ff

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

src/LibNppPlugin/NppSimpleObjects.pas

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ TApplication = class(TWindowedObject)
260260
implementation
261261

262262
uses
263+
{$IFDEF SCI_5}Math,{$ENDIF}
263264
SysUtils;
264265
// L_DebugLogger,
265266

@@ -1490,8 +1491,6 @@ function TActiveDocument.GetReadOnly: boolean;
14901491

14911492
function TActiveDocument.GetText: WideString;
14921493
{
1493-
TODO: Add 1 to length when Npp's API advances to Scintilla 5.x.x
1494-
14951494
Per https://www.scintilla.org/ScintillaHistory.html § 5.1.5
14961495
14971496
"When calling SCI_GETTEXT, SCI_GETSELTEXT, and SCI_GETCURLINE with a NULL
@@ -1506,6 +1505,9 @@ function TActiveDocument.GetText: WideString;
15061505
Len: Sci_PositionU;
15071506
begin
15081507
Len := SendMessage(SCI_GETTEXT, WPARAM(High(Sci_PositionU)) - 1, nil);
1508+
{$IFDEF SCI_5}
1509+
Len := Round(MinValue([Len + 1, SendMessage(SCI_GETLENGTH)]));
1510+
{$ENDIF}
15091511
SetLength(Chars, Len);
15101512
SendMessage(SCI_GETTEXT, Len, PAnsiChar(Chars));
15111513
Result := WideString(Chars);

src/U_Npp_HTMLTag.pas

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,28 @@ procedure TNppPluginHTMLTag.commandAbout;
360360

361361
{ ------------------------------------------------------------------------------------------------ }
362362
function TNppPluginHTMLTag.SupportsBigFiles: Boolean;
363+
const
364+
PatchReleases: Array[0..2] of Word = ( 191, 192, 193 );
363365
var
364-
NppVerison: Cardinal;
366+
NppVersion: Cardinal;
367+
IsPatchRelease: Boolean;
368+
i: Byte;
365369
begin
366-
NppVerison := FApp.SendMessage(NPPM_GETNPPVERSION);
370+
NppVersion := FApp.SendMessage(NPPM_GETNPPVERSION);
371+
IsPatchRelease := False;
372+
373+
for i := 0 to Length(PatchReleases) - 1 do
374+
begin
375+
IsPatchRelease := (LOWORD(NppVersion) = PatchReleases[i]);
376+
if IsPatchRelease then Break;
377+
end;
378+
367379
Result :=
368-
(HIWORD(NppVerison) > 8) or
369-
((HIWORD(NppVerison) = 8) and
380+
(HIWORD(NppVersion) > 8) or
381+
((HIWORD(NppVersion) = 8) and
370382
// 8.3 -> 8,3 (*not* 8,30)
371-
((LOWORD(NppVerison) = 3) or (LOWORD(NppVerison) > 21)));
383+
((LOWORD(NppVersion) = 3) or
384+
((LOWORD(NppVersion) > 21) and not IsPatchRelease)))
372385
end {TNppPluginHTMLTag.SupportsBigFiles};
373386

374387

src/prj/HTMLTag.dproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<VerInfo_Keys>CompanyName=Voronwë;FileDescription=HTMLTag plugin for Notepad++;FileVersion=1.2.1.0;InternalName=HTMLTag;LegalCopyright=Martijn Coppoolse;LegalTrademarks=;OriginalFilename=HTMLTag.dll;ProductName=HTMLTag;ProductVersion=1.2.1.0;Comments=https://bitbucket.org/rdipardo/htmltag/issues</VerInfo_Keys>
7070
<DCC_UsePackage>vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;soaprtl;dbexpress;dbxcds;indy;dclOffice2k;dOCI6;CoolTrayIcon_D6plus;curlpkg;ThemeManagerD6;VirtualTreesD6;Jcl;JclVcl;JvCoreD6R;JvSystemD6R;JvStdCtrlsD6R;JvAppFrmD6R;JvBandsD6R;JvDBD6R;JvDlgsD6R;JvBDED6R;JvCmpD6R;JvCryptD6R;JvCtrlsD6R;JvCustomD6R;JvDockingD6R;JvDotNetCtrlsD6R;JvEDID6R;JvGlobusD6R;JvHMID6R;JvInterpreterD6R;JvJansD6R;JvManagedThreadsD6R;JvMMD6R;JvNetD6R;JvPageCompsD6R;JvPluginD6R;JvPrintPreviewD6R;JvRuntimeDesignD6R;JvTimeFrameworkD6R;JvUIBD6R;JvValidatorsD6R;JvWizardD6R;JvXPCtrlsD6R;$(DCC_UsePackage)</DCC_UsePackage>
7171
<DCC_ExeOutput>..\..\out\$(PLATFORM)\$(CONFIG)</DCC_ExeOutput>
72-
<DCC_Define>UNICODE;NPPUNICODE;$(DCC_Define)</DCC_Define>
72+
<DCC_Define>UNICODE;NPPUNICODE;SCI_5;$(DCC_Define)</DCC_Define>
7373
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
7474
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
7575
<DCC_UnitSearchPath>..\;$(DELPHI)\Lib\Debug;C:\PROGRA~1\Jedi\jcl\lib\d6\debug;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
@@ -123,7 +123,7 @@ $(PostBuildEvent)]]></PostBuildEvent>
123123
</PropertyGroup>
124124
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
125125
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
126-
<Debugger_HostApplication>C:\Users\Rob\source\repos\workspace\bin\npp_8.3.2\notepad++.exe</Debugger_HostApplication>
126+
<Debugger_HostApplication>C:\Users\Rob\source\repos\workspace\bin\npp_8.3.3\notepad++.exe</Debugger_HostApplication>
127127
<PostBuildEvent><![CDATA[]]></PostBuildEvent>
128128
</PropertyGroup>
129129
<ItemGroup>

0 commit comments

Comments
 (0)