Skip to content

Commit 54bff32

Browse files
committed
- update to N++ interfaces for 8.4.1 with scintilla 5.2.2 and lexilla 5.1.6
- fix issue with ConsoleDialog lexer usage of SCLEX_CONTAINER, issue: Console Lexer broken in Notepad 8.3.3 / Scintilla 5+ bruderstein#234 open issue: how to use setILexer from python, needed for sample script ColumnLexer.py - adapted CreateWrapper.py to also read LexicalStyles.iface open issue: handling of colouralpha and related calls, currently just handled like colour, so alpha info is missing
1 parent 5d22aef commit 54bff32

28 files changed

+4377
-2518
lines changed

NppPlugin/include/Common.h

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <cstdint>
2323
#include <unordered_set>
2424
#include <algorithm>
25+
#include <tchar.h>
2526

2627

2728
const bool dirUp = true;
@@ -159,10 +160,6 @@ class WcharMbcsConvertor final
159160
};
160161

161162

162-
163-
#define MACRO_RECORDING_IN_PROGRESS 1
164-
#define MACRO_RECORDING_HAS_STOPPED 2
165-
166163
#define REBARBAND_SIZE sizeof(REBARBANDINFO)
167164

168165
generic_string PathRemoveFileSpec(generic_string & path);
@@ -235,3 +232,57 @@ int nbDigitsFromNbLines(size_t nbLines);
235232
generic_string getDateTimeStrFrom(const generic_string& dateTimeFormat, const SYSTEMTIME& st);
236233

237234
HFONT createFont(const TCHAR* fontName, int fontSize, bool isBold, HWND hDestParent);
235+
236+
class Version final
237+
{
238+
public:
239+
Version() = default;
240+
Version(const generic_string& versionStr);
241+
242+
void setVersionFrom(const generic_string& filePath);
243+
generic_string toString();
244+
bool isNumber(const generic_string& s) const {
245+
return !s.empty() &&
246+
find_if(s.begin(), s.end(), [](TCHAR c) { return !_istdigit(c); }) == s.end();
247+
};
248+
249+
int compareTo(const Version& v2c) const;
250+
251+
bool operator < (const Version& v2c) const {
252+
return compareTo(v2c) == -1;
253+
};
254+
255+
bool operator <= (const Version& v2c) const {
256+
int r = compareTo(v2c);
257+
return r == -1 || r == 0;
258+
};
259+
260+
bool operator > (const Version& v2c) const {
261+
return compareTo(v2c) == 1;
262+
};
263+
264+
bool operator >= (const Version& v2c) const {
265+
int r = compareTo(v2c);
266+
return r == 1 || r == 0;
267+
};
268+
269+
bool operator == (const Version& v2c) const {
270+
return compareTo(v2c) == 0;
271+
};
272+
273+
bool operator != (const Version& v2c) const {
274+
return compareTo(v2c) != 0;
275+
};
276+
277+
bool empty() const {
278+
return _major == 0 && _minor == 0 && _patch == 0 && _build == 0;
279+
}
280+
281+
bool isCompatibleTo(const Version& from, const Version& to) const;
282+
283+
private:
284+
unsigned long _major = 0;
285+
unsigned long _minor = 0;
286+
unsigned long _patch = 0;
287+
unsigned long _build = 0;
288+
};

NppPlugin/include/Docking.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ struct tTbData {
5757
const TCHAR* pszAddInfo = nullptr; // for plugin to display additional informations
5858

5959
// internal data, do not use !!!
60-
RECT rcFloat = {0}; // floating position
60+
RECT rcFloat = {}; // floating position
6161
int iPrevCont = 0; // stores the privious container (toggling between float and dock)
6262
const TCHAR* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
6363
};
6464

6565

6666
struct tDockMgr {
6767
HWND hWnd = nullptr; // the docking manager wnd
68-
RECT rcRegion[DOCKCONT_MAX] = {{0}}; // position of docked dialogs
68+
RECT rcRegion[DOCKCONT_MAX] = {{}}; // position of docked dialogs
6969
};
7070

