notepad-plus-plus/lexilla/lexlib/DefaultLexer.cxx
Christian Grasser e85c354135 Update to scintilla 5.5.7 & Lexilla 5.4.5
Release 5.5.7 (https://www.scintilla.org/scintilla557.zip)

Released 8 June 2025

1. Add SCI_SCROLLVERTICAL method to restore view position and maintain it while performing line wrapping.
2. Add SC_UNDO_SELECTION_HISTORY_SCROLL flag to SCI_SETUNDOSELECTIONHISTORY which controls whether undo and redo restore vertical scroll position.
3. Tweak SC_MARK_BAR to be slightly wider by using next higher whole pixel instead of next lower for margin width / 3.
4. Scale images in autocompletion lists with SCI_AUTOCSETIMAGESCALE to match high DPI screens. Initially only on GTK and Qt.
5. Fix wrapping bug for UTF-8 where \r\n could wrap between the characters. Notepad++ Pull Request #16373.
6. Fix crash during painting when scroll bars changed. Bug #2481.
7. On GTK, reset vertical scroll bar synchronously in SCI_SETDOCPOINTER to fix bug where scroll position not restored in non-wrap mode. Bug #2416.
8. On GTK, fix IME problem when tentative composition interfered with delete surrounding. Feature #1476.
9. On GTK, update IME cursor position inside retrieve surrounding to better position candidate window. Feature #1488.

Release 5.4.5 (https://www.scintilla.org/lexilla545.zip)

Released 8 June 2025

1. Dart: Add error state SCE_DART_STRINGEOL for unterminated string. Pull request #315.
2. Makefile: Add a keyword list to makefile lexer to highlight GNU Make directives like 'ifdef' and 'vpath' as SCE_MAKE_PREPROCESSOR since these are similar to NMAKE directives like '!IFDEF'.
3. Nix: Add error state SCE_NIX_STRINGEOL for unterminated string. Pull request #315.
4. TOML: Add error state SCE_TOML_STRINGEOL for unterminated string. Pull request #315.
5. Zig: Add error state SCE_ZIG_STRINGEOL for unterminated string. Pull request #315.

Close #16649
2025-06-13 15:12:33 +02:00

145 lines
3.2 KiB
C++

// Scintilla source code edit control
/** @file DefaultLexer.cxx
** A lexer base class that provides reasonable default behaviour.
**/
// Copyright 2017 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <string>
#include <string_view>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "LexerModule.h"
#include "DefaultLexer.h"
using namespace Lexilla;
static const char styleSubable[] = { 0 };
DefaultLexer::DefaultLexer(const char *languageName_, int language_,
const LexicalClass *lexClasses_, size_t nClasses_) :
languageName(languageName_),
language(language_),
lexClasses(lexClasses_),
nClasses(nClasses_) {
}
DefaultLexer::~DefaultLexer() = default;
void SCI_METHOD DefaultLexer::Release() {
delete this;
}
int SCI_METHOD DefaultLexer::Version() const {
return Scintilla::lvRelease5;
}
const char * SCI_METHOD DefaultLexer::PropertyNames() {
return "";
}
int SCI_METHOD DefaultLexer::PropertyType(const char *) {
return SC_TYPE_BOOLEAN;
}
const char * SCI_METHOD DefaultLexer::DescribeProperty(const char *) {
return "";
}
Sci_Position SCI_METHOD DefaultLexer::PropertySet(const char *, const char *) {
return -1;
}
const char * SCI_METHOD DefaultLexer::DescribeWordListSets() {
return "";
}
Sci_Position SCI_METHOD DefaultLexer::WordListSet(int, const char *) {
return -1;
}
void SCI_METHOD DefaultLexer::Fold(Sci_PositionU, Sci_Position, int, Scintilla::IDocument *) {
}
void * SCI_METHOD DefaultLexer::PrivateCall(int, void *) {
return nullptr;
}
int SCI_METHOD DefaultLexer::LineEndTypesSupported() {
return SC_LINE_END_TYPE_DEFAULT;
}
int SCI_METHOD DefaultLexer::AllocateSubStyles(int, int) {
return -1;
}
int SCI_METHOD DefaultLexer::SubStylesStart(int) {
return -1;
}
int SCI_METHOD DefaultLexer::SubStylesLength(int) {
return 0;
}
int SCI_METHOD DefaultLexer::StyleFromSubStyle(int subStyle) {
return subStyle;
}
int SCI_METHOD DefaultLexer::PrimaryStyleFromStyle(int style) {
return style;
}
void SCI_METHOD DefaultLexer::FreeSubStyles() {
}
void SCI_METHOD DefaultLexer::SetIdentifiers(int, const char *) {
}
int SCI_METHOD DefaultLexer::DistanceToSecondaryStyles() {
return 0;
}
const char * SCI_METHOD DefaultLexer::GetSubStyleBases() {
return styleSubable;
}
int SCI_METHOD DefaultLexer::NamedStyles() {
return static_cast<int>(nClasses);
}
const char * SCI_METHOD DefaultLexer::NameOfStyle(int style) {
return (style < NamedStyles()) ? lexClasses[style].name : "";
}
const char * SCI_METHOD DefaultLexer::TagsOfStyle(int style) {
return (style < NamedStyles()) ? lexClasses[style].tags : "";
}
const char * SCI_METHOD DefaultLexer::DescriptionOfStyle(int style) {
return (style < NamedStyles()) ? lexClasses[style].description : "";
}
// ILexer5 methods
const char * SCI_METHOD DefaultLexer::GetName() {
return languageName;
}
int SCI_METHOD DefaultLexer::GetIdentifier() {
return language;
}
const char *SCI_METHOD DefaultLexer::PropertyGet(const char * /* key */) {
return nullptr;
}