70ScintillaBase::ScintillaBase() {
216 switch (plbe->
event) {
234 for (
size_t r=0; r<
sel.
Count(); r++) {
239 if (positionInsert - removeLen >= 0) {
240 positionInsert -= removeLen;
244 if (lengthInserted > 0) {
279 if (rcPopupBounds.
Height() == 0)
280 rcPopupBounds = rcClient;
284 if (pt.
x >= rcClient.
right - widthLB) {
293 rcac.
left = pt.
x -
ac.
lb->CaretFromEdge();
294 if (pt.
y >= rcPopupBounds.
bottom - heightLB &&
295 pt.
y >= (rcPopupBounds.
bottom + rcPopupBounds.
top) / 2) {
296 rcac.
top = pt.
y - heightLB;
297 if (rcac.
top < rcPopupBounds.
top) {
298 heightLB -=
static_cast<int>(rcPopupBounds.
top - rcac.
top);
299 rcac.
top = rcPopupBounds.
top;
305 rcac.
bottom =
static_cast<XYPOSITION>(std::min(
static_cast<int>(rcac.
top) + heightLB,
static_cast<int>(rcPopupBounds.
bottom)));
306 ac.
lb->SetPositionRelative(rcac, &
wMain);
309 ac.
lb->SetAverageCharWidth(aveCharWidth);
310 ac.
lb->SetDelegate(
this);
316 const int heightAlloced =
static_cast<int>(rcList.
bottom - rcList.
top);
319 widthLB = std::min(widthLB,
static_cast<int>(aveCharWidth)*
maxListWidth);
321 rcList.
left = pt.
x -
ac.
lb->CaretFromEdge();
325 rcList.
top = pt.
y - heightAlloced;
329 rcList.
bottom = rcList.
top + heightAlloced;
330 ac.
lb->SetPositionRelative(rcList, &
wMain);
332 if (lenEntered != 0) {
434 if (endPos < firstPos)
457 return static_cast<int>(
selected.length());
559 int interfaceVersion;
565 LexState(
const LexState &) =
delete;
566 LexState(LexState &&) =
delete;
567 LexState &operator=(
const LexState &) =
delete;
568 LexState &operator=(LexState &&) =
delete;
569 ~LexState()
override;
570 void SetLexer(
uptr_t wParam);
571 void SetLexerLanguage(
const char *languageName);
572 const char *DescribeWordListSets();
573 void SetWordList(
int n,
const char *wl);
574 const char *GetName()
const;
575 void *PrivateCall(
int operation,
void *pointer);
576 const char *PropertyNames();
577 int PropertyType(
const char *
name);
578 const char *DescribeProperty(
const char *
name);
579 void PropSet(
const char *key,
const char *val);
580 const char *PropGet(
const char *key)
const;
581 int PropGetInt(
const char *key,
int defaultValue=0)
const;
582 size_t PropGetExpanded(
const char *key,
char *result)
const;
584 int LineEndTypesSupported()
override;
585 int AllocateSubStyles(
int styleBase,
int numberStyles);
586 int SubStylesStart(
int styleBase);
587 int SubStylesLength(
int styleBase);
588 int StyleFromSubStyle(
int subStyle);
589 int PrimaryStyleFromStyle(
int style);
590 void FreeSubStyles();
591 void SetIdentifiers(
int style,
const char *identifiers);
592 int DistanceToSecondaryStyles();
593 const char *GetSubStyleBases();
595 const char *NameOfStyle(
int style);
596 const char *TagsOfStyle(
int style);
597 const char *DescriptionOfStyle(
int style);
603 lexCurrent =
nullptr;
604 performingStyle =
false;
609LexState::~LexState() {
616LexState *ScintillaBase::DocumentLexState() {
624 if (
lex != lexCurrent) {
632 instance = lexCurrent->Create();
633 interfaceVersion = instance->Version();
635 pdoc->LexerChanged();
639void LexState::SetLexer(
uptr_t wParam) {
640 lexLanguage =
static_cast<int>(wParam);
642 SetLexerModule(
nullptr);
651void LexState::SetLexerLanguage(
const char *languageName) {
656 lexLanguage =
lex->GetLanguage();
660const char *LexState::DescribeWordListSets() {
662 return instance->DescribeWordListSets();
668void LexState::SetWordList(
int n,
const char *wl) {
670 const Sci_Position firstModification = instance->WordListSet(n, wl);
671 if (firstModification >= 0) {
672 pdoc->ModifiedAt(firstModification);
677const char *LexState::GetName()
const {
679 return lexCurrent->languageName;
689void *LexState::PrivateCall(
int operation,
void *pointer) {
690 if (pdoc && instance) {
697const char *LexState::PropertyNames() {
699 return instance->PropertyNames();
705int LexState::PropertyType(
const char *
name) {
707 return instance->PropertyType(
name);
713const char *LexState::DescribeProperty(
const char *
name) {
715 return instance->DescribeProperty(
name);
721void LexState::PropSet(
const char *key,
const char *val) {
722 props.Set(key, val, strlen(key), strlen(val));
724 const Sci_Position firstModification = instance->PropertySet(key, val);
725 if (firstModification >= 0) {
726 pdoc->ModifiedAt(firstModification);
731const char *LexState::PropGet(
const char *key)
const {
732 return props.Get(key);
735int LexState::PropGetInt(
const char *key,
int defaultValue)
const {
736 return props.GetInt(key, defaultValue);
739size_t LexState::PropGetExpanded(
const char *key,
char *result)
const {
740 return props.GetExpanded(key, result);
743int LexState::LineEndTypesSupported() {
744 if (instance && (interfaceVersion >=
lvSubStyles)) {
750int LexState::AllocateSubStyles(
int styleBase,
int numberStyles) {
751 if (instance && (interfaceVersion >=
lvSubStyles)) {
752 return static_cast<ILexerWithSubStyles *
>(instance)->AllocateSubStyles(styleBase, numberStyles);
757int LexState::SubStylesStart(
int styleBase) {
758 if (instance && (interfaceVersion >=
lvSubStyles)) {
764int LexState::SubStylesLength(
int styleBase) {
765 if (instance && (interfaceVersion >=
lvSubStyles)) {
771int LexState::StyleFromSubStyle(
int subStyle) {
772 if (instance && (interfaceVersion >=
lvSubStyles)) {
778int LexState::PrimaryStyleFromStyle(
int style) {
779 if (instance && (interfaceVersion >=
lvSubStyles)) {
785void LexState::FreeSubStyles() {
786 if (instance && (interfaceVersion >=
lvSubStyles)) {
791void LexState::SetIdentifiers(
int style,
const char *identifiers) {
792 if (instance && (interfaceVersion >=
lvSubStyles)) {
798int LexState::DistanceToSecondaryStyles() {
799 if (instance && (interfaceVersion >=
lvSubStyles)) {
805const char *LexState::GetSubStyleBases() {
806 if (instance && (interfaceVersion >=
lvSubStyles)) {
812int LexState::NamedStyles() {
813 if (instance && (interfaceVersion >=
lvMetaData)) {
820const char *LexState::NameOfStyle(
int style) {
821 if (instance && (interfaceVersion >=
lvMetaData)) {
828const char *LexState::TagsOfStyle(
int style) {
829 if (instance && (interfaceVersion >=
lvMetaData)) {
836const char *LexState::DescriptionOfStyle(
int style) {
837 if (instance && (interfaceVersion >=
lvMetaData)) {
853 DocumentLexState()->Colourise(endStyled, endStyleNeeded);
955 listType =
static_cast<int>(wParam);
974 ac.
lb->SetVisibleRows(
static_cast<int>(wParam));
978 return ac.
lb->GetVisibleRows();
997 ac.
lb->ClearRegisteredImages();
1063 DocumentLexState()->SetLexer(
static_cast<int>(wParam));
1067 return DocumentLexState()->lexLanguage;
1074 DocumentLexState()->Colourise(
static_cast<Sci::Position>(wParam), lParam);
1103 return StringResult(lParam, DocumentLexState()->GetName());
1110 return reinterpret_cast<sptr_t>(
1111 DocumentLexState()->PrivateCall(
static_cast<int>(wParam),
reinterpret_cast<void *
>(lParam)));
1113#ifdef INCLUDE_DEPRECATED_FEATURES
1114 case SCI_GETSTYLEBITSNEEDED:
1119 return StringResult(lParam, DocumentLexState()->PropertyNames());
1129 return StringResult(lParam, DocumentLexState()->DescribeWordListSets());
1132 return DocumentLexState()->LineEndTypesSupported();
1135 return DocumentLexState()->AllocateSubStyles(
static_cast<int>(wParam),
static_cast<int>(lParam));
1138 return DocumentLexState()->SubStylesStart(
static_cast<int>(wParam));
1141 return DocumentLexState()->SubStylesLength(
static_cast<int>(wParam));
1144 return DocumentLexState()->StyleFromSubStyle(
static_cast<int>(wParam));
1147 return DocumentLexState()->PrimaryStyleFromStyle(
static_cast<int>(wParam));
1150 DocumentLexState()->FreeSubStyles();
1154 DocumentLexState()->SetIdentifiers(
static_cast<int>(wParam),
1159 return DocumentLexState()->DistanceToSecondaryStyles();
1162 return StringResult(lParam, DocumentLexState()->GetSubStyleBases());
1165 return DocumentLexState()->NamedStyles();
1169 NameOfStyle(
static_cast<int>(wParam)));
1173 TagsOfStyle(
static_cast<int>(wParam)));
1177 DescriptionOfStyle(
static_cast<int>(wParam)));
Defines the auto completion list box.
Interface to the call tip control.
Classes for case folding.
Manages the text of the document.
Character classifications used by Document and RESearch.
Returns the Unicode general category of a character.
Manages visibility of lines for folding and wrapping.
Visual elements added over text.
Text document that handles notifications, DBCS, styling, words and end of line.
Defines the editor state that must be visible to EditorView.
Defines the appearance of the main text area of the editor window.
Defines the main editor class.
Support external lexers in DLLs or shared libraries.
Interface between Scintilla and lexers.
Interface for loading into a Scintilla document from a background thread.
Defines the style of indicators which are text decorations such as underlining.
Defines a mapping between keystrokes and commands.
Colourise for particular languages.
Defines the look of a line marker in the margin .
Defines the appearance of the editor margin.
Data structure used to partition an interval.
Classes for caching layout information.
Defines global type name Position in the Sci internal namespace.
A basic string to string map.
Data structure used to store sparse styles.
Interface to the added lexer functions in the SciLexer version of the edit control.
Defines an enhanced subclass of Editor with calltips, autocomplete and context menu.
Interface to the edit control.
#define SCI_DESCRIPTIONOFSTYLE
#define SCI_AUTOCPOSSTART
#define SCI_AUTOCSETSEPARATOR
#define SCI_FREESUBSTYLES
#define SCI_AUTOCSETAUTOHIDE
#define SCI_AUTOCGETMAXWIDTH
#define SCI_ALLOCATESUBSTYLES
#define SCI_GETSUBSTYLESSTART
#define SCI_CALLTIPSETHLT
#define SCI_CALLTIPSETFOREHLT
#define SCI_DESCRIBEKEYWORDSETS
#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
#define SCI_AUTOCGETCURRENTTEXT
#define SCI_CALLTIPPOSSTART
#define SC_AC_DOUBLECLICK
#define SCN_AUTOCCOMPLETED
#define SCI_GETLEXERLANGUAGE
#define SCI_GETSTYLEFROMSUBSTYLE
#define SCI_AUTOCGETTYPESEPARATOR
#define SCN_AUTOCCANCELLED
#define SCI_EDITTOGGLEOVERTYPE
#define SCI_AUTOCGETMULTI
#define SCI_CALLTIPCANCEL
#define SCI_GETNAMEDSTYLES
#define SCI_GETPROPERTYINT
#define SCI_DELETEBACKNOTLINE
#define SCI_AUTOCSETMAXWIDTH
#define SCI_CALLTIPACTIVE
#define SCI_DISTANCETOSECONDARYSTYLES
#define SCN_AUTOCSELECTION
#define SCI_GETPROPERTYEXPANDED
#define SCI_SETLEXERLANGUAGE
#define SC_MULTIAUTOC_ONCE
#define SCI_AUTOCSETMAXHEIGHT
#define SCI_AUTOCGETIGNORECASE
#define SCI_REGISTERRGBAIMAGE
#define SCI_AUTOCSETTYPESEPARATOR
#define SCI_AUTOCSETORDER
#define SCI_CALLTIPSETBACK
int Scintilla_LinkLexers(void)
#define SCI_GETLINEENDTYPESSUPPORTED
#define SCI_AUTOCSETCANCELATSTART
#define SCI_CALLTIPSETPOSSTART
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR
#define SCI_CALLTIPSETPOSITION
#define SCI_GETSUBSTYLESLENGTH
#define SCN_USERLISTSELECTION
#define SCI_SETIDENTIFIERS
#define SCI_AUTOCSETCHOOSESINGLE
#define SCI_CHARRIGHTEXTEND
#define SCN_AUTOCSELECTIONCHANGE
#define SCI_AUTOCGETCHOOSESINGLE
#define SCI_LOADLEXERLIBRARY
#define SCN_AUTOCCHARDELETED
#define SCI_DESCRIBEPROPERTY
#define SCI_AUTOCGETCURRENT
#define SCI_REGISTERIMAGE
#define SCI_PROPERTYNAMES
#define SCI_PRIVATELEXERCALL
#define SCI_AUTOCGETCANCELATSTART
#define SCI_AUTOCSETIGNORECASE
#define SCI_AUTOCSETDROPRESTOFWORD
#define SCI_GETSUBSTYLEBASES
#define SCI_AUTOCGETAUTOHIDE
#define SCI_AUTOCGETDROPRESTOFWORD
#define SCI_GETPRIMARYSTYLEFROMSTYLE
#define SCI_CALLTIPUSESTYLE
#define SCI_CHARLEFTEXTEND
#define SCI_AUTOCSETMULTI
#define SCI_AUTOCGETORDER
#define SCI_CLEARREGISTEREDIMAGES
#define SCI_AUTOCGETSEPARATOR
#define SCI_AUTOCSETFILLUPS
#define SCI_AUTOCCOMPLETE
#define SCI_AUTOCGETMAXHEIGHT
#define SCI_CALLTIPSETFORE
Classes maintaining the selection.
Main data structure for holding arrays that handle insertions and deletions efficiently.
Defines the font and colour style for a class of text.
Define UniqueString, a unique_ptr based string type for storage in containers and an allocator for Un...
Store information on how the document is to be viewed.
bool IsFillUpChar(char ch) const noexcept
bool IsStopChar(char ch) const noexcept
int GetSelection() const
Return the position of the currently selected list item.
char GetSeparator() const noexcept
char GetTypesep() const noexcept
void SetTypesep(char separator_)
The typesep character is used for separating the word from the type.
bool Active() const noexcept
Is the auto completion list displayed?
void SetFillUpChars(const char *fillUpChars_)
The fillup chars are characters which, when typed, fill up the selected word.
int autoSort
SC_ORDER_PRESORTED: Assume the list is presorted; selection will fail if it is not alphabetical SC_O...
void Start(Window &parent, int ctrlID, Sci::Position position, Point location, Sci::Position startLen_, int lineHeight, bool unicodeMode, int technology)
Display the auto completion list positioned to be near a character position.
std::unique_ptr< ListBox > lb
std::string GetValue(int item) const
Return the value of an item in the list.
void SetSeparator(char separator_)
The separator character is used when interpreting the list in SetList.
void Select(const char *word)
Select a list element that starts with word as the current element.
void Move(int delta)
Move the current list element by delta, scrolling appropriately.
void SetList(const char *list)
The list string contains a sequence of words separated by the separator character.
bool cancelAtStartPos
Should autocompletion be cancelled if editor's currentPos <= startPos?
void SetStopChars(const char *stopChars_)
The stop chars are characters which, when typed, cause the auto completion list to disappear.
unsigned int ignoreCaseBehaviour
Sci::Position posStartCallTip
bool UseStyleCallTip() const noexcept
Used to determine which STYLE_xxxx to use for call tip information.
void SetPosition(bool aboveText) noexcept
Set calltip position.
PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, const char *faceName, int size, int codePage_, int characterSet, int technology, const Window &wParent)
Setup the calltip and return a rectangle of the area required.
void SetForeBack(const ColourDesired &fore, const ColourDesired &back) noexcept
void SetTabSize(int tabSz) noexcept
Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
ColourDesired colourUnSel
void SetHighlight(size_t start, size_t end)
Set a range of characters to be displayed in a highlight style.
static const LexerModule * Find(int language)
bool DeleteChars(Sci::Position pos, Sci::Position len)
Sci::Line SciLineFromPosition(Sci::Position pos) const noexcept
Sci_Position SCI_METHOD Length() const override
Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const
Used by commands that want to select whole words.
bool CanUndo() const noexcept
Sci::Position InsertString(Sci::Position position, const char *s, Sci::Position insertLength)
Insert a string with a length.
void SetLexInterface(std::unique_ptr< LexInterface > pLexInterface) noexcept
Sci::Position GetEndStyled() const noexcept
LexInterface * GetLexInterface() const noexcept
bool CanRedo() const noexcept
void ModifiedAt(Sci::Position pos) noexcept
Sci_Position SCI_METHOD LineStart(Sci_Position line) const override
int xOffset
Horizontal scrolled amount in pixels.
virtual void NotifyParent(SCNotification scn)=0
bool IsUnicodeMode() const noexcept
static const char * ConstCharPtrFromSPtr(sptr_t lParam) noexcept
static sptr_t StringResult(sptr_t lParam, const char *val) noexcept
bool PointInSelMargin(Point pt) const
virtual int KeyCommand(unsigned int iMessage)
void DelCharBack(bool allowLineStartDeletion)
Point LocationFromPosition(SelectionPosition pos, PointEnd pe=peDefault)
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
Point GetVisibleOriginInMain() const override
void SetEmptySelection(SelectionPosition currentPos_)
void InvalidateStyleRedraw()
virtual PRectangle GetClientRectangle() const
static const char * ConstCharPtrFromUPtr(uptr_t wParam) noexcept
void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true)
virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers)
std::string RangeText(Sci::Position start, Sci::Position end) const
static const unsigned char * ConstUCharPtrFromSPtr(sptr_t lParam) noexcept
virtual void InsertCharacter(const char *s, unsigned int len, CharacterSource charSource)
int CodePage() const noexcept
void SetLastXChosen()
Choose the x position that the caret will try to stick to as it moves up and down.
virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded)
void HorizontalScrollTo(int xPos)
Sci::Position RealizeVirtualSpace(Sci::Position position, Sci::Position virtualSpace)
Window wMain
On GTK+, Scintilla is a container widget holding two scroll bars whereas on Windows there is just one...
bool RangeContainsProtected(Sci::Position start, Sci::Position end) const noexcept
static char * CharPtrFromSPtr(sptr_t lParam) noexcept
Window wMargin
May be separate when using a scroll view for wMain.
virtual void CancelModes()
virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers)
virtual void * PrivateCall(int operation, void *pointer)=0
A LexerModule is responsible for lexing and folding a particular language.
A geometric rectangle class.
constexpr XYPOSITION Height() const noexcept
void ListNotify(ListBoxEvent *plbe) override
void CancelModes() override
void AutoCompleteStart(Sci::Position lenEntered, const char *list)
void AutoCompleteCompleted(char ch, unsigned int completionMethod)
void AutoCompleteMoveToCurrentWord()
void CallTipShow(Point pt, const char *defn)
void AutoCompleteSelection()
int AutoCompleteGetCurrentText(char *buffer) const
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override
void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override
void AutoCompleteMove(int delta)
void ContextMenu(Point pt)
void AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen)
bool ShouldDisplayPopup(Point ptInWindowCoordinates) const
int multiAutoCMode
Maximum width of list, in average character widths.
int AutoCompleteGetCurrent() const
void AutoCompleteCharacterDeleted()
virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true)=0
void AutoCompleteCancel()
void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override
int KeyCommand(unsigned int iMessage) override
virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false)
virtual void CreateCallTipWindow(PRectangle rc)=0
void InsertCharacter(const char *s, unsigned int len, CharacterSource charSource) override
void AutoCompleteCharacterAdded(char ch)
~ScintillaBase() override
void NotifyLexerChanged(Document *doc, void *userData) override
int listType
0 is an autocomplete list
void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override
Sci::Position Position() const noexcept
Sci::Position VirtualSpace() const noexcept
void SetPosition(Sci::Position position_) noexcept
size_t Count() const noexcept
SelectionRange & Range(size_t r) noexcept
bool Empty() const noexcept
Sci::Position MainCaret() const noexcept
std::vector< Style > styles
void EnsureStyle(size_t index)
PRectangle GetMonitorRect(Point pt)
bool Created() const noexcept
void SetPositionRelative(PRectangle rc, const Window *relativeTo)
void Show(bool show=true)
#define selected(var, feature)
static objcKeyword lex(lexingState *st)
Styling buffer using one element for each run rather than using a filled buffer.
void ExternalLexerLoad(const char *path)
enum Scintilla::ListBoxEvent::EventType event
void ClearVirtualSpace() noexcept
SelectionPosition Start() const noexcept
SelectionPosition End() const noexcept