7171

NppPlugin/include/DockingDlgInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected :
104104
break;
105105
}
106106

107-
RECT rc = { 0 };
107+
RECT rc = {};
108108
getClientRect(rc);
109109
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
110110
return TRUE;

NppPlugin/include/Notepad_plus_msgs.h

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
3636
// Don't use L_JS, use L_JAVASCRIPT instead
3737
// The end of enumated language type, so it should be always at the end
3838
L_EXTERNAL};
39+
enum class ExternalLexerAutoIndentMode { Standard, C_Like, Custom };
40+
enum class MacroStatus { Idle, RecordInProgress, RecordingStopped, PlayingBack };
3941

40-
enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10 };
42+
enum winVer { WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10 };
4143
enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
4244

4345

@@ -454,6 +456,63 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
454456
HICON hToolbarIconDarkMode;
455457
};
456458

459+
#define NPPM_GETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 103)
460+
// BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const TCHAR *languageName, ExternalLexerAutoIndentMode &autoIndentMode)
461+
// Get ExternalLexerAutoIndentMode for an installed external programming language.
462+
// - Standard means Notepad++ will keep the same TAB indentation between lines;
463+
// - C_Like means Notepad++ will perform a C-Language style indentation for the selected external language;
464+
// - Custom means a Plugin will be controlling auto-indentation for the current language.
465+
// returned values: TRUE for successful searches, otherwise FALSE.
466+
467+
#define NPPM_SETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 104)
468+
// BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const TCHAR *languageName, ExternalLexerAutoIndentMode autoIndentMode)
469+
// Set ExternalLexerAutoIndentMode for an installed external programming language.
470+
// - Standard means Notepad++ will keep the same TAB indentation between lines;
471+
// - C_Like means Notepad++ will perform a C-Language style indentation for the selected external language;
472+
// - Custom means a Plugin will be controlling auto-indentation for the current language.
473+
// returned value: TRUE if function call was successful, otherwise FALSE.
474+
475+
#define NPPM_ISAUTOINDENTON (NPPMSG + 105)
476+
// BOOL NPPM_ISAUTOINDENTON(0, 0)
477+
// Returns the current Use Auto-Indentation setting in Notepad++ Preferences.
478+
479+
#define NPPM_GETCURRENTMACROSTATUS (NPPMSG + 106)
480+
// MacroStatus NPPM_GETCURRENTMACROSTATUS(0, 0)
481+
// Gets current enum class MacroStatus { Idle - means macro is not in use and it's empty, RecordInProgress, RecordingStopped, PlayingBack }
482+
483+
#define NPPM_ISDARKMODEENABLED (NPPMSG + 107)
484+
// bool NPPM_ISDARKMODEENABLED(0, 0)
485+
// Returns true when Notepad++ Dark Mode is enable, false when it is not.
486+
487+
#define NPPM_GETDARKMODECOLORS (NPPMSG + 108)
488+
// bool NPPM_GETDARKMODECOLORS (size_t cbSize, NppDarkMode::Colors* returnColors)
489+
// - cbSize must be filled with sizeof(NppDarkMode::Colors).
490+
// - returnColors must be a pre-allocated NppDarkMode::Colors struct.
491+
// Returns true when successful, false otherwise.
492+
// You need to uncomment the following code to use NppDarkMode::Colors structure:
493+
//
494+
// namespace NppDarkMode
495+
// {
496+
// struct Colors
497+
// {
498+
// COLORREF background = 0;
499+
// COLORREF softerBackground = 0;
500+
// COLORREF hotBackground = 0;
501+
// COLORREF pureBackground = 0;
502+
// COLORREF errorBackground = 0;
503+
// COLORREF text = 0;
504+
// COLORREF darkerText = 0;
505+
// COLORREF disabledText = 0;
506+
// COLORREF linkText = 0;
507+
// COLORREF edge = 0;
508+
// COLORREF hotEdge = 0;
509+
// };
510+
// }
511+
//
512+
// Note: in the case of calling failure ("false" is returned), you may need to change NppDarkMode::Colors structure to:
513+
// https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/NppDarkMode.h#L32
514+
515+
457516
#define VAR_NOT_RECOGNIZED 0
458517
#define FULL_CURRENT_PATH 1
459518
#define CURRENT_DIRECTORY 2
@@ -466,6 +525,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
466525
#define CURRENT_COLUMN 9
467526
#define NPP_FULL_FILE_PATH 10
468527
#define GETFILENAMEATCURSOR 11
528+
#define CURRENT_LINESTR 12
469529

