Skip to content

Commit

Permalink
Include 8.1.9.x patch releases in version check
Browse files Browse the repository at this point in the history
Also compensate for shorter length returned by SCI_GETTEXT (since 5.1.5)
  • Loading branch information
Robert Di Pardo authored and Robert Di Pardo committed Mar 28, 2022
1 parent e16708a commit 4a496ff
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/LibNppPlugin/NppSimpleObjects.pas
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ TApplication = class(TWindowedObject)
implementation

uses
{$IFDEF SCI_5}Math,{$ENDIF}
SysUtils;
// L_DebugLogger,

Expand Down Expand Up @@ -1490,8 +1491,6 @@ function TActiveDocument.GetReadOnly: boolean;

function TActiveDocument.GetText: WideString;
{
TODO: Add 1 to length when Npp's API advances to Scintilla 5.x.x
Per https://www.scintilla.org/ScintillaHistory.html § 5.1.5
"When calling SCI_GETTEXT, SCI_GETSELTEXT, and SCI_GETCURLINE with a NULL
Expand All @@ -1506,6 +1505,9 @@ function TActiveDocument.GetText: WideString;
Len: Sci_PositionU;
begin
Len := SendMessage(SCI_GETTEXT, WPARAM(High(Sci_PositionU)) - 1, nil);
{$IFDEF SCI_5}
Len := Round(MinValue([Len + 1, SendMessage(SCI_GETLENGTH)]));
{$ENDIF}
SetLength(Chars, Len);
SendMessage(SCI_GETTEXT, Len, PAnsiChar(Chars));
Result := WideString(Chars);
Expand Down
23 changes: 18 additions & 5 deletions src/U_Npp_HTMLTag.pas
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,28 @@ procedure TNppPluginHTMLTag.commandAbout;

{ ------------------------------------------------------------------------------------------------ }
function TNppPluginHTMLTag.SupportsBigFiles: Boolean;
const
PatchReleases: Array[0..2] of Word = ( 191, 192, 193 );
var
NppVerison: Cardinal;
NppVersion: Cardinal;
IsPatchRelease: Boolean;
i: Byte;
begin
NppVerison := FApp.SendMessage(NPPM_GETNPPVERSION);
NppVersion := FApp.SendMessage(NPPM_GETNPPVERSION);
IsPatchRelease := False;

for i := 0 to Length(PatchReleases) - 1 do
begin
IsPatchRelease := (LOWORD(NppVersion) = PatchReleases[i]);
if IsPatchRelease then Break;
end;

Result :=
(HIWORD(NppVerison) > 8) or
((HIWORD(NppVerison) = 8) and
(HIWORD(NppVersion) > 8) or
((HIWORD(NppVersion) = 8) and
// 8.3 -> 8,3 (*not* 8,30)
((LOWORD(NppVerison) = 3) or (LOWORD(NppVerison) > 21)));
((LOWORD(NppVersion) = 3) or
((LOWORD(NppVersion) > 21) and not IsPatchRelease)))
end {TNppPluginHTMLTag.SupportsBigFiles};


Expand Down
4 changes: 2 additions & 2 deletions src/prj/HTMLTag.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<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>
<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>
<DCC_ExeOutput>..\..\out\$(PLATFORM)\$(CONFIG)</DCC_ExeOutput>
<DCC_Define>UNICODE;NPPUNICODE;$(DCC_Define)</DCC_Define>
<DCC_Define>UNICODE;NPPUNICODE;SCI_5;$(DCC_Define)</DCC_Define>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_UnitSearchPath>..\;$(DELPHI)\Lib\Debug;C:\PROGRA~1\Jedi\jcl\lib\d6\debug;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
Expand Down Expand Up @@ -123,7 +123,7 @@ $(PostBuildEvent)]]></PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<Debugger_HostApplication>C:\Users\Rob\source\repos\workspace\bin\npp_8.3.2\notepad++.exe</Debugger_HostApplication>
<Debugger_HostApplication>C:\Users\Rob\source\repos\workspace\bin\npp_8.3.3\notepad++.exe</Debugger_HostApplication>
<PostBuildEvent><![CDATA[]]></PostBuildEvent>
</PropertyGroup>
<ItemGroup>
Expand Down

0 comments on commit 4a496ff

Please sign in to comment.