Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
/ nppFSIPlugin Public archive
forked from ppv/NPPFSIPlugin

Commit 9b74de1

Browse files
committed
Prevent access violations in older editors
The transition to Scintilla 4.4.6 brought with it a safer external lexer implementation, patched in as an out-of-tree module [^1]; but N++ versions < 7.9.4 unconditionally follow a function pointer to 'GetLexerFactory', which was left out by 99b134c ---- [^1] https://github.com/notepad-plus-plus/notepad-plus-plus/blob/d7819cf601051510b7fa1640ca17fedad297e1f8/scintilla/src/ExternalLexer.cxx#L131-L135
1 parent 99b134c commit 9b74de1

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Source/Plugin/NPPFSIPlugin.lpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ procedure DLLEntry(dwReason: DWORD);
236236
{$ENDREGION}
237237
exports
238238
GetLexerCount,
239+
GetLexerFactory,
239240
GetLexerName,
240241
GetLexerStatusText,
241242
CreateLexer,

Source/Plugin/Src/ILexerExports.pas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function CreateLexer(const Name: PAnsiChar): NativeInt; stdcall;
1515
procedure GetLexerName({%H-}LexerIndex: Cardinal; Name: PAnsiChar; BufLength: Integer); stdcall;
1616

1717
/// Unused since Npp v8.4, but needed to prevent a load exception in older versions
18+
function GetLexerFactory({%H-}LexerIndex: Cardinal): NativeInt; stdcall;
1819
procedure GetLexerStatusText({%H-}LexerIndex: Cardinal; Name: PWideChar; BufLength: Integer); stdcall;
1920

2021
implementation
@@ -40,6 +41,11 @@ procedure GetLexerName({%H-}LexerIndex: Cardinal; Name: PAnsiChar; BufLength: In
4041
StrLCopy(Name, PAnsiChar(lexerName), BufLength);
4142
end;
4243

44+
function GetLexerFactory({%H-}LexerIndex: Cardinal): NativeInt; stdcall;
45+
begin
46+
Result := 0;
47+
end;
48+
4349
procedure GetLexerStatusText({%H-}LexerIndex: Cardinal; Name: PWideChar; BufLength: Integer); stdcall;
4450
const
4551
lexerName: WideString = 'F# source file';

0 commit comments

Comments
 (0)