470530
#define RUNCOMMAND_USER (WM_USER + 3000)
471531
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
@@ -476,6 +536,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
476536
#define NPPM_GETCURRENTWORD (RUNCOMMAND_USER + CURRENT_WORD)
477537
#define NPPM_GETNPPDIRECTORY (RUNCOMMAND_USER + NPP_DIRECTORY)
478538
#define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR)
539+
#define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR)
479540
// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str)
480541
// where str is the allocated TCHAR array,
481542
// strLen is the allocated array size
@@ -636,3 +697,9 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
636697
//scnNotification->nmhdr.code = NPPN_FILEDELETED;
637698
//scnNotification->nmhdr.hwndFrom = hwndNpp;
638699
//scnNotification->nmhdr.idFrom = BufferID;
700+
701+
#define NPPN_DARKMODECHANGED (NPPN_FIRST + 27) // To notify plugins that Dark Mode was enabled/disabled
702+
//scnNotification->nmhdr.code = NPPN_DARKMODECHANGED;
703+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
704+
//scnNotification->nmhdr.idFrom = 0;
705+

NppPlugin/include/NppDarkMode.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace NppDarkMode
4141
COLORREF disabledText = 0;
4242
COLORREF linkText = 0;
4343
COLORREF edge = 0;
44+
COLORREF hotEdge = 0;
4445
};
4546

4647
struct Options
@@ -103,15 +104,20 @@ namespace NppDarkMode
103104
COLORREF getLinkTextColor();
104105

105106
COLORREF getEdgeColor();
107+
COLORREF getHotEdgeColor();
106108

107109
HBRUSH getBackgroundBrush();
108110
HBRUSH getDarkerBackgroundBrush();
109111
HBRUSH getSofterBackgroundBrush();
110112
HBRUSH getHotBackgroundBrush();
111113
HBRUSH getErrorBackgroundBrush();
112114

115+
HBRUSH getEdgeBrush();
116+
HBRUSH getHotEdgeBrush();
117+
113118
HPEN getDarkerTextPen();
114119
HPEN getEdgePen();
120+
HPEN getHotEdgePen();
115121

116122
void setBackgroundColor(COLORREF c);
117123
void setSofterBackgroundColor(COLORREF c);
@@ -153,6 +159,8 @@ namespace NppDarkMode
153159
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
154160
void autoThemeChildControls(HWND hwndParent);
155161

162+
void autoSubclassAndThemeTabUpDownControl(HWND hwndParent, HWND hwndUpdown);
163+
156164
void setDarkTitleBar(HWND hwnd);
157165
void setDarkExplorerTheme(HWND hwnd);
158166
void setDarkScrollBar(HWND hwnd);
@@ -165,8 +173,12 @@ namespace NppDarkMode
165173
void setTreeViewStyle(HWND hwnd);
166174
void setBorder(HWND hwnd, bool border = true);
167175

176+
BOOL CALLBACK enumAutocompleteProc(HWND hwnd, LPARAM lParam);
177+
void setDarkAutoCompletion();
178+
168179
LRESULT onCtlColor(HDC hdc);
169180
LRESULT onCtlColorSofter(HDC hdc);
170181
LRESULT onCtlColorDarker(HDC hdc);
171182
LRESULT onCtlColorError(HDC hdc);
183+
LRESULT onCtlColorDarkerBGStaticText(HDC hdc, bool isTextEnabled);
172184
}

NppPlugin/include/SciLexer.h

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@
144144
#define SCLEX_DATAFLEX 129
145145
#define SCLEX_HOLLYWOOD 130
146146
#define SCLEX_RAKU 131
147+
#define SCLEX_FSHARP 132
148+
#define SCLEX_JULIA 133
149+
#define SCLEX_ASCIIDOC 134
150+
#define SCLEX_GDSCRIPT 135
147151
#define SCLEX_SEARCHRESULT 150
148152
#define SCLEX_OBJC 151
149153
#define SCLEX_USER 152
@@ -280,6 +284,7 @@
280284
#define SCE_P_FCHARACTER 17
281285
#define SCE_P_FTRIPLE 18
282286
#define SCE_P_FTRIPLEDOUBLE 19
287+
#define SCE_P_ATTRIBUTE 20
283288
#define SCE_C_DEFAULT 0
284289
#define SCE_C_COMMENT 1
285290
#define SCE_C_COMMENTLINE 2
@@ -889,7 +894,7 @@
889894
#define SCE_CSS_EXTENDED_IDENTIFIER 19
890895
#define SCE_CSS_EXTENDED_PSEUDOCLASS 20
891896
#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21
892-
#define SCE_CSS_MEDIA 22
897+
#define SCE_CSS_GROUP_RULE 22
893898
#define SCE_CSS_VARIABLE 23
894899
#define SCE_POV_DEFAULT 0
895900
#define SCE_POV_COMMENT 1
@@ -1057,6 +1062,28 @@
10571062
#define SCE_ERLANG_MODULES 23
10581063
#define SCE_ERLANG_MODULES_ATT 24
10591064
#define SCE_ERLANG_UNKNOWN 31
1065+
#define SCE_JULIA_DEFAULT 0
1066+
#define SCE_JULIA_COMMENT 1
1067+
#define SCE_JULIA_NUMBER 2
1068+
#define SCE_JULIA_KEYWORD1 3
1069+
#define SCE_JULIA_KEYWORD2 4
1070+
#define SCE_JULIA_KEYWORD3 5
1071+
#define SCE_JULIA_CHAR 6
1072+
#define SCE_JULIA_OPERATOR 7
1073+
#define SCE_JULIA_BRACKET 8
1074+
#define SCE_JULIA_IDENTIFIER 9
1075+
#define SCE_JULIA_STRING 10
1076+
#define SCE_JULIA_SYMBOL 11
1077+
#define SCE_JULIA_MACRO 12
1078+
#define SCE_JULIA_STRINGINTERP 13
1079+
#define SCE_JULIA_DOCSTRING 14
1080+
#define SCE_JULIA_STRINGLITERAL 15
1081+
#define SCE_JULIA_COMMAND 16
1082+
#define SCE_JULIA_COMMANDLITERAL 17
1083+
#define SCE_JULIA_TYPEANNOT 18
1084+
#define SCE_JULIA_LEXERROR 19
1085+
#define SCE_JULIA_KEYWORD4 20
1086+
#define SCE_JULIA_TYPEOPERATOR 21
10601087
#define SCE_MSSQL_DEFAULT 0
10611088
#define SCE_MSSQL_COMMENT 1
10621089
#define SCE_MSSQL_LINE_COMMENT 2
@@ -2084,6 +2111,66 @@
20842111
#define SCE_RAKU_CALLABLE 26
20852112
#define SCE_RAKU_GRAMMAR 27
20862113
#define SCE_RAKU_CLASS 28
2114+
#define SCE_FSHARP_DEFAULT 0
2115+
#define SCE_FSHARP_KEYWORD 1
2116+
#define SCE_FSHARP_KEYWORD2 2
2117+
#define SCE_FSHARP_KEYWORD3 3
2118+
#define SCE_FSHARP_KEYWORD4 4
2119+
#define SCE_FSHARP_KEYWORD5 5
2120+
#define SCE_FSHARP_IDENTIFIER 6
2121+
#define SCE_FSHARP_QUOT_IDENTIFIER 7
2122+
#define SCE_FSHARP_COMMENT 8
2123+
#define SCE_FSHARP_COMMENTLINE 9
2124+
#define SCE_FSHARP_PREPROCESSOR 10
2125+
#define SCE_FSHARP_LINENUM 11
2126+
#define SCE_FSHARP_OPERATOR 12
2127+
#define SCE_FSHARP_NUMBER 13
2128+
#define SCE_FSHARP_CHARACTER 14
2129+
#define SCE_FSHARP_STRING 15
2130+
#define SCE_FSHARP_VERBATIM 16
2131+
#define SCE_FSHARP_QUOTATION 17
2132+
#define SCE_FSHARP_ATTRIBUTE 18
2133+
#define SCE_FSHARP_FORMAT_SPEC 19
2134+
#define SCE_ASCIIDOC_DEFAULT 0
2135+
#define SCE_ASCIIDOC_STRONG1 1
2136+
#define SCE_ASCIIDOC_STRONG2 2
2137+
#define SCE_ASCIIDOC_EM1 3
2138+
#define SCE_ASCIIDOC_EM2 4
2139+
#define SCE_ASCIIDOC_HEADER1 5
2140+
#define SCE_ASCIIDOC_HEADER2 6
2141+
#define SCE_ASCIIDOC_HEADER3 7
2142+
#define SCE_ASCIIDOC_HEADER4 8
2143+
#define SCE_ASCIIDOC_HEADER5 9
2144+
#define SCE_ASCIIDOC_HEADER6 10
2145+
#define SCE_ASCIIDOC_ULIST_ITEM 11
2146+
#define SCE_ASCIIDOC_OLIST_ITEM 12
2147+
#define SCE_ASCIIDOC_BLOCKQUOTE 13
2148+
#define SCE_ASCIIDOC_LINK 14
2149+
#define SCE_ASCIIDOC_CODEBK 15
2150+
#define SCE_ASCIIDOC_PASSBK 16
2151+
#define SCE_ASCIIDOC_COMMENT 17
2152+
#define SCE_ASCIIDOC_COMMENTBK 18
2153+
#define SCE_ASCIIDOC_LITERAL 19
2154+
#define SCE_ASCIIDOC_LITERALBK 20
2155+
#define SCE_ASCIIDOC_ATTRIB 21
2156+
#define SCE_ASCIIDOC_ATTRIBVAL 22
2157+
#define SCE_ASCIIDOC_MACRO 23
2158+
#define SCE_GD_DEFAULT 0
2159+
#define SCE_GD_COMMENTLINE 1
2160+
#define SCE_GD_NUMBER 2
2161+
#define SCE_GD_STRING 3
2162+
#define SCE_GD_CHARACTER 4
2163+
#define SCE_GD_WORD 5
2164+
#define SCE_GD_TRIPLE 6
2165+
#define SCE_GD_TRIPLEDOUBLE 7
2166+
#define SCE_GD_CLASSNAME 8
2167+
#define SCE_GD_FUNCNAME 9
2168+
#define SCE_GD_OPERATOR 10
2169+
#define SCE_GD_IDENTIFIER 11
2170+
#define SCE_GD_COMMENTBLOCK 12
2171+
#define SCE_GD_STRINGEOL 13
2172+
#define SCE_GD_WORD2 14
2173+
#define SCE_GD_ANNOTATION 15
20872174
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
20882175

20892176
#endif

NppPlugin/include/Sci_Position.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
typedef ptrdiff_t Sci_Position;
1616

1717
// Unsigned variant used for ILexer::Lex and ILexer::Fold
18-
// Definitions of common types
1918
typedef size_t Sci_PositionU;
2019

21-
2220
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
2321
typedef intptr_t Sci_PositionCR;
2422

0 commit comments

Comments
 (0)