diff --git a/scintilla/CONTRIBUTING b/scintilla/CONTRIBUTING new file mode 100644 index 00000000..bce3f471 --- /dev/null +++ b/scintilla/CONTRIBUTING @@ -0,0 +1,20 @@ +Fixes should be posted to the Bug Tracker +http://sourceforge.net/p/scintilla/bugs/ + +Features should be posted to the Feature Request Tracker +http://sourceforge.net/p/scintilla/feature-requests/ + +Either send unified diffs (or patch files) or zip archives with whole files. +Mercurial patch files are best as they include author information and commit +messages. + +Questions should go to the scintilla-interest mailing list +https://groups.google.com/forum/#!forum/scintilla-interest + +Code should follow the guidelines at +http://www.scintilla.org/SciCoding.html + +Do not use SourceForge's Merge Request mechanism or message sending +feature as no one is monitoring these. +The neilh @ scintilla.org account receives much spam and is only checked +occasionally. Almost all Scintilla mail should go to the mailing list. \ No newline at end of file diff --git a/scintilla/License.txt b/scintilla/License.txt index 8d286121..8dba772f 100644 --- a/scintilla/License.txt +++ b/scintilla/License.txt @@ -2,19 +2,19 @@ License for Scintilla and SciTE Copyright 1998-2003 by Neil Hodgson -All Rights Reserved +All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. -NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY -SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE -OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/scintilla/README b/scintilla/README index 3fe033e7..24b6f403 100644 --- a/scintilla/README +++ b/scintilla/README @@ -6,9 +6,11 @@ To build SciTE, Scintilla must first be built. *** GTK+/Linux version *** -You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed. -GTK+ 1.x will not work. +You must first have GTK+ 2.24 or later and GCC (7.1 or better) installed. +Clang may be used by adding CLANG=1 to the make command line. Other C++ compilers may work but may require tweaking the make file. +Either GTK+ 2.x or 3.x may be used with 2.x the default and 3.x +chosen with the make argument GTK3=1. To build Scintilla, use the makefile located in the scintilla/gtk directory cd scintilla/gtk @@ -18,7 +20,7 @@ To build Scintilla, use the makefile located in the scintilla/gtk directory To build and install SciTE, use the makefile located in the scite/gtk directory cd scite/gtk make - make install + sudo make install This installs SciTE into $prefix/bin. The value of $prefix is determined from the location of Gnome if it is installed. This is usually /usr if installed @@ -30,7 +32,7 @@ properties file is installed at $prefix/share/scite/SciTEGlobal.properties. The language specific properties files are also installed into this directory. To remove SciTE - make uninstall + sudo make uninstall To clean the object files which may be needed to change $prefix make clean @@ -40,28 +42,44 @@ The current make file only supports static linking between SciTE and Scintilla. *** Windows version *** -A C++ compiler is required. Visual Studio 2010 is the development system -used for most development although TDM Mingw32 4.7.1 is also supported. +A C++ 17 compiler is required. +Visual Studio 2017 is the development system used for most development +although Mingw-w64 7.1 is also supported. To build Scintilla, make in the scintilla/win32 directory cd scintilla\win32 GCC: mingw32-make -VS .NET: nmake -f scintilla.mak +Visual C++: nmake -f scintilla.mak cd ..\.. To build SciTE, use the makefiles located in the scite/win32 directory cd scite\win32 GCC: mingw32-make -VS .NET: nmake -f scite.mak +Visual C++: nmake -f scite.mak An executable SciTE will now be in scite/bin. *** GTK+/Windows version *** -Mingw32 is known to work. Other compilers will probably not work. +Mingw-w64 is known to work. Other compilers will probably not work. Only Scintilla will build with GTK+ on Windows. SciTE will not work. To build Scintilla, make in the scintilla/gtk directory cd scintilla\gtk mingw32-make + +*** macOS Cocoa version *** + +Xcode 9.2 or later may be used to build Scintilla on macOS. + +There is no open source version of SciTE for macOS but there is a commercial +version available through the App Store. + +To build Scintilla, run xcodebuild in the scintilla/cocoa/ScintillaFramework directory + cd cocoa/ScintillaFramework + xcodebuild + +*** Qt version *** + +See the qt/README file to build Scintilla with Qt. diff --git a/scintilla/bin/libscintilla.lib b/scintilla/bin/libscintilla.lib new file mode 100644 index 00000000..91d5363c Binary files /dev/null and b/scintilla/bin/libscintilla.lib differ diff --git a/scintilla/boostregex/AnsiDocumentIterator.h b/scintilla/boostregex/AnsiDocumentIterator.h index b4e0e368..949b3fc6 100644 --- a/scintilla/boostregex/AnsiDocumentIterator.h +++ b/scintilla/boostregex/AnsiDocumentIterator.h @@ -1,9 +1,7 @@ #ifndef ANSIDOCUMENTITERATOR_H_12481491281240 #define ANSIDOCUMENTITERATOR_H_12481491281240 -#ifdef SCI_NAMESPACE namespace Scintilla { -#endif class AnsiDocumentIterator : public std::iterator { @@ -94,9 +92,6 @@ private: int m_end; Document* m_doc; }; - -#ifdef SCI_NAMESPACE } -#endif #endif \ No newline at end of file diff --git a/scintilla/boostregex/BoostRegExSearch.cxx b/scintilla/boostregex/BoostRegExSearch.cxx index b2cf275e..c536f816 100644 --- a/scintilla/boostregex/BoostRegExSearch.cxx +++ b/scintilla/boostregex/BoostRegExSearch.cxx @@ -4,17 +4,26 @@ * Converted from boost::xpressive to boost::regex and performance improvements * (principally caching the compiled regex), and support for UTF8 encoded text * (c) 2012 Dave Brotherstone - Changes for boost::regex - * (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search. + * (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search + * (c) 2019 Don Ho - Adapt for upgrading Scitilla (to version 4.1.4) and boost (to version 1.70) * */ + #include #include #include -#include "scintilla.h" + +#include "Scintilla.h" #include "Platform.h" +#include "ILoader.h" +#include "ILexer.h" +#include "Position.h" +#include "UniqueString.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" +#include "ContractionState.h" + #include "CellBuffer.h" #include "CharClassify.h" #include "Decoration.h" @@ -29,12 +38,9 @@ #define CP_UTF8 65001 #define SC_CP_UTF8 65001 +#define _SILENCE_ALL_CXX17_DEPRECATION_WARNI - -#ifdef SCI_NAMESPACE using namespace Scintilla; -#endif - using namespace boost; class BoostRegexSearch : public RegexSearchBase @@ -48,7 +54,7 @@ public: _substituted = NULL; } - virtual long FindText(Document* doc, int startPosition, int endPosition, const char *regex, + virtual Sci::Position FindText(Document* doc, Sci::Position minPos, Sci::Position maxPos, const char *regex, bool caseSensitive, bool word, bool wordStart, int sciSearchFlags, int *lengthRet); virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length); @@ -139,7 +145,7 @@ private: } } - virtual void NotifyDeleted(Document* deletedDocument, void* /*userData*/) + virtual void NotifyDeleted(Document* deletedDocument, void* /*userData*/) noexcept { if (deletedDocument == _document) { @@ -236,28 +242,22 @@ private: int _lastDirection; }; -#ifdef SCI_NAMESPACE namespace Scintilla { -#endif - #ifdef SCI_OWNREGEX RegexSearchBase *CreateRegexSearch(CharClassify* /* charClassTable */) { return new BoostRegexSearch(); } #endif - -#ifdef SCI_NAMESPACE } -#endif /** * Find text in document, supporting both forward and backward * searches (just pass startPosition > endPosition to do a backward search). */ -long BoostRegexSearch::FindText(Document* doc, int startPosition, int endPosition, const char *regexString, +Sci::Position BoostRegexSearch::FindText(Document* doc, Sci::Position startPosition, Sci::Position endPosition, const char *regexString, bool caseSensitive, bool /*word*/, bool /*wordStart*/, int sciSearchFlags, int *lengthRet) { try { @@ -453,19 +453,21 @@ char *BoostRegexSearch::EncodingDependent::SubstituteB wchar_t *BoostRegexSearch::utf8ToWchar(const char *utf8) { size_t utf8Size = strlen(utf8); - size_t wcharSize = UTF16Length(utf8, utf8Size); + std::string s(utf8, utf8Size); + size_t wcharSize = UTF16Length(s); wchar_t *w = new wchar_t[wcharSize + 1]; - UTF16FromUTF8(utf8, utf8Size, w, wcharSize + 1); + UTF16FromUTF8(s, w, wcharSize + 1); w[wcharSize] = 0; return w; } char *BoostRegexSearch::wcharToUtf8(const wchar_t *w) { - int wcharSize = static_cast(wcslen(w)); - int charSize = UTF8Length(w, wcharSize); + //int wcharSize = static_cast(wcslen(w)); + std::wstring ws(w); + int charSize = UTF8Length(ws); char *c = new char[charSize + 1]; - UTF8FromUTF16(w, wcharSize, c, charSize); + UTF8FromUTF16(ws, c, charSize); c[charSize] = 0; return c; } diff --git a/scintilla/boostregex/UTF8DocumentIterator.cxx b/scintilla/boostregex/UTF8DocumentIterator.cxx index ab995314..72c43c30 100644 --- a/scintilla/boostregex/UTF8DocumentIterator.cxx +++ b/scintilla/boostregex/UTF8DocumentIterator.cxx @@ -1,8 +1,84 @@ #include "UTF8DocumentIterator.h" -#ifdef SCI_NAMESPACE + + +#include "ILoader.h" +#include "ILexer.h" +#include "Scintilla.h" + + + +#include "CharacterCategory.h" +#include "Position.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "CellBuffer.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" + using namespace Scintilla; -#endif + +UTF8DocumentIterator::UTF8DocumentIterator(Document* doc, int pos, int end) : + m_doc(doc), + m_pos(pos), + m_end(end), + m_characterIndex(0) +{ + // Check for debug builds + PLATFORM_ASSERT(m_pos <= m_end); + + // Ensure for release. + if (m_pos > m_end) + { + m_pos = m_end; + } + readCharacter(); +} + +UTF8DocumentIterator::UTF8DocumentIterator(const UTF8DocumentIterator& copy) : + m_doc(copy.m_doc), + m_pos(copy.m_pos), + m_end(copy.m_end), + m_characterIndex(copy.m_characterIndex), + m_utf8Length(copy.m_utf8Length), + m_utf16Length(copy.m_utf16Length) +{ + // Check for debug builds + PLATFORM_ASSERT(m_pos <= m_end); + m_character[0] = copy.m_character[0]; + m_character[1] = copy.m_character[1]; + + // Ensure for release. + if (m_pos > m_end) + { + m_pos = m_end; + } +} + +UTF8DocumentIterator& UTF8DocumentIterator::operator -- () +{ + if (m_utf16Length == 2 && m_characterIndex == 1) + { + m_characterIndex = 0; + } + else + { + --m_pos; + // Skip past the UTF-8 extension bytes + while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0) + --m_pos; + + readCharacter(); + if (m_utf16Length == 2) + { + m_characterIndex = 1; + } + } + return *this; +} void UTF8DocumentIterator::readCharacter() { diff --git a/scintilla/boostregex/UTF8DocumentIterator.h b/scintilla/boostregex/UTF8DocumentIterator.h index b41fa4a7..d5d17c19 100644 --- a/scintilla/boostregex/UTF8DocumentIterator.h +++ b/scintilla/boostregex/UTF8DocumentIterator.h @@ -5,21 +5,10 @@ #include #include #include "Platform.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "CellBuffer.h" -#include "CharClassify.h" -#include "Decoration.h" -#include -#include "CaseFolder.h" -#include - -#ifdef SCI_NAMESPACE namespace Scintilla { -#endif +class Document; class UTF8DocumentIterator : public std::iterator { @@ -34,42 +23,8 @@ public: { } - UTF8DocumentIterator(Document* doc, int pos, int end) : - m_doc(doc), - m_pos(pos), - m_end(end), - m_characterIndex(0) - { - // Check for debug builds - PLATFORM_ASSERT(m_pos <= m_end); - - // Ensure for release. - if (m_pos > m_end) - { - m_pos = m_end; - } - readCharacter(); - } - - UTF8DocumentIterator(const UTF8DocumentIterator& copy) : - m_doc(copy.m_doc), - m_pos(copy.m_pos), - m_end(copy.m_end), - m_characterIndex(copy.m_characterIndex), - m_utf8Length(copy.m_utf8Length), - m_utf16Length(copy.m_utf16Length) - { - // Check for debug builds - PLATFORM_ASSERT(m_pos <= m_end); - m_character[0] = copy.m_character[0]; - m_character[1] = copy.m_character[1]; - - // Ensure for release. - if (m_pos > m_end) - { - m_pos = m_end; - } - } + UTF8DocumentIterator(Document* doc, int pos, int end); + UTF8DocumentIterator(const UTF8DocumentIterator& copy); bool operator == (const UTF8DocumentIterator& other) const { @@ -113,27 +68,7 @@ public: return *this; } - UTF8DocumentIterator& operator -- () - { - if (m_utf16Length == 2 && m_characterIndex == 1) - { - m_characterIndex = 0; - } - else - { - --m_pos; - // Skip past the UTF-8 extension bytes - while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0) - --m_pos; - - readCharacter(); - if (m_utf16Length == 2) - { - m_characterIndex = 1; - } - } - return *this; - } + UTF8DocumentIterator& operator -- (); int pos() const { @@ -159,8 +94,6 @@ private: static const unsigned char m_firstByteMask[]; }; -#ifdef SCI_NAMESPACE } -#endif #endif // UTF8DOCUMENTITERATOR_H_3452843291318441149 diff --git a/scintilla/boostregex/libboost_regex-vc141-mt-s-x32-1_70.lib b/scintilla/boostregex/libboost_regex-vc141-mt-s-x32-1_70.lib new file mode 100644 index 00000000..4bc21963 Binary files /dev/null and b/scintilla/boostregex/libboost_regex-vc141-mt-s-x32-1_70.lib differ diff --git a/scintilla/boostregex/nppSpecifics2.mak b/scintilla/boostregex/nppSpecifics2.mak new file mode 100644 index 00000000..45f5be4c --- /dev/null +++ b/scintilla/boostregex/nppSpecifics2.mak @@ -0,0 +1,42 @@ +# This makefile should be included in the main scintilla.mak file, +# just after where LOBJS is defined (around line +# +# The following line should be added around line 211 of scintilla.mak +# !INCLUDE nppSpecifics.mak + +# Set your boost path (the root of where you've unpacked your boost zip). +# Boost is available from www.boost.org + +!IFDEF BOOSTPATH +!IFDEF BOOSTREGEXLIBPATH + +SOBJS=\ + $(SOBJS)\ + $(DIR_O)\BoostRegexSearch.obj\ + $(DIR_O)\UTF8DocumentIterator.obj + +SCILEXOBJS=\ + $(SCILEXOBJS)\ + $(DIR_O)\BoostRegexSearch.obj\ + $(DIR_O)\UTF8DocumentIterator.obj + +LOBJS=\ + $(LOBJS)\ + $(DIR_O)\BoostRegexSearch.obj\ + $(DIR_O)\UTF8DocumentIterator.obj + +INCLUDEDIRS=$(INCLUDEDIRS) -I$(BOOSTPATH) + +CXXFLAGS=$(CXXFLAGS) -DSCI_OWNREGEX -arch:IA32 +LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTREGEXLIBPATH) + + +$(DIR_O)\UTF8DocumentIterator.obj:: ../boostregex/UTF8DocumentIterator.cxx + $(CC) $(CXXFLAGS) -c ../boostregex/UTF8DocumentIterator.cxx + +$(DIR_O)\BoostRegexSearch.obj:: ../boostregex/BoostRegexSearch.cxx ../src/CharClassify.h ../src/RESearch.h + $(CC) $(CXXFLAGS) -c ../boostregex/BoostRegexSearch.cxx + +!ENDIF +!ENDIF + diff --git a/scintilla/cocoa/InfoBar.h b/scintilla/cocoa/InfoBar.h index bc30ca28..bd7ddf7b 100644 --- a/scintilla/cocoa/InfoBar.h +++ b/scintilla/cocoa/InfoBar.h @@ -16,32 +16,30 @@ /** * Extended text cell for vertically aligned text. */ -@interface VerticallyCenteredTextFieldCell : NSTextFieldCell -{ +@interface VerticallyCenteredTextFieldCell : NSTextFieldCell { BOOL mIsEditingOrSelecting; } @end -@interface InfoBar : NSView -{ +@interface InfoBar : NSView { @private - NSImage* mBackground; - IBDisplay mDisplayMask; + NSImage *mBackground; + IBDisplay mDisplayMask; - float mScaleFactor; - NSPopUpButton* mZoomPopup; + float mScaleFactor; + NSPopUpButton *mZoomPopup; - int mCurrentCaretX; - int mCurrentCaretY; - NSTextField* mCaretPositionLabel; - NSTextField* mStatusTextLabel; + int mCurrentCaretX; + int mCurrentCaretY; + NSTextField *mCaretPositionLabel; + NSTextField *mStatusTextLabel; - id mCallback; + id mCallback; } -- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location - value: (float) value; +- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location + value: (float) value; - (void) setCallback: (id ) callback; - (void) createItems; diff --git a/scintilla/cocoa/InfoBar.mm b/scintilla/cocoa/InfoBar.mm index 2ae1ed5a..4619e952 100644 --- a/scintilla/cocoa/InfoBar.mm +++ b/scintilla/cocoa/InfoBar.mm @@ -18,23 +18,20 @@ // Inspired by code from Daniel Jalkut, Red Sweater Software. -- (NSRect) drawingRectForBounds: (NSRect) theRect -{ +- (NSRect) drawingRectForBounds: (NSRect) theRect { // Get the parent's idea of where we should draw NSRect newRect = [super drawingRectForBounds: theRect]; // When the text field is being edited or selected, we have to turn off the magic because it - // screws up the configuration of the field editor. We sneak around this by intercepting - // selectWithFrame and editWithFrame and sneaking a reduced, centered rect in at the last minute. - if (mIsEditingOrSelecting == NO) - { + // screws up the configuration of the field editor. We sneak around this by intercepting + // selectWithFrame and editWithFrame and sneaking a reduced, centered rect in at the last minute. + if (mIsEditingOrSelecting == NO) { // Get our ideal size for current text NSSize textSize = [self cellSizeForBounds: theRect]; // Center that in the proposed rect CGFloat heightDelta = newRect.size.height - textSize.height; - if (heightDelta > 0) - { + if (heightDelta > 0) { newRect.size.height -= heightDelta; newRect.origin.y += ceil(heightDelta / 2); } @@ -45,32 +42,30 @@ //-------------------------------------------------------------------------------------------------- -- (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj - delegate:(id) anObject start: (NSInteger) selStart length: (NSInteger) selLength -{ +- (void) selectWithFrame: (NSRect) aRect inView: (NSView *) controlView editor: (NSText *) textObj + delegate: (id) anObject start: (NSInteger) selStart length: (NSInteger) selLength { aRect = [self drawingRectForBounds: aRect]; mIsEditingOrSelecting = YES; [super selectWithFrame: aRect - inView: controlView - editor: textObj - delegate: anObject - start: selStart - length: selLength]; + inView: controlView + editor: textObj + delegate: anObject + start: selStart + length: selLength]; mIsEditingOrSelecting = NO; } //-------------------------------------------------------------------------------------------------- -- (void) editWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj - delegate: (id) anObject event: (NSEvent*) theEvent -{ +- (void) editWithFrame: (NSRect) aRect inView: (NSView *) controlView editor: (NSText *) textObj + delegate: (id) anObject event: (NSEvent *) theEvent { aRect = [self drawingRectForBounds: aRect]; mIsEditingOrSelecting = YES; [super editWithFrame: aRect - inView: controlView - editor: textObj - delegate: anObject - event: theEvent]; + inView: controlView + editor: textObj + delegate: anObject + event: theEvent]; mIsEditingOrSelecting = NO; } @@ -80,24 +75,26 @@ @implementation InfoBar -- (id) initWithFrame: (NSRect) frame -{ - self = [super initWithFrame: frame]; - if (self) - { - NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]]; +- (instancetype) initWithFrame: (NSRect) frame { + self = [super initWithFrame: frame]; + if (self) { + NSBundle *bundle = [NSBundle bundleForClass: [InfoBar class]]; - NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil]; - mBackground = [[NSImage alloc] initWithContentsOfFile: path]; - if (![mBackground isValid]) - NSLog(@"Background image for info bar is invalid."); + NSString *path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil]; + // macOS 10.13 introduced bug where pathForResource: fails on SMB share + if (path == nil) { + path = [bundle.bundlePath stringByAppendingPathComponent: @"Resources/info_bar_bg.tiff"]; + } + mBackground = [[NSImage alloc] initWithContentsOfFile: path]; + if (!mBackground.valid) + NSLog(@"Background image for info bar is invalid."); - mScaleFactor = 1.0; - mCurrentCaretX = 0; - mCurrentCaretY = 0; - [self createItems]; - } - return self; + mScaleFactor = 1.0; + mCurrentCaretX = 0; + mCurrentCaretY = 0; + [self createItems]; + } + return self; } //-------------------------------------------------------------------------------------------------- @@ -110,21 +107,19 @@ * @param location Carries the new location (e.g. caret) if the type is a caret change or similar type. * @param value Carries the new zoom value if the type is a zoom change. */ -- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location - value: (float) value -{ - switch (type) - { - case IBNZoomChanged: - [self setScaleFactor: value adjustPopup: YES]; - break; - case IBNCaretChanged: - [self setCaretPosition: location]; - break; - case IBNStatusChanged: - [mStatusTextLabel setStringValue: message]; - break; - } +- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location + value: (float) value { + switch (type) { + case IBNZoomChanged: + [self setScaleFactor: value adjustPopup: YES]; + break; + case IBNCaretChanged: + [self setCaretPosition: location]; + break; + case IBNStatusChanged: + mStatusTextLabel.stringValue = message; + break; + } } //-------------------------------------------------------------------------------------------------- @@ -132,158 +127,145 @@ /** * Used to set a protocol object we can use to send change notifications to. */ -- (void) setCallback: (id ) callback -{ - mCallback = callback; +- (void) setCallback: (id ) callback { + mCallback = callback; } //-------------------------------------------------------------------------------------------------- static NSString *DefaultScaleMenuLabels[] = { - @"20%", @"30%", @"50%", @"75%", @"100%", @"130%", @"160%", @"200%", @"250%", @"300%" + @"20%", @"30%", @"50%", @"75%", @"100%", @"130%", @"160%", @"200%", @"250%", @"300%" }; static float DefaultScaleMenuFactors[] = { - 0.2f, 0.3f, 0.5f, 0.75f, 1.0f, 1.3f, 1.6f, 2.0f, 2.5f, 3.0f + 0.2f, 0.3f, 0.5f, 0.75f, 1.0f, 1.3f, 1.6f, 2.0f, 2.5f, 3.0f }; static unsigned DefaultScaleMenuSelectedItemIndex = 4; static float BarFontSize = 10.0; -- (void) createItems -{ - // 1) The zoom popup. - unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuLabels) / sizeof(NSString *); +- (void) createItems { + // 1) The zoom popup. + unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuLabels) / sizeof(NSString *); - // Create the popup button. - mZoomPopup = [[NSPopUpButton allocWithZone:[self zone]] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown: NO]; + // Create the popup button. + mZoomPopup = [[NSPopUpButton alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown: NO]; - // No border or background please. - [[mZoomPopup cell] setBordered: NO]; - [[mZoomPopup cell] setArrowPosition: NSPopUpArrowAtBottom]; + // No border or background please. + [mZoomPopup.cell setBordered: NO]; + [mZoomPopup.cell setArrowPosition: NSPopUpArrowAtBottom]; - // Fill it. - for (unsigned count = 0; count < numberOfDefaultItems; count++) - { - [mZoomPopup addItemWithTitle: NSLocalizedStringFromTable(DefaultScaleMenuLabels[count], @"ZoomValues", nil)]; - id currentItem = [mZoomPopup itemAtIndex: count]; - if (DefaultScaleMenuFactors[count] != 0.0) - [currentItem setRepresentedObject: [NSNumber numberWithFloat: DefaultScaleMenuFactors[count]]]; - } - [mZoomPopup selectItemAtIndex: DefaultScaleMenuSelectedItemIndex]; + // Fill it. + for (unsigned count = 0; count < numberOfDefaultItems; count++) { + [mZoomPopup addItemWithTitle: NSLocalizedStringFromTable(DefaultScaleMenuLabels[count], @"ZoomValues", nil)]; + id currentItem = [mZoomPopup itemAtIndex: count]; + if (DefaultScaleMenuFactors[count] != 0.0) + [currentItem setRepresentedObject: @(DefaultScaleMenuFactors[count])]; + } + [mZoomPopup selectItemAtIndex: DefaultScaleMenuSelectedItemIndex]; - // Hook it up. - [mZoomPopup setTarget: self]; - [mZoomPopup setAction: @selector(zoomItemAction:)]; + // Hook it up. + mZoomPopup.target = self; + mZoomPopup.action = @selector(zoomItemAction:); - // Set a suitable font. - [mZoomPopup setFont: [NSFont menuBarFontOfSize: BarFontSize]]; + // Set a suitable font. + mZoomPopup.font = [NSFont menuBarFontOfSize: BarFontSize]; - // Make sure the popup is big enough to fit the cells. - [mZoomPopup sizeToFit]; + // Make sure the popup is big enough to fit the cells. + [mZoomPopup sizeToFit]; - // Don't let it become first responder - [mZoomPopup setRefusesFirstResponder: YES]; + // Don't let it become first responder + [mZoomPopup setRefusesFirstResponder: YES]; - // put it in the scrollview. - [self addSubview: mZoomPopup]; - [mZoomPopup release]; + // put it in the scrollview. + [self addSubview: mZoomPopup]; - // 2) The caret position label. - Class oldCellClass = [NSTextField cellClass]; - [NSTextField setCellClass: [VerticallyCenteredTextFieldCell class]]; + // 2) The caret position label. + Class oldCellClass = [NSTextField cellClass]; + [NSTextField setCellClass: [VerticallyCenteredTextFieldCell class]]; - mCaretPositionLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 50.0, 1.0)]; - [mCaretPositionLabel setBezeled: NO]; - [mCaretPositionLabel setBordered: NO]; - [mCaretPositionLabel setEditable: NO]; - [mCaretPositionLabel setSelectable: NO]; - [mCaretPositionLabel setDrawsBackground: NO]; - [mCaretPositionLabel setFont: [NSFont menuBarFontOfSize: BarFontSize]]; + mCaretPositionLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 50.0, 1.0)]; + [mCaretPositionLabel setBezeled: NO]; + [mCaretPositionLabel setBordered: NO]; + [mCaretPositionLabel setEditable: NO]; + [mCaretPositionLabel setSelectable: NO]; + [mCaretPositionLabel setDrawsBackground: NO]; + mCaretPositionLabel.font = [NSFont menuBarFontOfSize: BarFontSize]; - NSTextFieldCell* cell = [mCaretPositionLabel cell]; - [cell setPlaceholderString: @"0:0"]; - [cell setAlignment: NSCenterTextAlignment]; + NSTextFieldCell *cell = mCaretPositionLabel.cell; + cell.placeholderString = @"0:0"; + cell.alignment = NSTextAlignmentCenter; - [self addSubview: mCaretPositionLabel]; - [mCaretPositionLabel release]; + [self addSubview: mCaretPositionLabel]; - // 3) The status text. - mStatusTextLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0)]; - [mStatusTextLabel setBezeled: NO]; - [mStatusTextLabel setBordered: NO]; - [mStatusTextLabel setEditable: NO]; - [mStatusTextLabel setSelectable: NO]; - [mStatusTextLabel setDrawsBackground: NO]; - [mStatusTextLabel setFont: [NSFont menuBarFontOfSize: BarFontSize]]; + // 3) The status text. + mStatusTextLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0)]; + [mStatusTextLabel setBezeled: NO]; + [mStatusTextLabel setBordered: NO]; + [mStatusTextLabel setEditable: NO]; + [mStatusTextLabel setSelectable: NO]; + [mStatusTextLabel setDrawsBackground: NO]; + mStatusTextLabel.font = [NSFont menuBarFontOfSize: BarFontSize]; - cell = [mStatusTextLabel cell]; - [cell setPlaceholderString: @""]; + cell = mStatusTextLabel.cell; + cell.placeholderString = @""; - [self addSubview: mStatusTextLabel]; - [mStatusTextLabel release]; + [self addSubview: mStatusTextLabel]; - // Restore original cell class so that everything else doesn't get broken - [NSTextField setCellClass: oldCellClass]; + // Restore original cell class so that everything else doesn't get broken + [NSTextField setCellClass: oldCellClass]; } //-------------------------------------------------------------------------------------------------- -- (void) dealloc -{ - [mBackground release]; - [super dealloc]; -} //-------------------------------------------------------------------------------------------------- /** * Fill the background. */ -- (void) drawRect: (NSRect) rect -{ - // Since the background is seamless, we don't need to take care for the proper offset. - // Simply tile the background over the invalid rectangle. - NSPoint target = {rect.origin.x, 0}; - while (target.x < rect.origin.x + rect.size.width) - { - [mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1]; - target.x += mBackground.size.width; - } +- (void) drawRect: (NSRect) rect { + [[NSColor controlBackgroundColor] set]; + [NSBezierPath fillRect: rect]; - // Draw separator lines between items. - NSRect verticalLineRect; - CGFloat component = 190.0 / 255.0; - NSColor* lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1]; + // Since the background is seamless, we don't need to take care for the proper offset. + // Simply tile the background over the invalid rectangle. + if (mBackground.size.width != 0) { + NSPoint target = {rect.origin.x, 0}; + while (target.x < rect.origin.x + rect.size.width) { + [mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositingOperationSourceOver fraction: 1]; + target.x += mBackground.size.width; + } + } - if (mDisplayMask & IBShowZoom) - { - verticalLineRect = [mZoomPopup frame]; - verticalLineRect.origin.x += verticalLineRect.size.width + 1.0; - verticalLineRect.size.width = 1.0; - if (NSIntersectsRect(rect, verticalLineRect)) - { - [lineColor set]; - NSRectFill(verticalLineRect); - } - } + // Draw separator lines between items. + NSRect verticalLineRect; + CGFloat component = 190.0 / 255.0; + NSColor *lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1]; - if (mDisplayMask & IBShowCaretPosition) - { - verticalLineRect = [mCaretPositionLabel frame]; - verticalLineRect.origin.x += verticalLineRect.size.width + 1.0; - verticalLineRect.size.width = 1.0; - if (NSIntersectsRect(rect, verticalLineRect)) - { - [lineColor set]; - NSRectFill(verticalLineRect); - } - } + if (mDisplayMask & IBShowZoom) { + verticalLineRect = mZoomPopup.frame; + verticalLineRect.origin.x += verticalLineRect.size.width + 1.0; + verticalLineRect.size.width = 1.0; + if (NSIntersectsRect(rect, verticalLineRect)) { + [lineColor set]; + NSRectFill(verticalLineRect); + } + } + + if (mDisplayMask & IBShowCaretPosition) { + verticalLineRect = mCaretPositionLabel.frame; + verticalLineRect.origin.x += verticalLineRect.size.width + 1.0; + verticalLineRect.size.width = 1.0; + if (NSIntersectsRect(rect, verticalLineRect)) { + [lineColor set]; + NSRectFill(verticalLineRect); + } + } } //-------------------------------------------------------------------------------------------------- -- (BOOL) isOpaque -{ - return YES; +- (BOOL) isOpaque { + return YES; } //-------------------------------------------------------------------------------------------------- @@ -291,46 +273,38 @@ static float BarFontSize = 10.0; /** * Used to reposition our content depending on the size of the view. */ -- (void) setFrame: (NSRect) newFrame -{ - [super setFrame: newFrame]; - [self positionSubViews]; +- (void) setFrame: (NSRect) newFrame { + super.frame = newFrame; + [self positionSubViews]; } //-------------------------------------------------------------------------------------------------- -- (void) positionSubViews -{ - NSRect currentBounds = {{0, 0}, {0, [self frame].size.height}}; - if (mDisplayMask & IBShowZoom) - { - [mZoomPopup setHidden: NO]; - currentBounds.size.width = [mZoomPopup frame].size.width; - [mZoomPopup setFrame: currentBounds]; - currentBounds.origin.x += currentBounds.size.width + 1; // Add 1 for the separator. - } - else - [mZoomPopup setHidden: YES]; +- (void) positionSubViews { + NSRect currentBounds = {{0, 0}, {0, self.frame.size.height}}; + if (mDisplayMask & IBShowZoom) { + [mZoomPopup setHidden: NO]; + currentBounds.size.width = mZoomPopup.frame.size.width; + mZoomPopup.frame = currentBounds; + currentBounds.origin.x += currentBounds.size.width + 1; // Add 1 for the separator. + } else + [mZoomPopup setHidden: YES]; - if (mDisplayMask & IBShowCaretPosition) - { - [mCaretPositionLabel setHidden: NO]; - currentBounds.size.width = [mCaretPositionLabel frame].size.width; - [mCaretPositionLabel setFrame: currentBounds]; - currentBounds.origin.x += currentBounds.size.width + 1; - } - else - [mCaretPositionLabel setHidden: YES]; + if (mDisplayMask & IBShowCaretPosition) { + [mCaretPositionLabel setHidden: NO]; + currentBounds.size.width = mCaretPositionLabel.frame.size.width; + mCaretPositionLabel.frame = currentBounds; + currentBounds.origin.x += currentBounds.size.width + 1; + } else + [mCaretPositionLabel setHidden: YES]; - if (mDisplayMask & IBShowStatusText) - { - // The status text always takes the rest of the available space. - [mStatusTextLabel setHidden: NO]; - currentBounds.size.width = [self frame].size.width - currentBounds.origin.x; - [mStatusTextLabel setFrame: currentBounds]; - } - else - [mStatusTextLabel setHidden: YES]; + if (mDisplayMask & IBShowStatusText) { + // The status text always takes the rest of the available space. + [mStatusTextLabel setHidden: NO]; + currentBounds.size.width = self.frame.size.width - currentBounds.origin.x; + mStatusTextLabel.frame = currentBounds; + } else + [mStatusTextLabel setHidden: YES]; } //-------------------------------------------------------------------------------------------------- @@ -340,14 +314,12 @@ static float BarFontSize = 10.0; * * @param display Bitwise ORed IBDisplay values which determine what to show on the bar. */ -- (void) setDisplay: (IBDisplay) display -{ - if (mDisplayMask != display) - { - mDisplayMask = display; - [self positionSubViews]; - [self needsDisplay]; - } +- (void) setDisplay: (IBDisplay) display { + if (mDisplayMask != display) { + mDisplayMask = display; + [self positionSubViews]; + self.needsDisplay = YES; + } } //-------------------------------------------------------------------------------------------------- @@ -355,53 +327,43 @@ static float BarFontSize = 10.0; /** * Handler for selection changes in the zoom menu. */ -- (void) zoomItemAction: (id) sender -{ - NSNumber* selectedFactorObject = [[sender selectedCell] representedObject]; +- (void) zoomItemAction: (id) sender { + NSNumber *selectedFactorObject = [[sender selectedCell] representedObject]; - if (selectedFactorObject == nil) - { - NSLog(@"Scale popup action: setting arbitrary zoom factors is not yet supported."); - return; - } - else - { - [self setScaleFactor: [selectedFactorObject floatValue] adjustPopup: NO]; - } + if (selectedFactorObject == nil) { + NSLog(@"Scale popup action: setting arbitrary zoom factors is not yet supported."); + return; + } else { + [self setScaleFactor: selectedFactorObject.floatValue adjustPopup: NO]; + } } //-------------------------------------------------------------------------------------------------- -- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag -{ - if (mScaleFactor != newScaleFactor) - { - mScaleFactor = newScaleFactor; - if (flag) - { - unsigned count = 0; - unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuFactors) / sizeof(float); +- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag { + if (mScaleFactor != newScaleFactor) { + mScaleFactor = newScaleFactor; + if (flag) { + unsigned count = 0; + unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuFactors) / sizeof(float); - // We only work with some preset zoom values. If the given value does not correspond - // to one then show no selection. - while (count < numberOfDefaultItems && (fabs(newScaleFactor - DefaultScaleMenuFactors[count]) > 0.07)) - count++; - if (count == numberOfDefaultItems) - [mZoomPopup selectItemAtIndex: -1]; - else - { - [mZoomPopup selectItemAtIndex: count]; + // We only work with some preset zoom values. If the given value does not correspond + // to one then show no selection. + while (count < numberOfDefaultItems && (fabs(newScaleFactor - DefaultScaleMenuFactors[count]) > 0.07)) + count++; + if (count == numberOfDefaultItems) + [mZoomPopup selectItemAtIndex: -1]; + else { + [mZoomPopup selectItemAtIndex: count]; - // Set scale factor to found preset value if it comes close. - mScaleFactor = DefaultScaleMenuFactors[count]; - } - } - else - { - // Internally set. Notify owner. - [mCallback notify: IBNZoomChanged message: nil location: NSZeroPoint value: newScaleFactor]; - } - } + // Set scale factor to found preset value if it comes close. + mScaleFactor = DefaultScaleMenuFactors[count]; + } + } else { + // Internally set. Notify owner. + [mCallback notify: IBNZoomChanged message: nil location: NSZeroPoint value: newScaleFactor]; + } + } } //-------------------------------------------------------------------------------------------------- @@ -409,19 +371,17 @@ static float BarFontSize = 10.0; /** * Called from the notification method to update the caret position display. */ -- (void) setCaretPosition: (NSPoint) position -{ - // Make the position one-based. - int newX = (int) position.x + 1; - int newY = (int) position.y + 1; +- (void) setCaretPosition: (NSPoint) position { + // Make the position one-based. + int newX = (int) position.x + 1; + int newY = (int) position.y + 1; - if (mCurrentCaretX != newX || mCurrentCaretY != newY) - { - mCurrentCaretX = newX; - mCurrentCaretY = newY; + if (mCurrentCaretX != newX || mCurrentCaretY != newY) { + mCurrentCaretX = newX; + mCurrentCaretY = newY; - [mCaretPositionLabel setStringValue: [NSString stringWithFormat: @"%d:%d", newX, newY]]; - } + mCaretPositionLabel.stringValue = [NSString stringWithFormat: @"%d:%d", newX, newY]; + } } //-------------------------------------------------------------------------------------------------- @@ -429,20 +389,19 @@ static float BarFontSize = 10.0; /** * Makes the bar resize to the smallest width that can accommodate the currently enabled items. */ -- (void) sizeToFit -{ - NSRect frame = [self frame]; - frame.size.width = 0; - if (mDisplayMask & IBShowZoom) - frame.size.width += [mZoomPopup frame].size.width; +- (void) sizeToFit { + NSRect frame = self.frame; + frame.size.width = 0; + if (mDisplayMask & IBShowZoom) + frame.size.width += mZoomPopup.frame.size.width; - if (mDisplayMask & IBShowCaretPosition) - frame.size.width += [mCaretPositionLabel frame].size.width; + if (mDisplayMask & IBShowCaretPosition) + frame.size.width += mCaretPositionLabel.frame.size.width; - if (mDisplayMask & IBShowStatusText) - frame.size.width += [mStatusTextLabel frame].size.width; + if (mDisplayMask & IBShowStatusText) + frame.size.width += mStatusTextLabel.frame.size.width; - [self setFrame: frame]; + self.frame = frame; } @end diff --git a/scintilla/cocoa/InfoBarCommunicator.h b/scintilla/cocoa/InfoBarCommunicator.h index 5727c3a1..38ea6b01 100644 --- a/scintilla/cocoa/InfoBarCommunicator.h +++ b/scintilla/cocoa/InfoBarCommunicator.h @@ -9,10 +9,10 @@ */ typedef NS_OPTIONS(NSUInteger, IBDisplay) { - IBShowZoom = 0x01, - IBShowCaretPosition = 0x02, - IBShowStatusText = 0x04, - IBShowAll = 0xFF + IBShowZoom = 0x01, + IBShowCaretPosition = 0x02, + IBShowStatusText = 0x04, + IBShowAll = 0xFF }; /** @@ -22,14 +22,14 @@ typedef NS_OPTIONS(NSUInteger, IBDisplay) { */ typedef NS_ENUM(NSInteger, NotificationType) { - IBNZoomChanged, // The user selected another zoom value. - IBNCaretChanged, // The caret in the editor changed. - IBNStatusChanged, // The application set a new status message. + IBNZoomChanged, // The user selected another zoom value. + IBNCaretChanged, // The caret in the editor changed. + IBNStatusChanged, // The application set a new status message. }; @protocol InfoBarCommunicator -- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location - value: (float) value; +- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location + value: (float) value; - (void) setCallback: (id ) callback; @end diff --git a/scintilla/cocoa/PlatCocoa.h b/scintilla/cocoa/PlatCocoa.h index 2a1b807a..00a871a7 100644 --- a/scintilla/cocoa/PlatCocoa.h +++ b/scintilla/cocoa/PlatCocoa.h @@ -7,115 +7,117 @@ #ifndef PLATCOCOA_H #define PLATCOCOA_H -#include - -#include - #include +#include #include #include +#include + #include -#include "QuartzTextLayout.h" #include "Platform.h" #include "Scintilla.h" -NSRect PRectangleToNSRect(Scintilla::PRectangle& rc); -Scintilla::PRectangle NSRectToPRectangle(NSRect& rc); +#include "QuartzTextLayout.h" + +NSRect PRectangleToNSRect(const Scintilla::PRectangle &rc); +Scintilla::PRectangle NSRectToPRectangle(NSRect &rc); CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet); -@interface ScintillaContextMenu : NSMenu -{ - Scintilla::ScintillaCocoa* owner; +@interface ScintillaContextMenu : NSMenu { + Scintilla::ScintillaCocoa *owner; } -- (void) handleCommand: (NSMenuItem*) sender; -- (void) setOwner: (Scintilla::ScintillaCocoa*) newOwner; +- (void) handleCommand: (NSMenuItem *) sender; +- (void) setOwner: (Scintilla::ScintillaCocoa *) newOwner; @end namespace Scintilla { // A class to do the actual text rendering for us using Quartz 2D. -class SurfaceImpl : public Surface -{ +class SurfaceImpl : public Surface { private: - bool unicodeMode; - float x; - float y; + bool unicodeMode; + float x; + float y; - CGContextRef gc; + CGContextRef gc; - /** The text layout instance */ - QuartzTextLayout* textLayout; - int codePage; - int verticalDeviceResolution; + /** The text layout instance */ + std::unique_ptr textLayout; + int codePage; + int verticalDeviceResolution; - /** If the surface is a bitmap context, contains a reference to the bitmap data. */ - uint8_t* bitmapData; - /** If the surface is a bitmap context, stores the dimensions of the bitmap. */ - int bitmapWidth; - int bitmapHeight; + /** If the surface is a bitmap context, contains a reference to the bitmap data. */ + std::unique_ptr bitmapData; + /** If the surface is a bitmap context, stores the dimensions of the bitmap. */ + int bitmapWidth; + int bitmapHeight; - /** Set the CGContext's fill colour to the specified desired colour. */ - void FillColour( const ColourDesired& back ); + /** Set the CGContext's fill colour to the specified desired colour. */ + void FillColour(const ColourDesired &back); - // 24-bit RGB+A bitmap data constants - static const int BITS_PER_COMPONENT = 8; - static const int BITS_PER_PIXEL = BITS_PER_COMPONENT * 4; - static const int BYTES_PER_PIXEL = BITS_PER_PIXEL / 8; + // 24-bit RGB+A bitmap data constants + static const int BITS_PER_COMPONENT = 8; + static const int BITS_PER_PIXEL = BITS_PER_COMPONENT * 4; + static const int BYTES_PER_PIXEL = BITS_PER_PIXEL / 8; + + void Clear(); + public: - SurfaceImpl(); - ~SurfaceImpl(); + SurfaceImpl(); + ~SurfaceImpl() override; - void Init(WindowID wid); - void Init(SurfaceID sid, WindowID wid); - void InitPixMap(int width, int height, Surface *surface_, WindowID wid); - CGContextRef GetContext() { return gc; } + void Init(WindowID wid) override; + void Init(SurfaceID sid, WindowID wid) override; + void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override; + CGContextRef GetContext() { return gc; } - void Release(); - bool Initialised(); - void PenColour(ColourDesired fore); + void Release() override; + bool Initialised() override; + void PenColour(ColourDesired fore) override; - /** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */ - CGImageRef GetImage(); - void CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect); + /** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */ + CGImageRef GetImage(); + void CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect); - int LogPixelsY(); - int DeviceHeightFont(int points); - void MoveTo(int x_, int y_); - void LineTo(int x_, int y_); - void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back); - void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); - void FillRectangle(PRectangle rc, ColourDesired back); - void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, - ColourDesired outline, int alphaOutline, int flags); - void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); - void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); - void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource); - void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, - ColourDesired back); - void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, - ColourDesired back); - void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); - void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); - XYPOSITION WidthText(Font &font_, const char *s, int len); - XYPOSITION WidthChar(Font &font_, char ch); - XYPOSITION Ascent(Font &font_); - XYPOSITION Descent(Font &font_); - XYPOSITION InternalLeading(Font &font_); - XYPOSITION ExternalLeading(Font &font_); - XYPOSITION Height(Font &font_); - XYPOSITION AverageCharWidth(Font &font_); + int LogPixelsY() override; + int DeviceHeightFont(int points) override; + void MoveTo(int x_, int y_) override; + void LineTo(int x_, int y_) override; + void Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override; + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override; + void FillRectangle(PRectangle rc, ColourDesired back) override; + void FillRectangle(PRectangle rc, Surface &surfacePattern) override; + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) override; + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags) override; + void GradientRectangle(PRectangle rc, const std::vector &stops, GradientOptions options) override; + void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override; + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override; + void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) override; + std::unique_ptr Layout(const IScreenLine *screenLine) override; + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, + ColourDesired back) override; + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, + ColourDesired back) override; + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore) override; + void MeasureWidths(Font &font_, std::string_view text, XYPOSITION *positions) override; + XYPOSITION WidthText(Font &font_, std::string_view text) override; + XYPOSITION Ascent(Font &font_) override; + XYPOSITION Descent(Font &font_) override; + XYPOSITION InternalLeading(Font &font_) override; + XYPOSITION Height(Font &font_) override; + XYPOSITION AverageCharWidth(Font &font_) override; - void SetClip(PRectangle rc); - void FlushCachedState(); + void SetClip(PRectangle rc) override; + void FlushCachedState() override; - void SetUnicodeMode(bool unicodeMode_); - void SetDBCSMode(int codePage_); + void SetUnicodeMode(bool unicodeMode_) override; + void SetDBCSMode(int codePage_) override; + void SetBidiR2L(bool bidiR2L_) override; }; // SurfaceImpl class } // Scintilla namespace diff --git a/scintilla/cocoa/PlatCocoa.mm b/scintilla/cocoa/PlatCocoa.mm index 98373fdd..737c5ba0 100644 --- a/scintilla/cocoa/PlatCocoa.mm +++ b/scintilla/cocoa/PlatCocoa.mm @@ -12,39 +12,45 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ -#include -#include - +#include #include +#include #include #include #include +#include #include #include +#include +#include +#include + +#include #import #import "Platform.h" + +#include "StringCopy.h" +#include "XPM.h" +#include "UniConversion.h" + #import "ScintillaView.h" #import "ScintillaCocoa.h" #import "PlatCocoa.h" -#include "StringCopy.h" -#include "XPM.h" - using namespace Scintilla; -extern sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam); +extern sptr_t scintilla_send_message(void *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam); //-------------------------------------------------------------------------------------------------- /** * Converts a PRectangle as used by Scintilla to standard Obj-C NSRect structure . */ -NSRect PRectangleToNSRect(PRectangle& rc) -{ - return NSMakeRect(rc.left, rc.top, rc.Width(), rc.Height()); +NSRect PRectangleToNSRect(const PRectangle &rc) { + return NSMakeRect(rc.left, rc.top, rc.Width(), rc.Height()); } //-------------------------------------------------------------------------------------------------- @@ -52,11 +58,10 @@ NSRect PRectangleToNSRect(PRectangle& rc) /** * Converts an NSRect as used by the system to a native Scintilla rectangle. */ -PRectangle NSRectToPRectangle(NSRect& rc) -{ - return PRectangle(static_cast(rc.origin.x), static_cast(rc.origin.y), - static_cast(NSMaxX(rc)), - static_cast(NSMaxY(rc))); +PRectangle NSRectToPRectangle(NSRect &rc) { + return PRectangle(static_cast(rc.origin.x), static_cast(rc.origin.y), + static_cast(NSMaxX(rc)), + static_cast(NSMaxY(rc))); } //-------------------------------------------------------------------------------------------------- @@ -64,66 +69,42 @@ PRectangle NSRectToPRectangle(NSRect& rc) /** * Converts a PRectangle as used by Scintilla to a Quartz-style rectangle. */ -inline CGRect PRectangleToCGRect(PRectangle& rc) -{ - return CGRectMake(rc.left, rc.top, rc.Width(), rc.Height()); -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Converts a Quartz-style rectangle to a PRectangle structure as used by Scintilla. - */ -inline PRectangle CGRectToPRectangle(const CGRect& rect) -{ - PRectangle rc; - rc.left = (int)(rect.origin.x + 0.5); - rc.top = (int)(rect.origin.y + 0.5); - rc.right = (int)(rect.origin.x + rect.size.width + 0.5); - rc.bottom = (int)(rect.origin.y + rect.size.height + 0.5); - return rc; -} - -//----------------- Point -------------------------------------------------------------------------- - -/** - * Converts a point given as a long into a native Point structure. - */ -Scintilla::Point Scintilla::Point::FromLong(long lpoint) -{ - return Scintilla::Point( - Platform::LowShortFromLong(lpoint), - Platform::HighShortFromLong(lpoint) - ); +inline CGRect PRectangleToCGRect(PRectangle &rc) { + return CGRectMake(rc.left, rc.top, rc.Width(), rc.Height()); } //----------------- Font --------------------------------------------------------------------------- -Font::Font(): fid(0) -{ +Font::Font() noexcept : fid(0) { } //-------------------------------------------------------------------------------------------------- -Font::~Font() -{ - Release(); +Font::~Font() { + Release(); +} + +//-------------------------------------------------------------------------------------------------- + +static QuartzTextStyle *TextStyleFromFont(const Font &f) { + return static_cast(f.GetID()); } //-------------------------------------------------------------------------------------------------- static int FontCharacterSet(Font &f) { - return reinterpret_cast(f.GetID())->getCharacterSet(); + return TextStyleFromFont(f)->getCharacterSet(); } +//-------------------------------------------------------------------------------------------------- + /** * Creates a CTFontRef with the given properties. */ -void Font::Create(const FontParameters &fp) -{ +void Font::Create(const FontParameters &fp) { Release(); - QuartzTextStyle* style = new QuartzTextStyle(); + QuartzTextStyle *style = new QuartzTextStyle(); fid = style; // Create the font with attributes @@ -134,229 +115,423 @@ void Font::Create(const FontParameters &fp) //-------------------------------------------------------------------------------------------------- -void Font::Release() -{ - if (fid) - delete reinterpret_cast( fid ); - fid = 0; +void Font::Release() { + if (fid) + delete static_cast(fid); + fid = 0; +} + +//-------------------------------------------------------------------------------------------------- + +// Bidirectional text support for Arabic and Hebrew. + +namespace { + +CFIndex IndexFromPosition(std::string_view text, size_t position) { + const std::string_view textUptoPosition = text.substr(0, position); + return UTF16Length(textUptoPosition); +} + +// Handling representations and tabs + +struct Blob { + XYPOSITION width; + Blob(XYPOSITION width_) : width(width_) { + } +}; + +static void BlobDealloc(void *refCon) { + Blob *blob = static_cast(refCon); + delete blob; +} + +static CGFloat BlobGetWidth(void *refCon) { + Blob *blob = static_cast(refCon); + return blob->width; +} + +class ScreenLineLayout : public IScreenLineLayout { + CTLineRef line = NULL; + const std::string text; +public: + ScreenLineLayout(const IScreenLine *screenLine); + ~ScreenLineLayout(); + // IScreenLineLayout implementation + size_t PositionFromX(XYPOSITION xDistance, bool charPosition) override; + XYPOSITION XFromPosition(size_t caretPosition) override; + std::vector FindRangeIntervals(size_t start, size_t end) override; +}; + +ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) : text(screenLine->Text()) { + const UInt8 *puiBuffer = reinterpret_cast(text.data()); + std::string_view sv = text; + + // Start with an empty mutable attributed string and add each character to it. + CFMutableAttributedStringRef mas = CFAttributedStringCreateMutable(NULL, 0); + + for (size_t bp=0; bpRepresentationWidth(bp); + if (uch == '\t') { + // Find the size up to the tab + NSMutableAttributedString *nas = (__bridge NSMutableAttributedString *)mas; + const NSSize sizeUpTo = [nas size]; + const XYPOSITION nextTab = screenLine->TabPositionAfter(sizeUpTo.width); + repWidth = nextTab - sizeUpTo.width; + } + CFAttributedStringRef as = NULL; + if (repWidth > 0.0f) { + CTRunDelegateCallbacks callbacks = { + .version = kCTRunDelegateVersion1, + .dealloc = BlobDealloc, + .getWidth = BlobGetWidth + }; + CTRunDelegateRef runDelegate = CTRunDelegateCreate(&callbacks, new Blob(repWidth)); + NSMutableAttributedString *masBlob = [[NSMutableAttributedString alloc] initWithString:@"X"]; + NSRange rangeX = NSMakeRange(0, 1); + [masBlob addAttribute: (NSString *)kCTRunDelegateAttributeName value: (__bridge id)runDelegate range:rangeX]; + CFRelease(runDelegate); + as = (CFAttributedStringRef)CFBridgingRetain(masBlob); + } else { + CFStringRef piece = CFStringCreateWithBytes(NULL, + &puiBuffer[bp], + byteCount, + kCFStringEncodingUTF8, + false); + QuartzTextStyle *qts = static_cast(screenLine->FontOfPosition(bp)->GetID()); + CFMutableDictionaryRef pieceAttributes = qts->getCTStyle(); + as = CFAttributedStringCreate(NULL, piece, pieceAttributes); + CFRelease(piece); + } + CFAttributedStringReplaceAttributedString(mas, + CFRangeMake(CFAttributedStringGetLength(mas), 0), + as); + bp += byteCount; + sv.remove_prefix(byteCount); + CFRelease(as); + } + + line = CTLineCreateWithAttributedString(mas); + CFRelease(mas); +} + +ScreenLineLayout::~ScreenLineLayout() { + CFRelease(line); +} + +size_t ScreenLineLayout::PositionFromX(XYPOSITION xDistance, bool charPosition) { + if (!line) { + return 0; + } + const CGPoint ptDistance = CGPointMake(xDistance, 0); + const CFIndex offset = CTLineGetStringIndexForPosition(line, ptDistance); + if (offset == kCFNotFound) { + return 0; + } + // Convert back to UTF-8 positions + return UTF8PositionFromUTF16Position(text, offset); +} + +XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) { + if (!line) { + return 0.0; + } + // Convert from UTF-8 position + const CFIndex caretIndex = IndexFromPosition(text, caretPosition); + + const CGFloat distance = CTLineGetOffsetForStringIndex(line, caretIndex, nullptr); + return distance; +} + +void AddToIntervalVector(std::vector &vi, XYPOSITION left, XYPOSITION right) { + const Interval interval = {left, right}; + if (vi.empty()) { + vi.push_back(interval); + } else { + Interval &last = vi.back(); + if (fabs(last.right-interval.left) < 0.01) { + // If new left is very close to previous right then extend last item + last.right = interval.right; + } else { + vi.push_back(interval); + } + } +} + +std::vector ScreenLineLayout::FindRangeIntervals(size_t start, size_t end) { + if (!line) { + return {}; + } + + std::vector ret; + + // Convert from UTF-8 position + const CFIndex startIndex = IndexFromPosition(text, start); + const CFIndex endIndex = IndexFromPosition(text, end); + + CFArrayRef runs = CTLineGetGlyphRuns(line); + const CFIndex runCount = CFArrayGetCount(runs); + for (CFIndex run=0; run(CFArrayGetValueAtIndex(runs, run)); + const CFIndex glyphCount = CTRunGetGlyphCount(aRun); + const CFRange rangeAll = CFRangeMake(0, glyphCount); + std::vector indices(glyphCount); + CTRunGetStringIndices(aRun, rangeAll, indices.data()); + std::vector positions(glyphCount); + CTRunGetPositions(aRun, rangeAll, positions.data()); + std::vector advances(glyphCount); + CTRunGetAdvances(aRun, rangeAll, advances.data()); + for (CFIndex glyph=0; glyph= startIndex) && (glyphIndex < endIndex)) { + AddToIntervalVector(ret, xPosition, xPosition + width); + } + } + } + return ret; +} + +// Helper for SurfaceImpl::MeasureWidths that examines the glyph runs in a layout + +void GetPositions(CTLineRef line, std::vector &positions) { + + // Find the advances of the text + std::vector lineAdvances(positions.size()); + CFArrayRef runs = CTLineGetGlyphRuns(line); + const CFIndex runCount = CFArrayGetCount(runs); + for (CFIndex run=0; run(CFArrayGetValueAtIndex(runs, run)); + const CFIndex glyphCount = CTRunGetGlyphCount(aRun); + const CFRange rangeAll = CFRangeMake(0, glyphCount); + std::vector indices(glyphCount); + CTRunGetStringIndices(aRun, rangeAll, indices.data()); + std::vector advances(glyphCount); + CTRunGetAdvances(aRun, rangeAll, advances.data()); + for (CFIndex glyph=0; glyph= positions.size()) { + return; + } + lineAdvances[glyphIndex] = advances[glyph].width; + } + } + + // Accumulate advances into positions + std::partial_sum(lineAdvances.begin(), lineAdvances.end(), + positions.begin(), std::plus()); +} + } //----------------- SurfaceImpl -------------------------------------------------------------------- -SurfaceImpl::SurfaceImpl() -{ - unicodeMode = true; - x = 0; - y = 0; - gc = NULL; +SurfaceImpl::SurfaceImpl() { + unicodeMode = true; + x = 0; + y = 0; + gc = NULL; - textLayout = new QuartzTextLayout(NULL); - codePage = 0; - verticalDeviceResolution = 0; + textLayout.reset(new QuartzTextLayout()); + codePage = 0; + verticalDeviceResolution = 0; - bitmapData = NULL; // Release will try and delete bitmapData if != NULL - bitmapWidth = 0; - bitmapHeight = 0; + bitmapData.reset(); // Release will try and delete bitmapData if != nullptr + bitmapWidth = 0; + bitmapHeight = 0; - Release(); + Release(); } //-------------------------------------------------------------------------------------------------- -SurfaceImpl::~SurfaceImpl() -{ - Release(); - delete textLayout; +SurfaceImpl::~SurfaceImpl() { + Clear(); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Release() -{ - textLayout->setContext (NULL); - if ( bitmapData != NULL ) - { - delete[] bitmapData; - // We only "own" the graphics context if we are a bitmap context - if (gc != NULL) - CGContextRelease(gc); - } - bitmapData = NULL; - gc = NULL; +void SurfaceImpl::Clear() { + if (bitmapData) { + bitmapData.reset(); + // We only "own" the graphics context if we are a bitmap context + if (gc) + CGContextRelease(gc); + } + gc = NULL; - bitmapWidth = 0; - bitmapHeight = 0; - x = 0; - y = 0; + bitmapWidth = 0; + bitmapHeight = 0; + x = 0; + y = 0; } //-------------------------------------------------------------------------------------------------- -bool SurfaceImpl::Initialised() -{ - // We are initalised if the graphics context is not null - return gc != NULL;// || port != NULL; +void SurfaceImpl::Release() { + Clear(); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Init(WindowID) -{ - // To be able to draw, the surface must get a CGContext handle. We save the graphics port, - // then acquire/release the context on an as-need basis (see above). - // XXX Docs on QDBeginCGContext are light, a better way to do this would be good. - // AFAIK we should not hold onto a context retrieved this way, thus the need for - // acquire/release of the context. - - Release(); +bool SurfaceImpl::Initialised() { + // We are initalised if the graphics context is not null + return gc != NULL;// || port != NULL; } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Init(SurfaceID sid, WindowID) -{ - Release(); - gc = reinterpret_cast(sid); - CGContextSetLineWidth(gc, 1.0); - textLayout->setContext(gc); +void SurfaceImpl::Init(WindowID) { + // To be able to draw, the surface must get a CGContext handle. We save the graphics port, + // then acquire/release the context on an as-need basis (see above). + // XXX Docs on QDBeginCGContext are light, a better way to do this would be good. + // AFAIK we should not hold onto a context retrieved this way, thus the need for + // acquire/release of the context. + + Release(); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::InitPixMap(int width, int height, Surface* surface_, WindowID /* wid */) -{ - Release(); - - // Create a new bitmap context, along with the RAM for the bitmap itself - bitmapWidth = width; - bitmapHeight = height; - - const int bitmapBytesPerRow = (width * BYTES_PER_PIXEL); - const int bitmapByteCount = (bitmapBytesPerRow * height); - - // Create an RGB color space. - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - if (colorSpace == NULL) - return; - - // Create the bitmap. - bitmapData = new uint8_t[bitmapByteCount]; - // create the context - gc = CGBitmapContextCreate(bitmapData, - width, - height, - BITS_PER_COMPONENT, - bitmapBytesPerRow, - colorSpace, - kCGImageAlphaPremultipliedLast); - - if (gc == NULL) - { - // the context couldn't be created for some reason, - // and we have no use for the bitmap without the context - delete[] bitmapData; - bitmapData = NULL; - } - textLayout->setContext (gc); - - // the context retains the color space, so we can release it - CGColorSpaceRelease(colorSpace); - - if (gc != NULL && bitmapData != NULL) - { - // "Erase" to white. - CGContextClearRect( gc, CGRectMake( 0, 0, width, height ) ); - CGContextSetRGBFillColor( gc, 1.0, 1.0, 1.0, 1.0 ); - CGContextFillRect( gc, CGRectMake( 0, 0, width, height ) ); - } - - SurfaceImpl *psurfOther = static_cast(surface_); - unicodeMode = psurfOther->unicodeMode; - codePage = psurfOther->codePage; +void SurfaceImpl::Init(SurfaceID sid, WindowID) { + Release(); + gc = static_cast(sid); + CGContextSetLineWidth(gc, 1.0); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::PenColour(ColourDesired fore) -{ - if (gc) - { - ColourDesired colour(fore.AsLong()); +void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID /* wid */) { + Release(); - // Set the Stroke color to match - CGContextSetRGBStrokeColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, - colour.GetBlue() / 255.0, 1.0 ); - } + // Create a new bitmap context, along with the RAM for the bitmap itself + bitmapWidth = width; + bitmapHeight = height; + + const int bitmapBytesPerRow = (width * BYTES_PER_PIXEL); + const int bitmapByteCount = (bitmapBytesPerRow * height); + + // Create an RGB color space. + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + if (colorSpace == NULL) + return; + + // Create the bitmap. + bitmapData.reset(new uint8_t[bitmapByteCount]); + // create the context + gc = CGBitmapContextCreate(bitmapData.get(), + width, + height, + BITS_PER_COMPONENT, + bitmapBytesPerRow, + colorSpace, + kCGImageAlphaPremultipliedLast); + + if (gc == NULL) { + // the context couldn't be created for some reason, + // and we have no use for the bitmap without the context + bitmapData.reset(); + } + + // the context retains the color space, so we can release it + CGColorSpaceRelease(colorSpace); + + if (gc && bitmapData) { + // "Erase" to white. + CGContextClearRect(gc, CGRectMake(0, 0, width, height)); + CGContextSetRGBFillColor(gc, 1.0, 1.0, 1.0, 1.0); + CGContextFillRect(gc, CGRectMake(0, 0, width, height)); + } + + if (surface_) { + SurfaceImpl *psurfOther = static_cast(surface_); + unicodeMode = psurfOther->unicodeMode; + codePage = psurfOther->codePage; + } else { + unicodeMode = true; + codePage = SC_CP_UTF8; + } } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillColour(const ColourDesired& back) -{ - if (gc) - { - ColourDesired colour(back.AsLong()); +void SurfaceImpl::PenColour(ColourDesired fore) { + if (gc) { + ColourDesired colour(fore.AsInteger()); - // Set the Fill color to match - CGContextSetRGBFillColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, - colour.GetBlue() / 255.0, 1.0 ); - } + // Set the Stroke color to match + CGContextSetRGBStrokeColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, + colour.GetBlue() / 255.0, 1.0); + } } //-------------------------------------------------------------------------------------------------- -CGImageRef SurfaceImpl::GetImage() -{ - // For now, assume that GetImage can only be called on PixMap surfaces. - if (bitmapData == NULL) - return NULL; +void SurfaceImpl::FillColour(const ColourDesired &back) { + if (gc) { + ColourDesired colour(back.AsInteger()); - CGContextFlush(gc); + // Set the Fill color to match + CGContextSetRGBFillColor(gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, + colour.GetBlue() / 255.0, 1.0); + } +} - // Create an RGB color space. - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - if( colorSpace == NULL ) - return NULL; +//-------------------------------------------------------------------------------------------------- - const int bitmapBytesPerRow = ((int) bitmapWidth * BYTES_PER_PIXEL); - const int bitmapByteCount = (bitmapBytesPerRow * (int) bitmapHeight); +CGImageRef SurfaceImpl::GetImage() { + // For now, assume that GetImage can only be called on PixMap surfaces. + if (!bitmapData) + return NULL; - // Make a copy of the bitmap data for the image creation and divorce it - // From the SurfaceImpl lifetime - CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, bitmapData, bitmapByteCount); + CGContextFlush(gc); - // Create a data provider. - CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef); + // Create an RGB color space. + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + if (colorSpace == NULL) + return NULL; - CGImageRef image = NULL; - if (dataProvider != NULL) - { - // Create the CGImage. - image = CGImageCreate(bitmapWidth, - bitmapHeight, - BITS_PER_COMPONENT, - BITS_PER_PIXEL, - bitmapBytesPerRow, - colorSpace, - kCGImageAlphaPremultipliedLast, - dataProvider, - NULL, - 0, - kCGRenderingIntentDefault); - } + const int bitmapBytesPerRow = bitmapWidth * BYTES_PER_PIXEL; + const int bitmapByteCount = bitmapBytesPerRow * bitmapHeight; - // The image retains the color space, so we can release it. - CGColorSpaceRelease(colorSpace); - colorSpace = NULL; + // Make a copy of the bitmap data for the image creation and divorce it + // From the SurfaceImpl lifetime + CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, bitmapData.get(), bitmapByteCount); - // Done with the data provider. - CGDataProviderRelease(dataProvider); - dataProvider = NULL; + // Create a data provider. + CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef); - // Done with the data provider. - CFRelease(dataRef); + CGImageRef image = NULL; + if (dataProvider != NULL) { + // Create the CGImage. + image = CGImageCreate(bitmapWidth, + bitmapHeight, + BITS_PER_COMPONENT, + BITS_PER_PIXEL, + bitmapBytesPerRow, + colorSpace, + kCGImageAlphaPremultipliedLast, + dataProvider, + NULL, + 0, + kCGRenderingIntentDefault); + } - return image; + // The image retains the color space, so we can release it. + CGColorSpaceRelease(colorSpace); + colorSpace = NULL; + + // Done with the data provider. + CGDataProviderRelease(dataProvider); + dataProvider = NULL; + + // Done with the data provider. + CFRelease(dataRef); + + return image; } //-------------------------------------------------------------------------------------------------- @@ -366,9 +541,8 @@ CGImageRef SurfaceImpl::GetImage() * This is no longer called. * For Cocoa, all screens are treated as 72 DPI, even retina displays. */ -int SurfaceImpl::LogPixelsY() -{ - return 72; +int SurfaceImpl::LogPixelsY() { + return 72; } //-------------------------------------------------------------------------------------------------- @@ -377,330 +551,350 @@ int SurfaceImpl::LogPixelsY() * Converts the logical font height in points into a device height. * For Cocoa, points are always used for the result even on retina displays. */ -int SurfaceImpl::DeviceHeightFont(int points) -{ - return points; +int SurfaceImpl::DeviceHeightFont(int points) { + return points; } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::MoveTo(int x_, int y_) -{ - x = x_; - y = y_; +void SurfaceImpl::MoveTo(int x_, int y_) { + x = x_; + y = y_; } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::LineTo(int x_, int y_) -{ - CGContextBeginPath( gc ); +void SurfaceImpl::LineTo(int x_, int y_) { + CGContextBeginPath(gc); - // Because Quartz is based on floating point, lines are drawn with half their colour - // on each side of the line. Integer coordinates specify the INTERSECTION of the pixel - // division lines. If you specify exact pixel values, you get a line that - // is twice as thick but half as intense. To get pixel aligned rendering, - // we render the "middle" of the pixels by adding 0.5 to the coordinates. - CGContextMoveToPoint( gc, x + 0.5, y + 0.5 ); - CGContextAddLineToPoint( gc, x_ + 0.5, y_ + 0.5 ); - CGContextStrokePath( gc ); - x = x_; - y = y_; + // Because Quartz is based on floating point, lines are drawn with half their colour + // on each side of the line. Integer coordinates specify the INTERSECTION of the pixel + // division lines. If you specify exact pixel values, you get a line that + // is twice as thick but half as intense. To get pixel aligned rendering, + // we render the "middle" of the pixels by adding 0.5 to the coordinates. + CGContextMoveToPoint(gc, x + 0.5, y + 0.5); + CGContextAddLineToPoint(gc, x_ + 0.5, y_ + 0.5); + CGContextStrokePath(gc); + x = x_; + y = y_; } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, - ColourDesired back) -{ - // Allocate memory for the array of points. - std::vector points(npts); +void SurfaceImpl::Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, + ColourDesired back) { + // Allocate memory for the array of points. + std::vector points(npts); - for (int i = 0;i < npts;i++) - { - // Quartz floating point issues: plot the MIDDLE of the pixels - points[i].x = pts[i].x + 0.5; - points[i].y = pts[i].y + 0.5; - } + for (size_t i = 0; i < npts; i++) { + // Quartz floating point issues: plot the MIDDLE of the pixels + points[i].x = pts[i].x + 0.5; + points[i].y = pts[i].y + 0.5; + } - CGContextBeginPath(gc); + CGContextBeginPath(gc); - // Set colours - FillColour(back); - PenColour(fore); + // Set colours + FillColour(back); + PenColour(fore); - // Draw the polygon - CGContextAddLines(gc, points.data(), npts); + // Draw the polygon + CGContextAddLines(gc, points.data(), npts); - // Explicitly close the path, so it is closed for stroking AND filling (implicit close = filling only) - CGContextClosePath( gc ); - CGContextDrawPath( gc, kCGPathFillStroke ); + // Explicitly close the path, so it is closed for stroking AND filling (implicit close = filling only) + CGContextClosePath(gc); + CGContextDrawPath(gc, kCGPathFillStroke); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) -{ - if (gc) - { - CGContextBeginPath( gc ); - FillColour(back); - PenColour(fore); +void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { + if (gc) { + CGContextBeginPath(gc); + FillColour(back); + PenColour(fore); - // Quartz integer -> float point conversion fun (see comment in SurfaceImpl::LineTo) - // We subtract 1 from the Width() and Height() so that all our drawing is within the area defined - // by the PRectangle. Otherwise, we draw one pixel too far to the right and bottom. - CGContextAddRect( gc, CGRectMake( rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1 ) ); - CGContextDrawPath( gc, kCGPathFillStroke ); - } + // Quartz integer -> float point conversion fun (see comment in SurfaceImpl::LineTo) + // We subtract 1 from the Width() and Height() so that all our drawing is within the area defined + // by the PRectangle. Otherwise, we draw one pixel too far to the right and bottom. + CGContextAddRect(gc, CGRectMake(rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1)); + CGContextDrawPath(gc, kCGPathFillStroke); + } } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) -{ - if (gc) - { - FillColour(back); - // Snap rectangle boundaries to nearest int - rc.left = lround(rc.left); - rc.right = lround(rc.right); - CGRect rect = PRectangleToCGRect(rc); - CGContextFillRect(gc, rect); - } +void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { + if (gc) { + FillColour(back); + // Snap rectangle boundaries to nearest int + rc.left = lround(rc.left); + rc.right = lround(rc.right); + CGRect rect = PRectangleToCGRect(rc); + CGContextFillRect(gc, rect); + } } //-------------------------------------------------------------------------------------------------- -void drawImageRefCallback(CGImageRef pattern, CGContextRef gc) -{ - CGContextDrawImage(gc, CGRectMake(0, 0, CGImageGetWidth(pattern), CGImageGetHeight(pattern)), pattern); +static void drawImageRefCallback(void *info, CGContextRef gc) { + CGImageRef pattern = static_cast(info); + CGContextDrawImage(gc, CGRectMake(0, 0, CGImageGetWidth(pattern), CGImageGetHeight(pattern)), pattern); } //-------------------------------------------------------------------------------------------------- -void releaseImageRefCallback(CGImageRef pattern) -{ - CGImageRelease(pattern); +static void releaseImageRefCallback(void *info) { + CGImageRelease(static_cast(info)); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) -{ - SurfaceImpl& patternSurface = static_cast(surfacePattern); +void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { + SurfaceImpl &patternSurface = static_cast(surfacePattern); - // For now, assume that copy can only be called on PixMap surfaces. Shows up black. - CGImageRef image = patternSurface.GetImage(); - if (image == NULL) - { - FillRectangle(rc, ColourDesired(0)); - return; - } + // For now, assume that copy can only be called on PixMap surfaces. Shows up black. + CGImageRef image = patternSurface.GetImage(); + if (image == NULL) { + FillRectangle(rc, ColourDesired(0)); + return; + } - const CGPatternCallbacks drawImageCallbacks = { 0, - reinterpret_cast(drawImageRefCallback), - reinterpret_cast(releaseImageRefCallback) }; + const CGPatternCallbacks drawImageCallbacks = { 0, drawImageRefCallback, releaseImageRefCallback }; - CGPatternRef pattern = CGPatternCreate(image, - CGRectMake(0, 0, patternSurface.bitmapWidth, patternSurface.bitmapHeight), - CGAffineTransformIdentity, - patternSurface.bitmapWidth, - patternSurface.bitmapHeight, - kCGPatternTilingNoDistortion, - true, - &drawImageCallbacks - ); - if (pattern != NULL) - { - // Create a pattern color space - CGColorSpaceRef colorSpace = CGColorSpaceCreatePattern( NULL ); - if( colorSpace != NULL ) { + CGPatternRef pattern = CGPatternCreate(image, + CGRectMake(0, 0, patternSurface.bitmapWidth, patternSurface.bitmapHeight), + CGAffineTransformIdentity, + patternSurface.bitmapWidth, + patternSurface.bitmapHeight, + kCGPatternTilingNoDistortion, + true, + &drawImageCallbacks + ); + if (pattern != NULL) { + // Create a pattern color space + CGColorSpaceRef colorSpace = CGColorSpaceCreatePattern(NULL); + if (colorSpace != NULL) { - CGContextSaveGState( gc ); - CGContextSetFillColorSpace( gc, colorSpace ); + CGContextSaveGState(gc); + CGContextSetFillColorSpace(gc, colorSpace); - // Unlike the documentation, you MUST pass in a "components" parameter: - // For coloured patterns it is the alpha value. - const CGFloat alpha = 1.0; - CGContextSetFillPattern( gc, pattern, &alpha ); - CGContextFillRect( gc, PRectangleToCGRect( rc ) ); - CGContextRestoreGState( gc ); - // Free the color space, the pattern and image - CGColorSpaceRelease( colorSpace ); - } /* colorSpace != NULL */ - colorSpace = NULL; - CGPatternRelease( pattern ); - pattern = NULL; - } /* pattern != NULL */ + // Unlike the documentation, you MUST pass in a "components" parameter: + // For coloured patterns it is the alpha value. + const CGFloat alpha = 1.0; + CGContextSetFillPattern(gc, pattern, &alpha); + CGContextFillRect(gc, PRectangleToCGRect(rc)); + CGContextRestoreGState(gc); + // Free the color space, the pattern and image + CGColorSpaceRelease(colorSpace); + } /* colorSpace != NULL */ + colorSpace = NULL; + CGPatternRelease(pattern); + pattern = NULL; + } /* pattern != NULL */ } void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { - // This is only called from the margin marker drawing code for SC_MARK_ROUNDRECT - // The Win32 version does - // ::RoundRect(hdc, rc.left + 1, rc.top, rc.right - 1, rc.bottom, 8, 8 ); - // which is a rectangle with rounded corners each having a radius of 4 pixels. - // It would be almost as good just cutting off the corners with lines at - // 45 degrees as is done on GTK+. + // This is only called from the margin marker drawing code for SC_MARK_ROUNDRECT + // The Win32 version does + // ::RoundRect(hdc, rc.left + 1, rc.top, rc.right - 1, rc.bottom, 8, 8 ); + // which is a rectangle with rounded corners each having a radius of 4 pixels. + // It would be almost as good just cutting off the corners with lines at + // 45 degrees as is done on GTK+. - // Create a rectangle with semicircles at the corners - const int MAX_RADIUS = 4; - const int radius = std::min(MAX_RADIUS, static_cast(std::min(rc.Height()/2, rc.Width()/2))); + // Create a rectangle with semicircles at the corners + const int MAX_RADIUS = 4; + const int radius = std::min(MAX_RADIUS, static_cast(std::min(rc.Height()/2, rc.Width()/2))); - // Points go clockwise, starting from just below the top left - // Corners are kept together, so we can easily create arcs to connect them - CGPoint corners[4][3] = - { - { - { rc.left, rc.top + radius }, - { rc.left, rc.top }, - { rc.left + radius, rc.top }, - }, - { - { rc.right - radius - 1, rc.top }, - { rc.right - 1, rc.top }, - { rc.right - 1, rc.top + radius }, - }, - { - { rc.right - 1, rc.bottom - radius - 1 }, - { rc.right - 1, rc.bottom - 1 }, - { rc.right - radius - 1, rc.bottom - 1 }, - }, - { - { rc.left + radius, rc.bottom - 1 }, - { rc.left, rc.bottom - 1 }, - { rc.left, rc.bottom - radius - 1 }, - }, - }; + // Points go clockwise, starting from just below the top left + // Corners are kept together, so we can easily create arcs to connect them + CGPoint corners[4][3] = { + { + { rc.left, rc.top + radius }, + { rc.left, rc.top }, + { rc.left + radius, rc.top }, + }, + { + { rc.right - radius - 1, rc.top }, + { rc.right - 1, rc.top }, + { rc.right - 1, rc.top + radius }, + }, + { + { rc.right - 1, rc.bottom - radius - 1 }, + { rc.right - 1, rc.bottom - 1 }, + { rc.right - radius - 1, rc.bottom - 1 }, + }, + { + { rc.left + radius, rc.bottom - 1 }, + { rc.left, rc.bottom - 1 }, + { rc.left, rc.bottom - radius - 1 }, + }, + }; - // Align the points in the middle of the pixels - for( int i = 0; i < 4; ++ i ) - { - for( int j = 0; j < 3; ++ j ) - { - corners[i][j].x += 0.5; - corners[i][j].y += 0.5; - } - } + // Align the points in the middle of the pixels + for (int i = 0; i < 4; ++ i) { + for (int j = 0; j < 3; ++ j) { + corners[i][j].x += 0.5; + corners[i][j].y += 0.5; + } + } - PenColour( fore ); - FillColour( back ); + PenColour(fore); + FillColour(back); - // Move to the last point to begin the path - CGContextBeginPath( gc ); - CGContextMoveToPoint( gc, corners[3][2].x, corners[3][2].y ); + // Move to the last point to begin the path + CGContextBeginPath(gc); + CGContextMoveToPoint(gc, corners[3][2].x, corners[3][2].y); - for ( int i = 0; i < 4; ++ i ) - { - CGContextAddLineToPoint( gc, corners[i][0].x, corners[i][0].y ); - CGContextAddArcToPoint( gc, corners[i][1].x, corners[i][1].y, corners[i][2].x, corners[i][2].y, radius ); - } + for (int i = 0; i < 4; ++ i) { + CGContextAddLineToPoint(gc, corners[i][0].x, corners[i][0].y); + CGContextAddArcToPoint(gc, corners[i][1].x, corners[i][1].y, corners[i][2].x, corners[i][2].y, radius); + } - // Close the path to enclose it for stroking and for filling, then draw it - CGContextClosePath( gc ); - CGContextDrawPath( gc, kCGPathFillStroke ); + // Close the path to enclose it for stroking and for filling, then draw it + CGContextClosePath(gc); + CGContextDrawPath(gc, kCGPathFillStroke); } // DrawChamferedRectangle is a helper function for AlphaRectangle that either fills or strokes a // rectangle with its corners chamfered at 45 degrees. static void DrawChamferedRectangle(CGContextRef gc, PRectangle rc, int cornerSize, CGPathDrawingMode mode) { - // Points go clockwise, starting from just below the top left - CGPoint corners[4][2] = - { - { - { rc.left, rc.top + cornerSize }, - { rc.left + cornerSize, rc.top }, - }, - { - { rc.right - cornerSize - 1, rc.top }, - { rc.right - 1, rc.top + cornerSize }, - }, - { - { rc.right - 1, rc.bottom - cornerSize - 1 }, - { rc.right - cornerSize - 1, rc.bottom - 1 }, - }, - { - { rc.left + cornerSize, rc.bottom - 1 }, - { rc.left, rc.bottom - cornerSize - 1 }, - }, - }; + // Points go clockwise, starting from just below the top left + CGPoint corners[4][2] = { + { + { rc.left, rc.top + cornerSize }, + { rc.left + cornerSize, rc.top }, + }, + { + { rc.right - cornerSize - 1, rc.top }, + { rc.right - 1, rc.top + cornerSize }, + }, + { + { rc.right - 1, rc.bottom - cornerSize - 1 }, + { rc.right - cornerSize - 1, rc.bottom - 1 }, + }, + { + { rc.left + cornerSize, rc.bottom - 1 }, + { rc.left, rc.bottom - cornerSize - 1 }, + }, + }; - // Align the points in the middle of the pixels - for( int i = 0; i < 4; ++ i ) - { - for( int j = 0; j < 2; ++ j ) - { - corners[i][j].x += 0.5; - corners[i][j].y += 0.5; - } - } + // Align the points in the middle of the pixels + for (int i = 0; i < 4; ++ i) { + for (int j = 0; j < 2; ++ j) { + corners[i][j].x += 0.5; + corners[i][j].y += 0.5; + } + } - // Move to the last point to begin the path - CGContextBeginPath( gc ); - CGContextMoveToPoint( gc, corners[3][1].x, corners[3][1].y ); + // Move to the last point to begin the path + CGContextBeginPath(gc); + CGContextMoveToPoint(gc, corners[3][1].x, corners[3][1].y); - for ( int i = 0; i < 4; ++ i ) - { - CGContextAddLineToPoint( gc, corners[i][0].x, corners[i][0].y ); - CGContextAddLineToPoint( gc, corners[i][1].x, corners[i][1].y ); - } + for (int i = 0; i < 4; ++ i) { + CGContextAddLineToPoint(gc, corners[i][0].x, corners[i][0].y); + CGContextAddLineToPoint(gc, corners[i][1].x, corners[i][1].y); + } - // Close the path to enclose it for stroking and for filling, then draw it - CGContextClosePath( gc ); - CGContextDrawPath( gc, mode ); + // Close the path to enclose it for stroking and for filling, then draw it + CGContextClosePath(gc); + CGContextDrawPath(gc, mode); } void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, - ColourDesired outline, int alphaOutline, int /*flags*/) -{ - if ( gc ) { - // Snap rectangle boundaries to nearest int - rc.left = lround(rc.left); - rc.right = lround(rc.right); - // Set the Fill color to match - CGContextSetRGBFillColor( gc, fill.GetRed() / 255.0, fill.GetGreen() / 255.0, fill.GetBlue() / 255.0, alphaFill / 255.0 ); - CGContextSetRGBStrokeColor( gc, outline.GetRed() / 255.0, outline.GetGreen() / 255.0, outline.GetBlue() / 255.0, alphaOutline / 255.0 ); - PRectangle rcFill = rc; - if (cornerSize == 0) { - // A simple rectangle, no rounded corners - if ((fill == outline) && (alphaFill == alphaOutline)) { - // Optimization for simple case - CGRect rect = PRectangleToCGRect( rcFill ); - CGContextFillRect( gc, rect ); - } else { - rcFill.left += 1.0; - rcFill.top += 1.0; - rcFill.right -= 1.0; - rcFill.bottom -= 1.0; - CGRect rect = PRectangleToCGRect( rcFill ); - CGContextFillRect( gc, rect ); - CGContextAddRect( gc, CGRectMake( rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1 ) ); - CGContextStrokePath( gc ); - } - } else { - // Approximate rounded corners with 45 degree chamfers. - // Drawing real circular arcs often leaves some over- or under-drawn pixels. - if ((fill == outline) && (alphaFill == alphaOutline)) { - // Specializing this case avoids a few stray light/dark pixels in corners. - rcFill.left -= 0.5; - rcFill.top -= 0.5; - rcFill.right += 0.5; - rcFill.bottom += 0.5; - DrawChamferedRectangle( gc, rcFill, cornerSize, kCGPathFill ); - } else { - rcFill.left += 0.5; - rcFill.top += 0.5; - rcFill.right -= 0.5; - rcFill.bottom -= 0.5; - DrawChamferedRectangle( gc, rcFill, cornerSize-1, kCGPathFill ); - DrawChamferedRectangle( gc, rc, cornerSize, kCGPathStroke ); - } - } - } + ColourDesired outline, int alphaOutline, int /*flags*/) { + if (gc) { + // Snap rectangle boundaries to nearest int + rc.left = lround(rc.left); + rc.right = lround(rc.right); + // Set the Fill color to match + CGContextSetRGBFillColor(gc, fill.GetRed() / 255.0, fill.GetGreen() / 255.0, fill.GetBlue() / 255.0, alphaFill / 255.0); + CGContextSetRGBStrokeColor(gc, outline.GetRed() / 255.0, outline.GetGreen() / 255.0, outline.GetBlue() / 255.0, alphaOutline / 255.0); + PRectangle rcFill = rc; + if (cornerSize == 0) { + // A simple rectangle, no rounded corners + if ((fill == outline) && (alphaFill == alphaOutline)) { + // Optimization for simple case + CGRect rect = PRectangleToCGRect(rcFill); + CGContextFillRect(gc, rect); + } else { + rcFill.left += 1.0; + rcFill.top += 1.0; + rcFill.right -= 1.0; + rcFill.bottom -= 1.0; + CGRect rect = PRectangleToCGRect(rcFill); + CGContextFillRect(gc, rect); + CGContextAddRect(gc, CGRectMake(rc.left + 0.5, rc.top + 0.5, rc.Width() - 1, rc.Height() - 1)); + CGContextStrokePath(gc); + } + } else { + // Approximate rounded corners with 45 degree chamfers. + // Drawing real circular arcs often leaves some over- or under-drawn pixels. + if ((fill == outline) && (alphaFill == alphaOutline)) { + // Specializing this case avoids a few stray light/dark pixels in corners. + rcFill.left -= 0.5; + rcFill.top -= 0.5; + rcFill.right += 0.5; + rcFill.bottom += 0.5; + DrawChamferedRectangle(gc, rcFill, cornerSize, kCGPathFill); + } else { + rcFill.left += 0.5; + rcFill.top += 0.5; + rcFill.right -= 0.5; + rcFill.bottom -= 0.5; + DrawChamferedRectangle(gc, rcFill, cornerSize-1, kCGPathFill); + DrawChamferedRectangle(gc, rc, cornerSize, kCGPathStroke); + } + } + } +} + +void Scintilla::SurfaceImpl::GradientRectangle(PRectangle rc, const std::vector &stops, GradientOptions options) { + if (!gc) { + return; + } + + CGPoint ptStart = CGPointMake(rc.left, rc.top); + CGPoint ptEnd = CGPointMake(rc.left, rc.bottom); + if (options == GradientOptions::leftToRight) { + ptEnd = CGPointMake(rc.right, rc.top); + } + + std::vector components; + std::vector locations; + for (const ColourStop &stop : stops) { + locations.push_back(stop.position); + components.push_back(stop.colour.GetRedComponent()); + components.push_back(stop.colour.GetGreenComponent()); + components.push_back(stop.colour.GetBlueComponent()); + components.push_back(stop.colour.GetAlphaComponent()); + } + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + if (!colorSpace) { + return; + } + + CGGradientRef gradiantRef = CGGradientCreateWithColorComponents(colorSpace, + components.data(), + locations.data(), + locations.size()); + if (gradiantRef) { + CGContextSaveGState(gc); + CGRect rect = PRectangleToCGRect(rc); + CGContextClipToRect(gc, rect); + CGContextBeginPath(gc); + CGContextAddRect(gc, rect); + CGContextClosePath(gc); + CGContextDrawLinearGradient(gc, gradiantRef, ptStart, ptEnd, 0); + CGGradientRelease(gradiantRef); + CGContextRestoreGState(gc); + } + CGColorSpaceRelease(colorSpace); } static void ProviderReleaseData(void *, const void *data, size_t) { - const unsigned char *pixels = reinterpret_cast(data); + const unsigned char *pixels = static_cast(data); delete []pixels; } @@ -710,8 +904,8 @@ static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char // Create an RGB color space. CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); if (colorSpace) { - const int bitmapBytesPerRow = ((int) width * 4); - const int bitmapByteCount = (bitmapBytesPerRow * (int) height); + const int bitmapBytesPerRow = width * 4; + const int bitmapByteCount = bitmapBytesPerRow * height; // Create a data provider. CGDataProviderRef dataProvider = 0; @@ -726,25 +920,25 @@ static CGImageRef ImageCreateFromRGBA(int width, int height, const unsigned char } dataProvider = CGDataProviderCreateWithData( - NULL, pixelsUpsideDown, bitmapByteCount, ProviderReleaseData); + NULL, pixelsUpsideDown, bitmapByteCount, ProviderReleaseData); } else { dataProvider = CGDataProviderCreateWithData( - NULL, pixelsImage, bitmapByteCount, NULL); + NULL, pixelsImage, bitmapByteCount, NULL); } if (dataProvider) { // Create the CGImage. image = CGImageCreate(width, - height, - 8, - 8 * 4, - bitmapBytesPerRow, - colorSpace, - kCGImageAlphaLast, - dataProvider, - NULL, - 0, - kCGRenderingIntentDefault); + height, + 8, + 8 * 4, + bitmapBytesPerRow, + colorSpace, + kCGImageAlphaLast, + dataProvider, + NULL, + 0, + kCGRenderingIntentDefault); CGDataProviderRelease(dataProvider); } @@ -765,203 +959,202 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi } void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { - CGRect ellipseRect = CGRectMake(rc.left, rc.top, rc.Width(), rc.Height()); - FillColour(back); - PenColour(fore); - CGContextBeginPath(gc); - CGContextAddEllipseInRect(gc, ellipseRect); - CGContextDrawPath(gc, kCGPathFillStroke); + CGRect ellipseRect = CGRectMake(rc.left, rc.top, rc.Width(), rc.Height()); + FillColour(back); + PenColour(fore); + CGContextBeginPath(gc); + CGContextAddEllipseInRect(gc, ellipseRect); + CGContextDrawPath(gc, kCGPathFillStroke); } -void SurfaceImpl::CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect) -{ - SurfaceImpl& source = static_cast(surfaceSource); - CGImageRef image = source.GetImage(); +void SurfaceImpl::CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect) { + SurfaceImpl &source = static_cast(surfaceSource); + CGImageRef image = source.GetImage(); - CGRect src = PRectangleToCGRect(srcRect); - CGRect dst = PRectangleToCGRect(dstRect); + CGRect src = PRectangleToCGRect(srcRect); + CGRect dst = PRectangleToCGRect(dstRect); - /* source from QuickDrawToQuartz2D.pdf on developer.apple.com */ - float w = (float) CGImageGetWidth(image); - float h = (float) CGImageGetHeight(image); - CGRect drawRect = CGRectMake (0, 0, w, h); - if (!CGRectEqualToRect (src, dst)) - { - CGFloat sx = CGRectGetWidth(dst) / CGRectGetWidth(src); - CGFloat sy = CGRectGetHeight(dst) / CGRectGetHeight(src); - CGFloat dx = CGRectGetMinX(dst) - (CGRectGetMinX(src) * sx); - CGFloat dy = CGRectGetMinY(dst) - (CGRectGetMinY(src) * sy); - drawRect = CGRectMake (dx, dy, w*sx, h*sy); - } - CGContextSaveGState (gc); - CGContextClipToRect (gc, dst); - CGContextDrawImage (gc, drawRect, image); - CGContextRestoreGState (gc); - CGImageRelease(image); + /* source from QuickDrawToQuartz2D.pdf on developer.apple.com */ + const float w = static_cast(CGImageGetWidth(image)); + const float h = static_cast(CGImageGetHeight(image)); + CGRect drawRect = CGRectMake(0, 0, w, h); + if (!CGRectEqualToRect(src, dst)) { + CGFloat sx = CGRectGetWidth(dst) / CGRectGetWidth(src); + CGFloat sy = CGRectGetHeight(dst) / CGRectGetHeight(src); + CGFloat dx = CGRectGetMinX(dst) - (CGRectGetMinX(src) * sx); + CGFloat dy = CGRectGetMinY(dst) - (CGRectGetMinY(src) * sy); + drawRect = CGRectMake(dx, dy, w*sx, h*sy); + } + CGContextSaveGState(gc); + CGContextClipToRect(gc, dst); + CGContextDrawImage(gc, drawRect, image); + CGContextRestoreGState(gc); + CGImageRelease(image); } void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) { - // Maybe we have to make the Surface two contexts: - // a bitmap context which we do all the drawing on, and then a "real" context - // which we copy the output to when we call "Synchronize". Ugh! Gross and slow! + // Maybe we have to make the Surface two contexts: + // a bitmap context which we do all the drawing on, and then a "real" context + // which we copy the output to when we call "Synchronize". Ugh! Gross and slow! - // For now, assume that copy can only be called on PixMap surfaces - SurfaceImpl& source = static_cast(surfaceSource); + // For now, assume that copy can only be called on PixMap surfaces + SurfaceImpl &source = static_cast(surfaceSource); - // Get the CGImageRef - CGImageRef image = source.GetImage(); - // If we could not get an image reference, fill the rectangle black - if ( image == NULL ) - { - FillRectangle( rc, ColourDesired( 0 ) ); - return; - } + // Get the CGImageRef + CGImageRef image = source.GetImage(); + // If we could not get an image reference, fill the rectangle black + if (image == NULL) { + FillRectangle(rc, ColourDesired(0)); + return; + } - // Now draw the image on the surface + // Now draw the image on the surface - // Some fancy clipping work is required here: draw only inside of rc - CGContextSaveGState( gc ); - CGContextClipToRect( gc, PRectangleToCGRect( rc ) ); + // Some fancy clipping work is required here: draw only inside of rc + CGContextSaveGState(gc); + CGContextClipToRect(gc, PRectangleToCGRect(rc)); - //Platform::DebugPrintf(stderr, "Copy: CGContextDrawImage: (%d, %d) - (%d X %d)\n", rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight ); - CGContextDrawImage( gc, CGRectMake( rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight ), image ); + //Platform::DebugPrintf(stderr, "Copy: CGContextDrawImage: (%d, %d) - (%d X %d)\n", rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight ); + CGContextDrawImage(gc, CGRectMake(rc.left - from.x, rc.top - from.y, source.bitmapWidth, source.bitmapHeight), image); - // Undo the clipping fun - CGContextRestoreGState( gc ); + // Undo the clipping fun + CGContextRestoreGState(gc); - // Done with the image - CGImageRelease( image ); - image = NULL; + // Done with the image + CGImageRelease(image); + image = NULL; } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourDesired fore, ColourDesired back) -{ - FillRectangle(rc, back); - DrawTextTransparent(rc, font_, ybase, s, len, fore); +// Bidirectional text support for Arabic and Hebrew. + +std::unique_ptr SurfaceImpl::Layout(const IScreenLine *screenLine) { + return std::make_unique(screenLine); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourDesired fore, ColourDesired back) -{ - CGContextSaveGState(gc); - CGContextClipToRect(gc, PRectangleToCGRect(rc)); - DrawTextNoClip(rc, font_, ybase, s, len, fore, back); - CGContextRestoreGState(gc); +void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, + ColourDesired fore, ColourDesired back) { + FillRectangle(rc, back); + DrawTextTransparent(rc, font_, ybase, text, fore); } //-------------------------------------------------------------------------------------------------- -CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) -{ - if (unicode) - return kCFStringEncodingUTF8; - - // Unsupported -> Latin1 as reasonably safe - enum { notSupported = kCFStringEncodingISOLatin1}; - - switch (characterSet) - { - case SC_CHARSET_ANSI: - return kCFStringEncodingISOLatin1; - case SC_CHARSET_DEFAULT: - return kCFStringEncodingISOLatin1; - case SC_CHARSET_BALTIC: - return kCFStringEncodingWindowsBalticRim; - case SC_CHARSET_CHINESEBIG5: - return kCFStringEncodingBig5; - case SC_CHARSET_EASTEUROPE: - return kCFStringEncodingWindowsLatin2; - case SC_CHARSET_GB2312: - return kCFStringEncodingGB_18030_2000; - case SC_CHARSET_GREEK: - return kCFStringEncodingWindowsGreek; - case SC_CHARSET_HANGUL: - return kCFStringEncodingEUC_KR; - case SC_CHARSET_MAC: - return kCFStringEncodingMacRoman; - case SC_CHARSET_OEM: - return kCFStringEncodingISOLatin1; - case SC_CHARSET_RUSSIAN: - return kCFStringEncodingKOI8_R; - case SC_CHARSET_CYRILLIC: - return kCFStringEncodingWindowsCyrillic; - case SC_CHARSET_SHIFTJIS: - return kCFStringEncodingShiftJIS; - case SC_CHARSET_SYMBOL: - return kCFStringEncodingMacSymbol; - case SC_CHARSET_TURKISH: - return kCFStringEncodingWindowsLatin5; - case SC_CHARSET_JOHAB: - return kCFStringEncodingWindowsKoreanJohab; - case SC_CHARSET_HEBREW: - return kCFStringEncodingWindowsHebrew; - case SC_CHARSET_ARABIC: - return kCFStringEncodingWindowsArabic; - case SC_CHARSET_VIETNAMESE: - return kCFStringEncodingWindowsVietnamese; - case SC_CHARSET_THAI: - return kCFStringEncodingISOLatinThai; - case SC_CHARSET_8859_15: - return kCFStringEncodingISOLatin1; - default: - return notSupported; - } +void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, + ColourDesired fore, ColourDesired back) { + CGContextSaveGState(gc); + CGContextClipToRect(gc, PRectangleToCGRect(rc)); + DrawTextNoClip(rc, font_, ybase, text, fore, back); + CGContextRestoreGState(gc); } -void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourDesired fore) -{ +//-------------------------------------------------------------------------------------------------- + +CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) { + if (unicode) + return kCFStringEncodingUTF8; + + // Unsupported -> Latin1 as reasonably safe + enum { notSupported = kCFStringEncodingISOLatin1}; + + switch (characterSet) { + case SC_CHARSET_ANSI: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_DEFAULT: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_BALTIC: + return kCFStringEncodingWindowsBalticRim; + case SC_CHARSET_CHINESEBIG5: + return kCFStringEncodingBig5; + case SC_CHARSET_EASTEUROPE: + return kCFStringEncodingWindowsLatin2; + case SC_CHARSET_GB2312: + return kCFStringEncodingGB_18030_2000; + case SC_CHARSET_GREEK: + return kCFStringEncodingWindowsGreek; + case SC_CHARSET_HANGUL: + return kCFStringEncodingEUC_KR; + case SC_CHARSET_MAC: + return kCFStringEncodingMacRoman; + case SC_CHARSET_OEM: + return kCFStringEncodingISOLatin1; + case SC_CHARSET_RUSSIAN: + return kCFStringEncodingKOI8_R; + case SC_CHARSET_CYRILLIC: + return kCFStringEncodingWindowsCyrillic; + case SC_CHARSET_SHIFTJIS: + return kCFStringEncodingShiftJIS; + case SC_CHARSET_SYMBOL: + return kCFStringEncodingMacSymbol; + case SC_CHARSET_TURKISH: + return kCFStringEncodingWindowsLatin5; + case SC_CHARSET_JOHAB: + return kCFStringEncodingWindowsKoreanJohab; + case SC_CHARSET_HEBREW: + return kCFStringEncodingWindowsHebrew; + case SC_CHARSET_ARABIC: + return kCFStringEncodingWindowsArabic; + case SC_CHARSET_VIETNAMESE: + return kCFStringEncodingWindowsVietnamese; + case SC_CHARSET_THAI: + return kCFStringEncodingISOLatinThai; + case SC_CHARSET_8859_15: + return kCFStringEncodingISOLatin1; + default: + return notSupported; + } +} + +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, + ColourDesired fore) { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); - ColourDesired colour(fore.AsLong()); - CGColorRef color = CGColorCreateGenericRGB(colour.GetRed()/255.0,colour.GetGreen()/255.0,colour.GetBlue()/255.0,1.0); + ColourDesired colour(fore.AsInteger()); + CGColorRef color = CGColorCreateGenericRGB(colour.GetRed()/255.0, colour.GetGreen()/255.0, colour.GetBlue()/255.0, 1.0); - QuartzTextStyle* style = reinterpret_cast(font_.GetID()); + QuartzTextStyle *style = TextStyleFromFont(font_); style->setCTStyleColor(color); CGColorRelease(color); - textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); - textLayout->draw(rc.left, ybase); -} - -static size_t utf8LengthFromLead(unsigned char uch) { - if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) { - return 4; - } else if (uch >= (0x80 + 0x40 + 0x20)) { - return 3; - } else if (uch >= (0x80)) { - return 2; - } else { - return 1; - } + textLayout->setText(text, encoding, *style); + textLayout->draw(gc, rc.left, ybase); } //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) -{ +void SurfaceImpl::MeasureWidths(Font &font_, std::string_view text, XYPOSITION *positions) { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); - textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); + const CFStringEncoding encodingUsed = + textLayout->setText(text, encoding, *TextStyleFromFont(font_)); CTLineRef mLine = textLayout->getCTLine(); - assert(mLine != NULL); + assert(mLine); + + if (encodingUsed != encoding) { + // Switched to MacRoman to make work so treat as single byte encoding. + for (int i=0; i(xPosition); + } + return; + } if (unicodeMode) { // Map the widths given for UTF-16 characters back onto the UTF-8 input string CFIndex fit = textLayout->getStringLength(); int ui=0; - const unsigned char *us = reinterpret_cast(s); int i=0; + std::vector linePositions(fit); + GetPositions(mLine, linePositions); while (ui(xPosition); } ui += codeUnits; @@ -969,21 +1162,21 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION XYPOSITION lastPos = 0.0f; if (i > 0) lastPos = positions[i-1]; - while (i(xPosition); } ui++; } } else { // Single byte encoding - for (int i=0;i(xPosition); } @@ -991,63 +1184,40 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION } -XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) { - if (font_.GetID()) - { - CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); - textLayout->setText (reinterpret_cast(s), len, encoding, *reinterpret_cast(font_.GetID())); +XYPOSITION SurfaceImpl::WidthText(Font &font_, std::string_view text) { + if (font_.GetID()) { + CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); + textLayout->setText(text, encoding, *TextStyleFromFont(font_)); - return static_cast(textLayout->MeasureStringWidth()); - } - return 1; -} - -XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) { - char str[2] = { ch, '\0' }; - if (font_.GetID()) - { - CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); - textLayout->setText (reinterpret_cast(str), 1, encoding, *reinterpret_cast(font_.GetID())); - - return textLayout->MeasureStringWidth(); - } - else - return 1; + return static_cast(textLayout->MeasureStringWidth()); + } + return 1; } // This string contains a good range of characters to test for size. const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890" -"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; XYPOSITION SurfaceImpl::Ascent(Font &font_) { - if (!font_.GetID()) - return 1; + if (!font_.GetID()) + return 1; - float ascent = reinterpret_cast( font_.GetID() )->getAscent(); + float ascent = TextStyleFromFont(font_)->getAscent(); return ascent + 0.5f; } XYPOSITION SurfaceImpl::Descent(Font &font_) { - if (!font_.GetID()) - return 1; + if (!font_.GetID()) + return 1; - float descent = reinterpret_cast( font_.GetID() )->getDescent(); + float descent = TextStyleFromFont(font_)->getDescent(); return descent + 0.5f; } XYPOSITION SurfaceImpl::InternalLeading(Font &) { - return 0; -} - -XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) { - if (!font_.GetID()) - return 1; - - float leading = reinterpret_cast( font_.GetID() )->getLeading(); - return leading + 0.5f; - + return 0; } XYPOSITION SurfaceImpl::Height(Font &font_) { @@ -1057,35 +1227,36 @@ XYPOSITION SurfaceImpl::Height(Font &font_) { XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { - if (!font_.GetID()) - return 1; + if (!font_.GetID()) + return 1; - const int sizeStringLength = ELEMENTS( sizeString ); - XYPOSITION width = WidthText( font_, sizeString, sizeStringLength ); + XYPOSITION width = WidthText(font_, sizeString); - return (int) ((width / (float) sizeStringLength) + 0.5); + return round(width / strlen(sizeString)); } void SurfaceImpl::SetClip(PRectangle rc) { - CGContextClipToRect( gc, PRectangleToCGRect( rc ) ); + CGContextClipToRect(gc, PRectangleToCGRect(rc)); } void SurfaceImpl::FlushCachedState() { - CGContextSynchronize( gc ); + CGContextSynchronize(gc); } void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) { - unicodeMode = unicodeMode_; + unicodeMode = unicodeMode_; } void SurfaceImpl::SetDBCSMode(int codePage_) { - if (codePage_ && (codePage_ != SC_CP_UTF8)) - codePage = codePage_; + if (codePage_ && (codePage_ != SC_CP_UTF8)) + codePage = codePage_; } -Surface *Surface::Allocate(int) -{ - return new SurfaceImpl(); +void SurfaceImpl::SetBidiR2L(bool) { +} + +Surface *Surface::Allocate(int) { + return new SurfaceImpl(); } //----------------- Window ------------------------------------------------------------------------- @@ -1094,131 +1265,101 @@ Surface *Surface::Allocate(int) // be either an NSWindow or NSView and the code will check the type // before performing an action. -Window::~Window() -{ +Window::~Window() { } // Window::Destroy needs to see definition of ListBoxImpl so is located after ListBoxImpl //-------------------------------------------------------------------------------------------------- -bool Window::HasFocus() -{ - NSView* container = reinterpret_cast(wid); - return [[container window] firstResponder] == container; +static CGFloat ScreenMax() { + return NSMaxY([NSScreen mainScreen].frame); } //-------------------------------------------------------------------------------------------------- -static CGFloat ScreenMax(NSWindow* win) -{ - return NSMaxY([[NSScreen mainScreen] frame]); +PRectangle Window::GetPosition() const { + if (wid) { + NSRect rect; + id idWin = (__bridge id)(wid); + NSWindow *win; + if ([idWin isKindOfClass: [NSView class]]) { + // NSView + NSView *view = idWin; + win = view.window; + rect = [view convertRect: view.bounds toView: nil]; + rect = [win convertRectToScreen: rect]; + } else { + // NSWindow + win = idWin; + rect = win.frame; + } + CGFloat screenHeight = ScreenMax(); + // Invert screen positions to match Scintilla + return PRectangle( + static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), + static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); + } else { + return PRectangle(0, 0, 1, 1); + } } //-------------------------------------------------------------------------------------------------- -PRectangle Window::GetPosition() -{ - if (wid) - { - NSRect rect; - id idWin = reinterpret_cast(wid); - NSWindow* win; - if ([idWin isKindOfClass: [NSView class]]) - { - // NSView - NSView* view = reinterpret_cast(idWin); - win = [view window]; - rect = [view convertRect: [view bounds] toView: nil]; - rect = [win convertRectToScreen:rect]; - } - else - { - // NSWindow - win = reinterpret_cast(idWin); - rect = [win frame]; - } - CGFloat screenHeight = ScreenMax(win); - // Invert screen positions to match Scintilla - return PRectangle( - static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), - static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); - } - else - { - return PRectangle(0, 0, 1, 1); - } +void Window::SetPosition(PRectangle rc) { + if (wid) { + id idWin = (__bridge id)(wid); + if ([idWin isKindOfClass: [NSView class]]) { + // NSView + // Moves this view inside the parent view + NSRect nsrc = NSMakeRect(rc.left, rc.bottom, rc.Width(), rc.Height()); + NSView *view = idWin; + nsrc = [view.window convertRectFromScreen: nsrc]; + view.frame = nsrc; + } else { + // NSWindow + PLATFORM_ASSERT([idWin isKindOfClass: [NSWindow class]]); + NSWindow *win = idWin; + CGFloat screenHeight = ScreenMax(); + NSRect nsrc = NSMakeRect(rc.left, screenHeight - rc.bottom, + rc.Width(), rc.Height()); + [win setFrame: nsrc display: YES]; + } + } } //-------------------------------------------------------------------------------------------------- -void Window::SetPosition(PRectangle rc) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSView class]]) - { - // NSView - // Moves this view inside the parent view - NSRect nsrc = NSMakeRect(rc.left, rc.bottom, rc.Width(), rc.Height()); - NSView* view = reinterpret_cast(idWin); - nsrc = [[view window] convertRectFromScreen:nsrc]; - [view setFrame: nsrc]; - } - else - { - // NSWindow - PLATFORM_ASSERT([idWin isKindOfClass: [NSWindow class]]); - NSWindow* win = reinterpret_cast(idWin); - CGFloat screenHeight = ScreenMax(win); - NSRect nsrc = NSMakeRect(rc.left, screenHeight - rc.bottom, - rc.Width(), rc.Height()); - [win setFrame: nsrc display:YES]; - } - } +void Window::SetPositionRelative(PRectangle rc, const Window *window) { + PRectangle rcOther = window->GetPosition(); + rc.left += rcOther.left; + rc.right += rcOther.left; + rc.top += rcOther.top; + rc.bottom += rcOther.top; + SetPosition(rc); } //-------------------------------------------------------------------------------------------------- -void Window::SetPositionRelative(PRectangle rc, Window window) -{ - PRectangle rcOther = window.GetPosition(); - rc.left += rcOther.left; - rc.right += rcOther.left; - rc.top += rcOther.top; - rc.bottom += rcOther.top; - SetPosition(rc); +PRectangle Window::GetClientPosition() const { + // This means, in MacOS X terms, get the "frame bounds". Call GetPosition, just like on Win32. + return GetPosition(); } //-------------------------------------------------------------------------------------------------- -PRectangle Window::GetClientPosition() -{ - // This means, in MacOS X terms, get the "frame bounds". Call GetPosition, just like on Win32. - return GetPosition(); -} - -//-------------------------------------------------------------------------------------------------- - -void Window::Show(bool show) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSWindow class]]) - { - NSWindow* win = reinterpret_cast(idWin); - if (show) - { - [win orderFront:nil]; - } - else - { - [win orderOut:nil]; - } - } - } +void Window::Show(bool show) { + if (wid) { + id idWin = (__bridge id)(wid); + if ([idWin isKindOfClass: [NSWindow class]]) { + NSWindow *win = idWin; + if (show) { + [win orderFront: nil]; + } else { + [win orderOut: nil]; + } + } + } } //-------------------------------------------------------------------------------------------------- @@ -1226,25 +1367,20 @@ void Window::Show(bool show) /** * Invalidates the entire window or view so it is completely redrawn. */ -void Window::InvalidateAll() -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - NSView* container; - if ([idWin isKindOfClass: [NSView class]]) - { - container = reinterpret_cast(idWin); - } - else - { - // NSWindow - NSWindow* win = reinterpret_cast(idWin); - container = reinterpret_cast([win contentView]); - container.needsDisplay = YES; - } - container.needsDisplay = YES; - } +void Window::InvalidateAll() { + if (wid) { + id idWin = (__bridge id)(wid); + NSView *container; + if ([idWin isKindOfClass: [NSView class]]) { + container = idWin; + } else { + // NSWindow + NSWindow *win = idWin; + container = win.contentView; + container.needsDisplay = YES; + } + container.needsDisplay = YES; + } } //-------------------------------------------------------------------------------------------------- @@ -1252,31 +1388,25 @@ void Window::InvalidateAll() /** * Invalidates part of the window or view so only this part redrawn. */ -void Window::InvalidateRectangle(PRectangle rc) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - NSView* container; - if ([idWin isKindOfClass: [NSView class]]) - { - container = reinterpret_cast(idWin); - } - else - { - // NSWindow - NSWindow* win = reinterpret_cast(idWin); - container = reinterpret_cast([win contentView]); - } - [container setNeedsDisplayInRect: PRectangleToNSRect(rc)]; - } +void Window::InvalidateRectangle(PRectangle rc) { + if (wid) { + id idWin = (__bridge id)(wid); + NSView *container; + if ([idWin isKindOfClass: [NSView class]]) { + container = idWin; + } else { + // NSWindow + NSWindow *win = idWin; + container = win.contentView; + } + [container setNeedsDisplayInRect: PRectangleToNSRect(rc)]; + } } //-------------------------------------------------------------------------------------------------- -void Window::SetFont(Font&) -{ - // Implemented on list subclass on Cocoa. +void Window::SetFont(Font &) { + // Implemented on list subclass on Cocoa. } //-------------------------------------------------------------------------------------------------- @@ -1285,86 +1415,66 @@ void Window::SetFont(Font&) * Converts the Scintilla cursor enum into an NSCursor and stores it in the associated NSView, * which then will take care to set up a new mouse tracking rectangle. */ -void Window::SetCursor(Cursor curs) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isMemberOfClass: [SCIContentView class]]) - { - SCIContentView* container = reinterpret_cast(idWin); - [container setCursor: curs]; - } - } +void Window::SetCursor(Cursor curs) { + if (wid) { + id idWin = (__bridge id)(wid); + if ([idWin isKindOfClass: [SCIContentView class]]) { + SCIContentView *container = idWin; + [container setCursor: curs]; + } + } } //-------------------------------------------------------------------------------------------------- -void Window::SetTitle(const char* s) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSWindow class]]) - { - NSWindow* win = reinterpret_cast(idWin); - NSString* sTitle = [NSString stringWithUTF8String:s]; - [win setTitle:sTitle]; - } - } -} +PRectangle Window::GetMonitorRect(Point) { + if (wid) { + id idWin = (__bridge id)(wid); + if ([idWin isKindOfClass: [NSView class]]) { + NSView *view = idWin; + idWin = view.window; + } + if ([idWin isKindOfClass: [NSWindow class]]) { + PRectangle rcPosition = GetPosition(); -//-------------------------------------------------------------------------------------------------- - -PRectangle Window::GetMonitorRect(Point) -{ - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSWindow class]]) - { - NSWindow* win = reinterpret_cast(idWin); - NSScreen* screen = [win screen]; - NSRect rect = [screen frame]; - CGFloat screenHeight = rect.origin.y + rect.size.height; - // Invert screen positions to match Scintilla - return PRectangle( - static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), - static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); - } - } - return PRectangle(); + NSWindow *win = idWin; + NSScreen *screen = win.screen; + NSRect rect = screen.visibleFrame; + CGFloat screenHeight = rect.origin.y + rect.size.height; + // Invert screen positions to match Scintilla + PRectangle rcWork( + static_cast(NSMinX(rect)), static_cast(screenHeight - NSMaxY(rect)), + static_cast(NSMaxX(rect)), static_cast(screenHeight - NSMinY(rect))); + PRectangle rcMonitor(rcWork.left - rcPosition.left, + rcWork.top - rcPosition.top, + rcWork.right - rcPosition.left, + rcWork.bottom - rcPosition.top); + return rcMonitor; + } + } + return PRectangle(); } //----------------- ImageFromXPM ------------------------------------------------------------------- // Convert an XPM image into an NSImage for use with Cocoa -static NSImage* ImageFromXPM(XPM* pxpm) -{ - NSImage* img = nil; - if (pxpm) - { - const int width = pxpm->GetWidth(); - const int height = pxpm->GetHeight(); - PRectangle rcxpm(0, 0, width, height); - Surface* surfaceXPM = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); - if (surfaceXPM) - { - surfaceXPM->InitPixMap(width, height, NULL, NULL); - SurfaceImpl* surfaceIXPM = static_cast(surfaceXPM); - CGContextClearRect(surfaceIXPM->GetContext(), CGRectMake(0, 0, width, height)); - pxpm->Draw(surfaceXPM, rcxpm); - img = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease]; - CGImageRef imageRef = surfaceIXPM->GetImage(); - NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef]; - [img addRepresentation: bitmapRep]; - [bitmapRep release]; - CGImageRelease(imageRef); - delete surfaceXPM; - } - } - return img; +static NSImage *ImageFromXPM(XPM *pxpm) { + NSImage *img = nil; + if (pxpm) { + const int width = pxpm->GetWidth(); + const int height = pxpm->GetHeight(); + PRectangle rcxpm(0, 0, width, height); + std::unique_ptr surfaceXPM(Surface::Allocate(SC_TECHNOLOGY_DEFAULT)); + surfaceXPM->InitPixMap(width, height, NULL, NULL); + SurfaceImpl *surfaceIXPM = static_cast(surfaceXPM.get()); + CGContextClearRect(surfaceIXPM->GetContext(), CGRectMake(0, 0, width, height)); + pxpm->Draw(surfaceXPM.get(), rcxpm); + CGImageRef imageRef = surfaceIXPM->GetImage(); + img = [[NSImage alloc] initWithCGImage: imageRef size: NSZeroSize]; + CGImageRelease(imageRef); + } + return img; } //----------------- ListBox and related classes ---------------------------------------------------- @@ -1373,30 +1483,57 @@ static NSImage* ImageFromXPM(XPM* pxpm) namespace { -// unnamed namespace hides IListBox interface +// Unnamed namespace hides local IListBox interface. +// IListBox is used to cross languages to send events from Objective C++ +// AutoCompletionDelegate and AutoCompletionDataSource to C++ ListBoxImpl. class IListBox { public: - virtual int Rows() = 0; - virtual NSImage* ImageForRow(NSInteger row) = 0; - virtual NSString* TextForRow(NSInteger row) = 0; - virtual void DoubleClick() = 0; + virtual int Rows() = 0; + virtual NSImage *ImageForRow(NSInteger row) = 0; + virtual NSString *TextForRow(NSInteger row) = 0; + virtual void DoubleClick() = 0; + virtual void SelectionChange() = 0; }; -} // unnamed namespace +} + +//----------------- AutoCompletionDelegate --------------------------------------------------------- + +// AutoCompletionDelegate is an Objective C++ class so it can implement +// NSTableViewDelegate and receive tableViewSelectionDidChange events. + +@interface AutoCompletionDelegate : NSObject { + IListBox *box; +} + +@property IListBox *box; + +@end + +@implementation AutoCompletionDelegate + +@synthesize box; + +- (void) tableViewSelectionDidChange: (NSNotification *) notification { +#pragma unused(notification) + if (box) { + box->SelectionChange(); + } +} + +@end //----------------- AutoCompletionDataSource ------------------------------------------------------- -@interface AutoCompletionDataSource : -NSObject -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - -#endif -{ - IListBox* box; +// AutoCompletionDataSource provides data to display in the list box. +// It is also the target of the NSTableView so it receives double clicks. + +@interface AutoCompletionDataSource : NSObject { + IListBox *box; } -@property IListBox* box; +@property IListBox *box; @end @@ -1404,39 +1541,32 @@ NSObject @synthesize box; -- (void) doubleClick: (id) sender -{ +- (void) doubleClick: (id) sender { #pragma unused(sender) - if (box) - { + if (box) { box->DoubleClick(); } } -- (id)tableView: (NSTableView*)aTableView objectValueForTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex -{ +- (id) tableView: (NSTableView *) aTableView objectValueForTableColumn: (NSTableColumn *) aTableColumn row: (NSInteger) rowIndex { #pragma unused(aTableView) if (!box) return nil; - if ([(NSString*)[aTableColumn identifier] isEqualToString: @"icon"]) - { + if ([(NSString *)aTableColumn.identifier isEqualToString: @"icon"]) { return box->ImageForRow(rowIndex); - } - else { + } else { return box->TextForRow(rowIndex); } } -- (void)tableView: (NSTableView*)aTableView setObjectValue: anObject forTableColumn: (NSTableColumn*)aTableColumn row: (NSInteger)rowIndex -{ +- (void) tableView: (NSTableView *) aTableView setObjectValue: anObject forTableColumn: (NSTableColumn *) aTableColumn row: (NSInteger) rowIndex { #pragma unused(aTableView) #pragma unused(anObject) #pragma unused(aTableColumn) #pragma unused(rowIndex) } -- (NSInteger)numberOfRowsInTableView: (NSTableView*)aTableView -{ +- (NSInteger) numberOfRowsInTableView: (NSTableView *) aTableView { #pragma unused(aTableView) if (!box) return 0; @@ -1449,586 +1579,465 @@ NSObject namespace { // unnamed namespace hides ListBoxImpl and associated classes -struct RowData -{ - int type; - std::string text; - RowData(int type_, const char* text_) : - type(type_), text(text_) - { - } +struct RowData { + int type; + std::string text; + RowData(int type_, const char *text_) : + type(type_), text(text_) { + } }; -class LinesData -{ - std::vector lines; +class LinesData { + std::vector lines; public: - LinesData() - { - } - ~LinesData() - { - } - int Length() const - { - return static_cast(lines.size()); - } - void Clear() - { - lines.clear(); - } - void Add(int /* index */, int type, char* str) - { - lines.push_back(RowData(type, str)); - } - int GetType(size_t index) const - { - if (index < lines.size()) - { - return lines[index].type; - } - else - { - return 0; - } - } - const char* GetString(size_t index) const - { - if (index < lines.size()) - { - return lines[index].text.c_str(); - } - else - { - return 0; - } - } + LinesData() { + } + ~LinesData() { + } + int Length() const { + return static_cast(lines.size()); + } + void Clear() { + lines.clear(); + } + void Add(int /* index */, int type, char *str) { + lines.push_back(RowData(type, str)); + } + int GetType(size_t index) const { + if (index < lines.size()) { + return lines[index].type; + } else { + return 0; + } + } + const char *GetString(size_t index) const { + if (index < lines.size()) { + return lines[index].text.c_str(); + } else { + return 0; + } + } }; -// Map from icon type to an NSImage* -typedef std::map ImageMap; - -class ListBoxImpl : public ListBox, IListBox -{ +class ListBoxImpl : public ListBox, IListBox { private: - ImageMap images; - int lineHeight; - bool unicodeMode; - int desiredVisibleRows; - XYPOSITION maxItemWidth; - unsigned int aveCharWidth; - XYPOSITION maxIconWidth; - Font font; - int maxWidth; + NSMutableDictionary *images; + int lineHeight; + bool unicodeMode; + int desiredVisibleRows; + XYPOSITION maxItemWidth; + unsigned int aveCharWidth; + XYPOSITION maxIconWidth; + Font font; + int maxWidth; - NSTableView* table; - NSScrollView* scroller; - NSTableColumn* colIcon; - NSTableColumn* colText; - AutoCompletionDataSource* ds; + NSTableView *table; + NSScrollView *scroller; + NSTableColumn *colIcon; + NSTableColumn *colText; + AutoCompletionDataSource *ds; + AutoCompletionDelegate *acd; - LinesData ld; - CallBackAction doubleClickAction; - void* doubleClickActionData; + LinesData ld; + IListBoxDelegate *delegate; public: - ListBoxImpl() : lineHeight(10), unicodeMode(false), - desiredVisibleRows(5), maxItemWidth(0), aveCharWidth(8), maxIconWidth(0), - doubleClickAction(NULL), doubleClickActionData(NULL) - { - } - ~ListBoxImpl() {} + ListBoxImpl() : + images(nil), + lineHeight(10), + unicodeMode(false), + desiredVisibleRows(5), + maxItemWidth(0), + aveCharWidth(8), + maxIconWidth(0), + maxWidth(2000), + table(nil), + scroller(nil), + colIcon(nil), + colText(nil), + ds(nil), + acd(nil), + delegate(nullptr) { + images = [[NSMutableDictionary alloc] init]; + } + ~ListBoxImpl() override { + } - // ListBox methods - void SetFont(Font& font); - void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_); - void SetAverageCharWidth(int width); - void SetVisibleRows(int rows); - int GetVisibleRows() const; - PRectangle GetDesiredRect(); - int CaretFromEdge(); - void Clear(); - void Append(char* s, int type = -1); - int Length(); - void Select(int n); - int GetSelection(); - int Find(const char* prefix); - void GetValue(int n, char* value, int len); - void RegisterImage(int type, const char* xpm_data); - void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage); - void ClearRegisteredImages(); - void SetDoubleClickAction(CallBackAction action, void* data) - { - doubleClickAction = action; - doubleClickActionData = data; - } - void SetList(const char* list, char separator, char typesep); + // ListBox methods + void SetFont(Font &font) override; + void Create(Window &parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_) override; + void SetAverageCharWidth(int width) override; + void SetVisibleRows(int rows) override; + int GetVisibleRows() const override; + PRectangle GetDesiredRect() override; + int CaretFromEdge() override; + void Clear() override; + void Append(char *s, int type = -1) override; + int Length() override; + void Select(int n) override; + int GetSelection() override; + int Find(const char *prefix) override; + void GetValue(int n, char *value, int len) override; + void RegisterImage(int type, const char *xpm_data) override; + void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) override; + void ClearRegisteredImages() override; + void SetDelegate(IListBoxDelegate *lbDelegate) override { + delegate = lbDelegate; + } + void SetList(const char *list, char separator, char typesep) override; - // To clean up when closed - void ReleaseViews(); + // To clean up when closed + void ReleaseViews(); - // For access from AutoCompletionDataSource implement IListBox - int Rows(); - NSImage* ImageForRow(NSInteger row); - NSString* TextForRow(NSInteger row); - void DoubleClick(); + // For access from AutoCompletionDataSource implement IListBox + int Rows() override; + NSImage *ImageForRow(NSInteger row) override; + NSString *TextForRow(NSInteger row) override; + void DoubleClick() override; + void SelectionChange() override; }; -void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt, - int lineHeight_, bool unicodeMode_, int) -{ - lineHeight = lineHeight_; - unicodeMode = unicodeMode_; - maxWidth = 2000; +void ListBoxImpl::Create(Window & /*parent*/, int /*ctrlID*/, Scintilla::Point pt, + int lineHeight_, bool unicodeMode_, int) { + lineHeight = lineHeight_; + unicodeMode = unicodeMode_; + maxWidth = 2000; - NSRect lbRect = NSMakeRect(pt.x,pt.y, 120, lineHeight * desiredVisibleRows); - NSWindow* winLB = [[NSWindow alloc] initWithContentRect: lbRect - styleMask: NSBorderlessWindowMask - backing: NSBackingStoreBuffered - defer: NO]; - [winLB setLevel:NSFloatingWindowLevel]; - [winLB setHasShadow:YES]; - scroller = [NSScrollView alloc]; - NSRect scRect = NSMakeRect(0, 0, lbRect.size.width, lbRect.size.height); - [scroller initWithFrame: scRect]; - [scroller setHasVerticalScroller:YES]; - table = [[NSTableView alloc] initWithFrame: scRect]; - [table setHeaderView:nil]; - [scroller setDocumentView: table]; - colIcon = [[NSTableColumn alloc] initWithIdentifier:@"icon"]; - [colIcon setWidth: 20]; - [colIcon setEditable:NO]; - [colIcon setHidden:YES]; - NSImageCell* imCell = [[[NSImageCell alloc] init] autorelease]; - [colIcon setDataCell:imCell]; - [table addTableColumn:colIcon]; - colText = [[NSTableColumn alloc] initWithIdentifier:@"name"]; - [colText setResizingMask:NSTableColumnAutoresizingMask]; - [colText setEditable:NO]; - [table addTableColumn:colText]; - ds = [[AutoCompletionDataSource alloc] init]; - [ds setBox:this]; - [table setDataSource: ds]; // Weak reference - [scroller setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; - [[winLB contentView] addSubview: scroller]; + NSRect lbRect = NSMakeRect(pt.x, pt.y, 120, lineHeight * desiredVisibleRows); + NSWindow *winLB = [[NSWindow alloc] initWithContentRect: lbRect + styleMask: NSWindowStyleMaskBorderless + backing: NSBackingStoreBuffered + defer: NO]; + [winLB setLevel: NSFloatingWindowLevel]; + [winLB setHasShadow: YES]; + NSRect scRect = NSMakeRect(0, 0, lbRect.size.width, lbRect.size.height); + scroller = [[NSScrollView alloc] initWithFrame: scRect]; + [scroller setHasVerticalScroller: YES]; + table = [[NSTableView alloc] initWithFrame: scRect]; + [table setHeaderView: nil]; + scroller.documentView = table; + colIcon = [[NSTableColumn alloc] initWithIdentifier: @"icon"]; + colIcon.width = 20; + [colIcon setEditable: NO]; + [colIcon setHidden: YES]; + NSImageCell *imCell = [[NSImageCell alloc] init]; + colIcon.dataCell = imCell; + [table addTableColumn: colIcon]; + colText = [[NSTableColumn alloc] initWithIdentifier: @"name"]; + colText.resizingMask = NSTableColumnAutoresizingMask; + [colText setEditable: NO]; + [table addTableColumn: colText]; + ds = [[AutoCompletionDataSource alloc] init]; + ds.box = this; + table.dataSource = ds; // Weak reference + acd = [[AutoCompletionDelegate alloc] init]; + [acd setBox: this]; + table.delegate = acd; + scroller.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + [winLB.contentView addSubview: scroller]; - [table setTarget:ds]; - [table setDoubleAction:@selector(doubleClick:)]; - table.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; - wid = winLB; + table.target = ds; + table.doubleAction = @selector(doubleClick:); + table.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; + wid = (__bridge_retained WindowID)winLB; } -void ListBoxImpl::SetFont(Font& font_) -{ - // NSCell setFont takes an NSFont* rather than a CTFontRef but they - // are the same thing toll-free bridged. - QuartzTextStyle* style = reinterpret_cast(font_.GetID()); - font.Release(); - font.SetID(new QuartzTextStyle(*style)); - NSFont *pfont = (NSFont *)style->getFontRef(); - [[colText dataCell] setFont: pfont]; - CGFloat itemHeight = ceil([pfont boundingRectForFont].size.height); - [table setRowHeight:itemHeight]; +void ListBoxImpl::SetFont(Font &font_) { + // NSCell setFont takes an NSFont* rather than a CTFontRef but they + // are the same thing toll-free bridged. + QuartzTextStyle *style = TextStyleFromFont(font_); + font.Release(); + font.SetID(new QuartzTextStyle(*style)); + NSFont *pfont = (__bridge NSFont *)style->getFontRef(); + [colText.dataCell setFont: pfont]; + CGFloat itemHeight = ceil(pfont.boundingRectForFont.size.height); + table.rowHeight = itemHeight; } -void ListBoxImpl::SetAverageCharWidth(int width) -{ - aveCharWidth = width; +void ListBoxImpl::SetAverageCharWidth(int width) { + aveCharWidth = width; } -void ListBoxImpl::SetVisibleRows(int rows) -{ - desiredVisibleRows = rows; +void ListBoxImpl::SetVisibleRows(int rows) { + desiredVisibleRows = rows; } -int ListBoxImpl::GetVisibleRows() const -{ - return desiredVisibleRows; +int ListBoxImpl::GetVisibleRows() const { + return desiredVisibleRows; } -PRectangle ListBoxImpl::GetDesiredRect() -{ - PRectangle rcDesired; - rcDesired = GetPosition(); +PRectangle ListBoxImpl::GetDesiredRect() { + PRectangle rcDesired; + rcDesired = GetPosition(); - // There appears to be an extra pixel above and below the row contents - CGFloat itemHeight = [table rowHeight] + 2; + // There appears to be an extra pixel above and below the row contents + CGFloat itemHeight = table.rowHeight + 2; - int rows = Length(); - if ((rows == 0) || (rows > desiredVisibleRows)) - rows = desiredVisibleRows; + int rows = Length(); + if ((rows == 0) || (rows > desiredVisibleRows)) + rows = desiredVisibleRows; - rcDesired.bottom = rcDesired.top + static_cast(itemHeight * rows); - rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth; + rcDesired.bottom = rcDesired.top + static_cast(itemHeight * rows); + rcDesired.right = rcDesired.left + maxItemWidth + aveCharWidth; + rcDesired.right += 4; // Ensures no truncation of text - if (Length() > rows) - { - [scroller setHasVerticalScroller:YES]; - rcDesired.right += [NSScroller scrollerWidthForControlSize:NSRegularControlSize - scrollerStyle:NSScrollerStyleLegacy]; - } - else - { - [scroller setHasVerticalScroller:NO]; - } - rcDesired.right += maxIconWidth; - rcDesired.right += 6; + if (Length() > rows) { + [scroller setHasVerticalScroller: YES]; + rcDesired.right += [NSScroller scrollerWidthForControlSize: NSControlSizeRegular + scrollerStyle: NSScrollerStyleLegacy]; + } else { + [scroller setHasVerticalScroller: NO]; + } + rcDesired.right += maxIconWidth; + rcDesired.right += 6; // For icon space - return rcDesired; + return rcDesired; } -int ListBoxImpl::CaretFromEdge() -{ - if ([colIcon isHidden]) - return 3; - else - return 6 + static_cast([colIcon width]); +int ListBoxImpl::CaretFromEdge() { + if (colIcon.hidden) + return 3; + else + return 6 + static_cast(colIcon.width); } -void ListBoxImpl::ReleaseViews() -{ - [table release]; - table = nil; - [scroller release]; - scroller = nil; - [colIcon release]; - colIcon = nil; - [colText release ]; - colText = nil; - [ds release]; - ds = nil; +void ListBoxImpl::ReleaseViews() { + [table setDataSource: nil]; + table = nil; + scroller = nil; + colIcon = nil; + colText = nil; + acd = nil; + ds = nil; } -void ListBoxImpl::Clear() -{ - maxItemWidth = 0; - maxIconWidth = 0; - ld.Clear(); +void ListBoxImpl::Clear() { + maxItemWidth = 0; + maxIconWidth = 0; + ld.Clear(); } -void ListBoxImpl::Append(char* s, int type) -{ - int count = Length(); - ld.Add(count, type, s); +void ListBoxImpl::Append(char *s, int type) { + int count = Length(); + ld.Add(count, type, s); - Scintilla::SurfaceImpl surface; - XYPOSITION width = surface.WidthText(font, s, static_cast(strlen(s))); - if (width > maxItemWidth) - { - maxItemWidth = width; - [colText setWidth: maxItemWidth]; - } - ImageMap::iterator it = images.find(type); - if (it != images.end()) - { - NSImage* img = it->second; - if (img) - { - XYPOSITION widthIcon = static_cast(img.size.width); - if (widthIcon > maxIconWidth) - { - [colIcon setHidden: NO]; - maxIconWidth = widthIcon; - [colIcon setWidth: maxIconWidth]; - } - } - } + Scintilla::SurfaceImpl surface; + XYPOSITION width = surface.WidthText(font, s); + if (width > maxItemWidth) { + maxItemWidth = width; + colText.width = maxItemWidth; + } + NSImage *img = images[@(type)]; + if (img) { + XYPOSITION widthIcon = static_cast(img.size.width); + if (widthIcon > maxIconWidth) { + [colIcon setHidden: NO]; + maxIconWidth = widthIcon; + colIcon.width = maxIconWidth; + } + } } -void ListBoxImpl::SetList(const char* list, char separator, char typesep) -{ - Clear(); - size_t count = strlen(list) + 1; - std::vector words(list, list+count); - char* startword = words.data(); - char* numword = NULL; - int i = 0; - for (; words[i]; i++) - { - if (words[i] == separator) - { - words[i] = '\0'; - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - startword = words.data() + i + 1; - numword = NULL; - } - else if (words[i] == typesep) - { - numword = words.data() + i; - } - } - if (startword) - { - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - } - [table reloadData]; +void ListBoxImpl::SetList(const char *list, char separator, char typesep) { + Clear(); + size_t count = strlen(list) + 1; + std::vector words(list, list+count); + char *startword = words.data(); + char *numword = nullptr; + int i = 0; + for (; words[i]; i++) { + if (words[i] == separator) { + words[i] = '\0'; + if (numword) + *numword = '\0'; + Append(startword, numword?atoi(numword + 1):-1); + startword = words.data() + i + 1; + numword = nullptr; + } else if (words[i] == typesep) { + numword = words.data() + i; + } + } + if (startword) { + if (numword) + *numword = '\0'; + Append(startword, numword?atoi(numword + 1):-1); + } + [table reloadData]; } -int ListBoxImpl::Length() -{ - return ld.Length(); +int ListBoxImpl::Length() { + return ld.Length(); } -void ListBoxImpl::Select(int n) -{ - [table selectRowIndexes:[NSIndexSet indexSetWithIndex:n] byExtendingSelection:NO]; - [table scrollRowToVisible:n]; +void ListBoxImpl::Select(int n) { + [table selectRowIndexes: [NSIndexSet indexSetWithIndex: n] byExtendingSelection: NO]; + [table scrollRowToVisible: n]; } -int ListBoxImpl::GetSelection() -{ - return static_cast([table selectedRow]); +int ListBoxImpl::GetSelection() { + return static_cast(table.selectedRow); } -int ListBoxImpl::Find(const char* prefix) -{ - int count = Length(); - for (int i = 0; i < count; i++) - { - const char* s = ld.GetString(i); - if (s && (s[0] != '\0') && (0 == strncmp(prefix, s, strlen(prefix)))) - { - return i; - } - } - return - 1; +int ListBoxImpl::Find(const char *prefix) { + int count = Length(); + for (int i = 0; i < count; i++) { + const char *s = ld.GetString(i); + if (s && (s[0] != '\0') && (0 == strncmp(prefix, s, strlen(prefix)))) { + return i; + } + } + return - 1; } -void ListBoxImpl::GetValue(int n, char* value, int len) -{ - const char* textString = ld.GetString(n); - if (textString == NULL) - { - value[0] = '\0'; - return; - } - strlcpy(value, textString, len); +void ListBoxImpl::GetValue(int n, char *value, int len) { + const char *textString = ld.GetString(n); + if (textString == NULL) { + value[0] = '\0'; + return; + } + strlcpy(value, textString, len); } -void ListBoxImpl::RegisterImage(int type, const char* xpm_data) -{ - XPM xpm(xpm_data); - NSImage* img = ImageFromXPM(&xpm); - [img retain]; - ImageMap::iterator it=images.find(type); - if (it == images.end()) - { - images[type] = img; - } - else - { - [it->second release]; - it->second = img; - } +void ListBoxImpl::RegisterImage(int type, const char *xpm_data) { + XPM xpm(xpm_data); + NSImage *img = ImageFromXPM(&xpm); + images[@(type)] = img; } void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) { CGImageRef imageRef = ImageCreateFromRGBA(width, height, pixelsImage, false); - NSSize sz = {static_cast(width), static_cast(height)}; - NSImage *img = [[[NSImage alloc] initWithSize: sz] autorelease]; - NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage: imageRef]; - [img addRepresentation: bitmapRep]; - [bitmapRep release]; + NSImage *img = [[NSImage alloc] initWithCGImage: imageRef size: NSZeroSize]; CGImageRelease(imageRef); - [img retain]; - ImageMap::iterator it=images.find(type); - if (it == images.end()) - { - images[type] = img; - } + images[@(type)] = img; +} + +void ListBoxImpl::ClearRegisteredImages() { + [images removeAllObjects]; +} + +int ListBoxImpl::Rows() { + return ld.Length(); +} + +NSImage *ListBoxImpl::ImageForRow(NSInteger row) { + return images[@(ld.GetType(row))]; +} + +NSString *ListBoxImpl::TextForRow(NSInteger row) { + const char *textString = ld.GetString(row); + NSString *sTitle; + if (unicodeMode) + sTitle = @(textString); else - { - [it->second release]; - it->second = img; + sTitle = [NSString stringWithCString: textString encoding: NSWindowsCP1252StringEncoding]; + return sTitle; +} + +void ListBoxImpl::DoubleClick() { + if (delegate) { + ListBoxEvent event(ListBoxEvent::EventType::doubleClick); + delegate->ListNotify(&event); } } -void ListBoxImpl::ClearRegisteredImages() -{ - for (ImageMap::iterator it=images.begin(); - it != images.end(); ++it) - { - [it->second release]; - it->second = nil; - } - images.clear(); -} - -int ListBoxImpl::Rows() -{ - return ld.Length(); -} - -NSImage* ListBoxImpl::ImageForRow(NSInteger row) -{ - ImageMap::iterator it = images.find(ld.GetType(row)); - if (it != images.end()) - { - NSImage* img = it->second; - return img; - } - else - { - return nil; - } -} - -NSString* ListBoxImpl::TextForRow(NSInteger row) -{ - const char* textString = ld.GetString(row); - NSString* sTitle; - if (unicodeMode) - sTitle = [NSString stringWithUTF8String:textString]; - else - sTitle = [NSString stringWithCString:textString encoding:NSWindowsCP1252StringEncoding]; - return sTitle; -} - -void ListBoxImpl::DoubleClick() -{ - if (doubleClickAction) - { - doubleClickAction(doubleClickActionData); - } +void ListBoxImpl::SelectionChange() { + if (delegate) { + ListBoxEvent event(ListBoxEvent::EventType::selectionChange); + delegate->ListNotify(&event); + } } } // unnamed namespace //----------------- ListBox ------------------------------------------------------------------------ -ListBox::ListBox() -{ +// ListBox is implemented by the ListBoxImpl class. + +ListBox::ListBox() noexcept { } -ListBox::~ListBox() -{ +ListBox::~ListBox() { } -ListBox* ListBox::Allocate() -{ - ListBoxImpl* lb = new ListBoxImpl(); +ListBox *ListBox::Allocate() { + ListBoxImpl *lb = new ListBoxImpl(); return lb; } //-------------------------------------------------------------------------------------------------- -void Window::Destroy() -{ - ListBoxImpl *listbox = dynamic_cast(this); - if (listbox) - { - listbox->ReleaseViews(); - } - if (wid) - { - id idWin = reinterpret_cast(wid); - if ([idWin isKindOfClass: [NSWindow class]]) - { - NSWindow* win = reinterpret_cast(idWin); - [win release]; - } - } - wid = 0; +void Window::Destroy() { + ListBoxImpl *listbox = dynamic_cast(this); + if (listbox) { + listbox->ReleaseViews(); + } + if (wid) { + id idWin = (__bridge id)(wid); + if ([idWin isKindOfClass: [NSWindow class]]) { + [idWin close]; + } + } + wid = nullptr; } //----------------- ScintillaContextMenu ----------------------------------------------------------- -@implementation ScintillaContextMenu : NSMenu +@implementation ScintillaContextMenu : +NSMenu // This NSMenu subclass serves also as target for menu commands and forwards them as // notification messages to the front end. -- (void) handleCommand: (NSMenuItem*) sender -{ - owner->HandleCommand([sender tag]); +- (void) handleCommand: (NSMenuItem *) sender { + owner->HandleCommand(sender.tag); } //-------------------------------------------------------------------------------------------------- -- (void) setOwner: (Scintilla::ScintillaCocoa*) newOwner -{ - owner = newOwner; +- (void) setOwner: (Scintilla::ScintillaCocoa *) newOwner { + owner = newOwner; } @end //----------------- Menu --------------------------------------------------------------------------- -Menu::Menu() - : mid(0) -{ +Menu::Menu() noexcept + : mid(0) { } //-------------------------------------------------------------------------------------------------- -void Menu::CreatePopUp() -{ - Destroy(); - mid = [[ScintillaContextMenu alloc] initWithTitle: @""]; +void Menu::CreatePopUp() { + Destroy(); + mid = (__bridge_retained MenuID)[[ScintillaContextMenu alloc] initWithTitle: @""]; } //-------------------------------------------------------------------------------------------------- -void Menu::Destroy() -{ - ScintillaContextMenu* menu = reinterpret_cast(mid); - [menu release]; - mid = NULL; +void Menu::Destroy() { + CFBridgingRelease(mid); + mid = nullptr; } //-------------------------------------------------------------------------------------------------- -void Menu::Show(Point, Window &) -{ - // Cocoa menus are handled a bit differently. We only create the menu. The framework - // takes care to show it properly. -} - -//----------------- ElapsedTime -------------------------------------------------------------------- - -// ElapsedTime is used for precise performance measurements during development -// and not for anything a user sees. - -ElapsedTime::ElapsedTime() { - struct timeval curTime; - gettimeofday( &curTime, NULL ); - - bigBit = curTime.tv_sec; - littleBit = curTime.tv_usec; -} - -double ElapsedTime::Duration(bool reset) { - struct timeval curTime; - gettimeofday( &curTime, NULL ); - long endBigBit = curTime.tv_sec; - long endLittleBit = curTime.tv_usec; - double result = 1000000.0 * (endBigBit - bigBit); - result += endLittleBit - littleBit; - result /= 1000000.0; - if (reset) { - bigBit = endBigBit; - littleBit = endLittleBit; - } - return result; +void Menu::Show(Point, Window &) { + // Cocoa menus are handled a bit differently. We only create the menu. The framework + // takes care to show it properly. } //----------------- Platform ----------------------------------------------------------------------- -ColourDesired Platform::Chrome() -{ - return ColourDesired(0xE0, 0xE0, 0xE0); +ColourDesired Platform::Chrome() { + return ColourDesired(0xE0, 0xE0, 0xE0); } //-------------------------------------------------------------------------------------------------- -ColourDesired Platform::ChromeHighlight() -{ - return ColourDesired(0xFF, 0xFF, 0xFF); +ColourDesired Platform::ChromeHighlight() { + return ColourDesired(0xFF, 0xFF, 0xFF); } //-------------------------------------------------------------------------------------------------- @@ -2036,10 +2045,9 @@ ColourDesired Platform::ChromeHighlight() /** * Returns the currently set system font for the user. */ -const char *Platform::DefaultFont() -{ - NSString* name = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSFixedPitchFont"]; - return [name UTF8String]; +const char *Platform::DefaultFont() { + NSString *name = [[NSUserDefaults standardUserDefaults] stringForKey: @"NSFixedPitchFont"]; + return name.UTF8String; } //-------------------------------------------------------------------------------------------------- @@ -2047,10 +2055,9 @@ const char *Platform::DefaultFont() /** * Returns the currently set system font size for the user. */ -int Platform::DefaultFontSize() -{ - return static_cast([[NSUserDefaults standardUserDefaults] - integerForKey: @"NSFixedPitchFontSize"]); +int Platform::DefaultFontSize() { + return static_cast([[NSUserDefaults standardUserDefaults] + integerForKey: @"NSFixedPitchFontSize"]); } //-------------------------------------------------------------------------------------------------- @@ -2061,100 +2068,12 @@ int Platform::DefaultFontSize() * * @return time span in milliseconds */ -unsigned int Platform::DoubleClickTime() -{ - float threshold = [[NSUserDefaults standardUserDefaults] floatForKey: - @"com.apple.mouse.doubleClickThreshold"]; - if (threshold == 0) - threshold = 0.5; - return static_cast(threshold * 1000.0); -} - -//-------------------------------------------------------------------------------------------------- - -bool Platform::MouseButtonBounce() -{ - return false; -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Helper method for the backend to reach through to the scintilla window. - */ -long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) -{ - return scintilla_send_message(w, msg, wParam, lParam); -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Helper method for the backend to reach through to the scintilla window. - */ -long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) -{ - return scintilla_send_message(w, msg, wParam, (long) lParam); -} - -//-------------------------------------------------------------------------------------------------- - -bool Platform::IsDBCSLeadByte(int codePage, char ch) -{ - // Byte ranges found in Wikipedia articles with relevant search strings in each case - unsigned char uch = static_cast(ch); - switch (codePage) - { - case 932: - // Shift_jis - return ((uch >= 0x81) && (uch <= 0x9F)) || - ((uch >= 0xE0) && (uch <= 0xFC)); - // Lead bytes F0 to FC may be a Microsoft addition. - case 936: - // GBK - return (uch >= 0x81) && (uch <= 0xFE); - case 949: - // Korean Wansung KS C-5601-1987 - return (uch >= 0x81) && (uch <= 0xFE); - case 950: - // Big5 - return (uch >= 0x81) && (uch <= 0xFE); - case 1361: - // Korean Johab KS C-5601-1992 - return - ((uch >= 0x84) && (uch <= 0xD3)) || - ((uch >= 0xD8) && (uch <= 0xDE)) || - ((uch >= 0xE0) && (uch <= 0xF9)); - } - return false; -} - -//-------------------------------------------------------------------------------------------------- - -int Platform::DBCSCharLength(int /* codePage */, const char* /* s */) -{ - // DBCS no longer uses this. - return 1; -} - -//-------------------------------------------------------------------------------------------------- - -int Platform::DBCSCharMaxLength() -{ - return 2; -} - -//-------------------------------------------------------------------------------------------------- - -int Platform::Minimum(int a, int b) -{ - return (a < b) ? a : b; -} - -//-------------------------------------------------------------------------------------------------- - -int Platform::Maximum(int a, int b) { - return (a > b) ? a : b; +unsigned int Platform::DoubleClickTime() { + float threshold = [[NSUserDefaults standardUserDefaults] floatForKey: + @"com.apple.mouse.doubleClickThreshold"]; + if (threshold == 0) + threshold = 0.5; + return static_cast(threshold * 1000.0); } //-------------------------------------------------------------------------------------------------- @@ -2162,23 +2081,21 @@ int Platform::Maximum(int a, int b) { //#define TRACE #ifdef TRACE -void Platform::DebugDisplay(const char *s) -{ - fprintf( stderr, "%s", s ); +void Platform::DebugDisplay(const char *s) { + fprintf(stderr, "%s", s); } //-------------------------------------------------------------------------------------------------- -void Platform::DebugPrintf(const char *format, ...) -{ - const int BUF_SIZE = 2000; - char buffer[BUF_SIZE]; +void Platform::DebugPrintf(const char *format, ...) { + const int BUF_SIZE = 2000; + char buffer[BUF_SIZE]; - va_list pArguments; - va_start(pArguments, format); - vsnprintf(buffer, BUF_SIZE, format, pArguments); - va_end(pArguments); - Platform::DebugDisplay(buffer); + va_list pArguments; + va_start(pArguments, format); + vsnprintf(buffer, BUF_SIZE, format, pArguments); + va_end(pArguments); + Platform::DebugDisplay(buffer); } #else @@ -2193,49 +2110,35 @@ void Platform::DebugPrintf(const char *, ...) {} static bool assertionPopUps = true; -bool Platform::ShowAssertionPopUps(bool assertionPopUps_) -{ - bool ret = assertionPopUps; - assertionPopUps = assertionPopUps_; - return ret; +bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { + bool ret = assertionPopUps; + assertionPopUps = assertionPopUps_; + return ret; } //-------------------------------------------------------------------------------------------------- -void Platform::Assert(const char *c, const char *file, int line) -{ - char buffer[2000]; - snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line); - Platform::DebugDisplay(buffer); +void Platform::Assert(const char *c, const char *file, int line) { + char buffer[2000]; + snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line); + Platform::DebugDisplay(buffer); #ifdef DEBUG - // Jump into debugger in assert on Mac (CL269835) - ::Debugger(); + // Jump into debugger in assert on Mac (CL269835) + ::Debugger(); #endif } -//-------------------------------------------------------------------------------------------------- - -int Platform::Clamp(int val, int minVal, int maxVal) -{ - if (val > maxVal) - val = maxVal; - if (val < minVal) - val = minVal; - return val; -} - //----------------- DynamicLibrary ----------------------------------------------------------------- /** * Implements the platform specific part of library loading. * * @param modulePath The path to the module to load. - * @return A library instance or NULL if the module could not be found or another problem occurred. + * @return A library instance or nullptr if the module could not be found or another problem occurred. */ -DynamicLibrary* DynamicLibrary::Load(const char* /* modulePath */) -{ - // Not implemented. - return NULL; +DynamicLibrary *DynamicLibrary::Load(const char * /* modulePath */) { + // Not implemented. + return nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/scintilla/cocoa/QuartzTextLayout.h b/scintilla/cocoa/QuartzTextLayout.h index 102e4fed..2831bd74 100644 --- a/scintilla/cocoa/QuartzTextLayout.h +++ b/scintilla/cocoa/QuartzTextLayout.h @@ -16,59 +16,64 @@ #include "QuartzTextStyle.h" -class QuartzTextLayout -{ +class QuartzTextLayout { public: - /** Create a text layout for drawing on the specified context. */ - explicit QuartzTextLayout( CGContextRef context ) - { - mString = NULL; - mLine = NULL; - stringLength = 0; - setContext(context); - } + /** Create a text layout for drawing. */ + QuartzTextLayout() : mString(NULL), mLine(NULL), stringLength(0) { + } - ~QuartzTextLayout() - { - if ( mString != NULL ) - { + ~QuartzTextLayout() { + if (mString) { CFRelease(mString); mString = NULL; } - if ( mLine != NULL ) - { + if (mLine) { CFRelease(mLine); mLine = NULL; } - } + } - inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r ) - { - CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false ); - if (!str) - return; + CFStringEncoding setText(std::string_view sv, CFStringEncoding encoding, const QuartzTextStyle &r) { + // First clear current values in case of failure. + if (mString) { + CFRelease(mString); + mString = NULL; + } + if (mLine) { + CFRelease(mLine); + mLine = NULL; + } - stringLength = CFStringGetLength(str); + const UInt8 *puiBuffer = reinterpret_cast(sv.data()); + CFStringRef str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encoding, false); + if (!str) { + // Failed to decode bytes into string with given encoding so try + // MacRoman which should accept any byte. + encoding = kCFStringEncodingMacRoman; + str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encoding, false); + } + if (!str) { + return encoding; + } + + stringLength = CFStringGetLength(str); CFMutableDictionaryRef stringAttribs = r.getCTStyle(); - if (mString != NULL) - CFRelease(mString); mString = ::CFAttributedStringCreate(NULL, str, stringAttribs); - if (mLine != NULL) - CFRelease(mLine); mLine = ::CTLineCreateWithAttributedString(mString); - CFRelease( str ); - } + CFRelease(str); + return encoding; + } - /** Draw the text layout into the current CGContext at the specified position. - * @param x The x axis position to draw the baseline in the current CGContext. - * @param y The y axis position to draw the baseline in the current CGContext. */ - void draw( float x, float y ) - { - if (mLine == NULL) + /** Draw the text layout into a CGContext at the specified position. + * @param gc The CGContext in which to draw the text. + * @param x The x axis position to draw the baseline in the current CGContext. + * @param y The y axis position to draw the baseline in the current CGContext. */ + void draw(CGContextRef gc, float x, float y) { + if (!mLine) return; ::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0)); @@ -78,31 +83,24 @@ public: // And finally, draw! ::CTLineDraw(mLine, gc); - } + } - float MeasureStringWidth() - { + float MeasureStringWidth() { if (mLine == NULL) return 0.0f; return static_cast(::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL)); } - CTLineRef getCTLine() { - return mLine; - } + CTLineRef getCTLine() { + return mLine; + } - CFIndex getStringLength() { - return stringLength; - } - - inline void setContext (CGContextRef context) - { - gc = context; - } + CFIndex getStringLength() { + return stringLength; + } private: - CGContextRef gc; CFAttributedStringRef mString; CTLineRef mLine; CFIndex stringLength; diff --git a/scintilla/cocoa/QuartzTextStyle.h b/scintilla/cocoa/QuartzTextStyle.h index 0e1210b0..97ff3dab 100644 --- a/scintilla/cocoa/QuartzTextStyle.h +++ b/scintilla/cocoa/QuartzTextStyle.h @@ -10,72 +10,60 @@ #include "QuartzTextStyleAttribute.h" -class QuartzTextStyle -{ +class QuartzTextStyle { public: - QuartzTextStyle() - { + QuartzTextStyle() { fontRef = NULL; styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); characterSet = 0; } - QuartzTextStyle(const QuartzTextStyle &other) - { + QuartzTextStyle(const QuartzTextStyle &other) { // Does not copy font colour attribute fontRef = static_cast(CFRetain(other.fontRef)); styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); characterSet = other.characterSet; } - ~QuartzTextStyle() - { - if (styleDict != NULL) - { + ~QuartzTextStyle() { + if (styleDict != NULL) { CFRelease(styleDict); styleDict = NULL; } - if (fontRef) - { + if (fontRef) { CFRelease(fontRef); fontRef = NULL; } } - CFMutableDictionaryRef getCTStyle() const - { + CFMutableDictionaryRef getCTStyle() const { return styleDict; } - void setCTStyleColor(CGColor *inColor) - { + void setCTStyleColor(CGColor *inColor) { CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor); } - float getAscent() const - { + float getAscent() const { return static_cast(::CTFontGetAscent(fontRef)); } - float getDescent() const - { + float getDescent() const { return static_cast(::CTFontGetDescent(fontRef)); } - float getLeading() const - { + float getLeading() const { return static_cast(::CTFontGetLeading(fontRef)); } - void setFontRef(CTFontRef inRef, int characterSet_) - { + void setFontRef(CTFontRef inRef, int characterSet_) { fontRef = inRef; characterSet = characterSet_; @@ -83,19 +71,17 @@ public: CFRelease(styleDict); styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); } - CTFontRef getFontRef() - { + CTFontRef getFontRef() { return fontRef; } - int getCharacterSet() - { + int getCharacterSet() { return characterSet; } diff --git a/scintilla/cocoa/QuartzTextStyleAttribute.h b/scintilla/cocoa/QuartzTextStyleAttribute.h index 7f389b41..179113ec 100644 --- a/scintilla/cocoa/QuartzTextStyleAttribute.h +++ b/scintilla/cocoa/QuartzTextStyleAttribute.h @@ -12,20 +12,17 @@ #ifndef _QUARTZ_TEXT_STYLE_ATTRIBUTE_H #define _QUARTZ_TEXT_STYLE_ATTRIBUTE_H -class QuartzFont -{ +class QuartzFont { public: - /** Create a font style from a name. */ - QuartzFont( const char* name, size_t length, float size, int weight, bool italic ) - { - assert( name != NULL && length > 0 && name[length] == '\0' ); + /** Create a font style from a name. */ + QuartzFont(const char *name, size_t length, float size, int weight, bool italic) { + assert(name != NULL && length > 0 && name[length] == '\0'); CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman); assert(fontName != NULL); - bool bold = weight > SC_WEIGHT_NORMAL; + bool bold = weight > SC_WEIGHT_NORMAL; - if (bold || italic) - { + if (bold || italic) { CTFontSymbolicTraits desiredTrait = 0; CTFontSymbolicTraits traitMask = 0; @@ -44,35 +41,28 @@ public: // create a font and then a copy of it with the sym traits CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL); fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask); - if (fontid) - { + if (fontid) { CFRelease(iFont); - } - else - { + } else { // Traits failed so use base font fontid = iFont; } - } - else - { + } else { // create the font, no traits fontid = ::CTFontCreateWithName(fontName, size, NULL); } - if (!fontid) - { + if (!fontid) { // Failed to create requested font so use font always present fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL); } CFRelease(fontName); - } + } - CTFontRef getFontID() - { - return fontid; - } + CTFontRef getFontID() { + return fontid; + } private: CTFontRef fontid; diff --git a/scintilla/cocoa/ScintillaCocoa.h b/scintilla/cocoa/ScintillaCocoa.h index 03847edc..cdabea59 100644 --- a/scintilla/cocoa/ScintillaCocoa.h +++ b/scintilla/cocoa/ScintillaCocoa.h @@ -13,16 +13,18 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +#include +#include "ILoader.h" #include "ILexer.h" #ifdef SCI_LEXER @@ -30,6 +32,8 @@ #include "PropSetSimple.h" #endif +#include "Position.h" +#include "UniqueString.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -38,7 +42,6 @@ #include "CallTip.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" @@ -47,6 +50,8 @@ #include "CaseFolder.h" #include "Document.h" #include "CaseConvert.h" +#include "UniConversion.h" +#include "DBCS.h" #include "Selection.h" #include "PositionCache.h" #include "EditModel.h" @@ -57,7 +62,7 @@ #include "AutoComplete.h" #include "ScintillaBase.h" -extern "C" NSString* ScintillaRecPboardType; +extern "C" NSString *ScintillaRecPboardType; @class SCIContentView; @class SCIMarginView; @@ -68,15 +73,14 @@ extern "C" NSString* ScintillaRecPboardType; /** * Helper class to be used as timer target (NSTimer). */ -@interface TimerTarget : NSObject -{ - void* mTarget; - NSNotificationQueue* notificationQueue; +@interface TimerTarget : NSObject { + void *mTarget; + NSNotificationQueue *notificationQueue; } -- (id) init: (void*) target; -- (void) timerFired: (NSTimer*) timer; -- (void) idleTimerFired: (NSTimer*) timer; -- (void) idleTriggered: (NSNotification*) notification; +- (id) init: (void *) target; +- (void) timerFired: (NSTimer *) timer; +- (void) idleTimerFired: (NSTimer *) timer; +- (void) idleTriggered: (NSNotification *) notification; @end namespace Scintilla { @@ -84,162 +88,167 @@ namespace Scintilla { /** * Main scintilla class, implemented for OS X (Cocoa). */ -class ScintillaCocoa : public ScintillaBase -{ +class ScintillaCocoa : public ScintillaBase { private: - TimerTarget* timerTarget; - NSEvent* lastMouseEvent; + ScintillaView *sciView; + TimerTarget *timerTarget; + NSEvent *lastMouseEvent; - id delegate; + id delegate; - SciNotifyFunc notifyProc; - intptr_t notifyObj; + SciNotifyFunc notifyProc; + intptr_t notifyObj; - bool capturedMouse; + bool capturedMouse; - bool enteredSetScrollingSize; + bool enteredSetScrollingSize; - // Private so ScintillaCocoa objects can not be copied - ScintillaCocoa(const ScintillaCocoa &) : ScintillaBase() {} - ScintillaCocoa &operator=(const ScintillaCocoa &) { return * this; } + bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText); + void SetPasteboardData(NSPasteboard *board, const SelectionText &selectedText); + Sci::Position TargetAsUTF8(char *text) const; + Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const; - bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText); - void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText); - int TargetAsUTF8(char *text); - int EncodedFromUTF8(char *utf8, char *encoded) const; + int scrollSpeed; + int scrollTicks; + CFRunLoopObserverRef observer; - int scrollSpeed; - int scrollTicks; - NSTimer* tickTimer; - NSTimer* idleTimer; - CFRunLoopObserverRef observer; - - FindHighlightLayer *layerFindIndicator; + FindHighlightLayer *layerFindIndicator; protected: - Point GetVisibleOriginInMain() const; - PRectangle GetClientRectangle() const; - virtual PRectangle GetClientDrawingRectangle(); - Point ConvertPoint(NSPoint point); - virtual void RedrawRect(PRectangle rc); - virtual void DiscardOverdraw(); - virtual void Redraw(); + Point GetVisibleOriginInMain() const override; + PRectangle GetClientRectangle() const override; + PRectangle GetClientDrawingRectangle() override; + Point ConvertPoint(NSPoint point); + void RedrawRect(PRectangle rc) override; + void DiscardOverdraw() override; + void Redraw() override; - virtual void Initialise(); - virtual void Finalise(); - virtual CaseFolder *CaseFolderForEncoding(); - virtual std::string CaseMapString(const std::string &s, int caseMapping); - virtual void CancelModes(); + void Init(); + CaseFolder *CaseFolderForEncoding() override; + std::string CaseMapString(const std::string &s, int caseMapping) override; + void CancelModes() override; public: - ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin); - virtual ~ScintillaCocoa(); + ScintillaCocoa(ScintillaView *sciView_, SCIContentView *viewContent, SCIMarginView *viewMargin); + // Deleted so ScintillaCocoa objects can not be copied. + ScintillaCocoa(const ScintillaCocoa &) = delete; + ScintillaCocoa &operator=(const ScintillaCocoa &) = delete; + ~ScintillaCocoa() override; + void Finalise() override; - void SetDelegate(id delegate_); - void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback); - sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + void SetDelegate(id delegate_); + void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback); + sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; - NSScrollView* ScrollContainer() const; - SCIContentView* ContentView(); + NSScrollView *ScrollContainer() const; + SCIContentView *ContentView(); - bool SyncPaint(void* gc, PRectangle rc); - bool Draw(NSRect rect, CGContextRef gc); - void PaintMargin(NSRect aRect); + bool SyncPaint(void *gc, PRectangle rc); + bool Draw(NSRect rect, CGContextRef gc); + void PaintMargin(NSRect aRect); - virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - void TickFor(TickReason reason); - bool FineTickerAvailable(); - bool FineTickerRunning(TickReason reason); - void FineTickerStart(TickReason reason, int millis, int tolerance); - void FineTickerCancel(TickReason reason); - bool SetIdle(bool on); - void SetMouseCapture(bool on); - bool HaveMouseCapture(); - void WillDraw(NSRect rect); - void ScrollText(int linesToMove); - void SetVerticalScrollPos(); - void SetHorizontalScrollPos(); - bool ModifyScrollBars(int nMax, int nPage); - bool SetScrollingSize(void); - void Resize(); - void UpdateForScroll(); + sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; + void TickFor(TickReason reason) override; + bool FineTickerRunning(TickReason reason) override; + void FineTickerStart(TickReason reason, int millis, int tolerance) override; + void FineTickerCancel(TickReason reason) override; + bool SetIdle(bool on) override; + void SetMouseCapture(bool on) override; + bool HaveMouseCapture() override; + void WillDraw(NSRect rect); + void ScrollText(Sci::Line linesToMove) override; + void SetVerticalScrollPos() override; + void SetHorizontalScrollPos() override; + bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override; + bool SetScrollingSize(void); + void Resize(); + void UpdateForScroll(); - // Notifications for the owner. - void NotifyChange(); - void NotifyFocus(bool focus); - void NotifyParent(SCNotification scn); - void NotifyURIDropped(const char *uri); + // Notifications for the owner. + void NotifyChange() override; + void NotifyFocus(bool focus) override; + void NotifyParent(SCNotification scn) override; + void NotifyURIDropped(const char *uri); - bool HasSelection(); - bool CanUndo(); - bool CanRedo(); - virtual void CopyToClipboard(const SelectionText &selectedText); - virtual void Copy(); - virtual bool CanPaste(); - virtual void Paste(); - virtual void Paste(bool rectangular); - void CTPaint(void* gc, NSRect rc); - void CallTipMouseDown(NSPoint pt); - virtual void CreateCallTipWindow(PRectangle rc); - virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); - virtual void ClaimSelection(); + bool HasSelection(); + bool CanUndo(); + bool CanRedo(); + void CopyToClipboard(const SelectionText &selectedText) override; + void Copy() override; + bool CanPaste() override; + void Paste() override; + void Paste(bool rectangular); + void CTPaint(void *gc, NSRect rc); + void CallTipMouseDown(NSPoint pt); + void CreateCallTipWindow(PRectangle rc) override; + void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override; + void ClaimSelection() override; - NSPoint GetCaretPosition(); + NSPoint GetCaretPosition(); - static sptr_t DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); + static sptr_t DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); - NSTimer *timers[tickPlatform+1]; - void TimerFired(NSTimer* timer); - void IdleTimerFired(); - static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci); - void ObserverAdd(); - void ObserverRemove(); - virtual void IdleWork(); - virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo); - int InsertText(NSString* input); - NSRange PositionsFromCharacters(NSRange range) const; - NSRange CharactersFromPositions(NSRange range) const; - void SelectOnlyMainSelection(); - void ConvertSelectionVirtualSpace(); - bool ClearAllSelections(); - void CompositionStart(); - void CompositionCommit(); - void CompositionUndo(); - virtual void SetDocPointer(Document *document); + NSTimer *timers[tickPlatform+1]; + void TimerFired(NSTimer *timer); + void IdleTimerFired(); + static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci); + void ObserverAdd(); + void ObserverRemove(); + void IdleWork() override; + void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override; + ptrdiff_t InsertText(NSString *input); + NSRange PositionsFromCharacters(NSRange rangeCharacters) const; + NSRange CharactersFromPositions(NSRange rangePositions) const; + NSString *RangeTextAsString(NSRange rangePositions) const; + NSInteger VisibleLineForIndex(NSInteger index); + NSRange RangeForVisibleLine(NSInteger lineVisible); + NSRect FrameForRange(NSRange rangeCharacters); + NSRect GetBounds() const; + void SelectOnlyMainSelection(); + void ConvertSelectionVirtualSpace(); + bool ClearAllSelections(); + void CompositionStart(); + void CompositionCommit(); + void CompositionUndo(); + void SetDocPointer(Document *document) override; - bool KeyboardInput(NSEvent* event); - void MouseDown(NSEvent* event); - void MouseMove(NSEvent* event); - void MouseUp(NSEvent* event); - void MouseEntered(NSEvent* event); - void MouseExited(NSEvent* event); - void MouseWheel(NSEvent* event); + bool KeyboardInput(NSEvent *event); + void MouseDown(NSEvent *event); + void RightMouseDown(NSEvent *event); + void MouseMove(NSEvent *event); + void MouseUp(NSEvent *event); + void MouseEntered(NSEvent *event); + void MouseExited(NSEvent *event); + void MouseWheel(NSEvent *event); - // Drag and drop - void StartDrag(); - bool GetDragData(id info, NSPasteboard &pasteBoard, SelectionText* selectedText); - NSDragOperation DraggingEntered(id info); - NSDragOperation DraggingUpdated(id info); - void DraggingExited(id info); - bool PerformDragOperation(id info); - void DragScroll(); + // Drag and drop + void StartDrag() override; + bool GetDragData(id info, NSPasteboard &pasteBoard, SelectionText *selectedText); + NSDragOperation DraggingEntered(id info); + NSDragOperation DraggingUpdated(id info); + void DraggingExited(id info); + bool PerformDragOperation(id info); + void DragScroll(); - // Promote some methods needed for NSResponder actions. - virtual void SelectAll(); - void DeleteBackward(); - virtual void Cut(); - virtual void Undo(); - virtual void Redo(); + // Promote some methods needed for NSResponder actions. + void SelectAll() override; + void DeleteBackward(); + void Cut() override; + void Undo() override; + void Redo() override; - virtual NSMenu* CreateContextMenu(NSEvent* event); - void HandleCommand(NSInteger command); + bool ShouldDisplayPopupOnMargin(); + bool ShouldDisplayPopupOnText(); + NSMenu *CreateContextMenu(NSEvent *event); + void HandleCommand(NSInteger command); - virtual void ActiveStateChanged(bool isActive); + void ActiveStateChanged(bool isActive); + void WindowWillMove(); - // Find indicator - void ShowFindIndicatorForRange(NSRange charRange, BOOL retaining); - void MoveFindIndicatorWithBounce(BOOL bounce); - void HideFindIndicator(); + // Find indicator + void ShowFindIndicatorForRange(NSRange charRange, BOOL retaining); + void MoveFindIndicatorWithBounce(BOOL bounce); + void HideFindIndicator(); }; diff --git a/scintilla/cocoa/ScintillaCocoa.mm b/scintilla/cocoa/ScintillaCocoa.mm index 618b2cbd..e0a6b078 100644 --- a/scintilla/cocoa/ScintillaCocoa.mm +++ b/scintilla/cocoa/ScintillaCocoa.mm @@ -14,6 +14,9 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ +#include +#include + #import #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 #import @@ -28,7 +31,7 @@ using namespace Scintilla; -NSString* ScintillaRecPboardType = @"com.scintilla.utf16-plain-text.rectangular"; +NSString *ScintillaRecPboardType = @"com.scintilla.utf16-plain-text.rectangular"; //-------------------------------------------------------------------------------------------------- @@ -37,100 +40,99 @@ NSString* ScintillaRecPboardType = @"com.scintilla.utf16-plain-text.rectangular" #define SCI_SCMD ( SCI_CMD | SCI_SHIFT) #define SCI_SMETA ( SCI_META | SCI_SHIFT) -static const KeyToCommand macMapDefault[] = -{ - // OS X specific - {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND}, - {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, - {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART}, - {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, - {SCK_LEFT, SCI_CTRL, SCI_VCHOME}, - {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND}, - {SCK_RIGHT, SCI_CTRL, SCI_LINEEND}, - {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND}, +static const KeyToCommand macMapDefault[] = { + // OS X specific + {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND}, + {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART}, + {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {SCK_LEFT, SCI_CTRL, SCI_VCHOME}, + {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND}, + {SCK_RIGHT, SCI_CTRL, SCI_LINEEND}, + {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND}, - // Similar to Windows and GTK+ - // Where equivalent clashes with OS X standard, use Meta instead - {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, - {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, - {SCK_DOWN, SCI_META, SCI_LINESCROLLDOWN}, - {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, - {SCK_UP, SCI_NORM, SCI_LINEUP}, - {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, - {SCK_UP, SCI_META, SCI_LINESCROLLUP}, - {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, - {'[', SCI_CTRL, SCI_PARAUP}, - {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, - {']', SCI_CTRL, SCI_PARADOWN}, - {']', SCI_CSHIFT, SCI_PARADOWNEXTEND}, - {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, - {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, - {SCK_LEFT, SCI_ALT, SCI_WORDLEFT}, - {SCK_LEFT, SCI_META, SCI_WORDLEFT}, - {SCK_LEFT, SCI_SMETA, SCI_WORDLEFTEXTEND}, - {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, - {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, - {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, - {SCK_RIGHT, SCI_ALT, SCI_WORDRIGHT}, - {SCK_RIGHT, SCI_META, SCI_WORDRIGHT}, - {SCK_RIGHT, SCI_SMETA, SCI_WORDRIGHTEXTEND}, - {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, - {'/', SCI_CTRL, SCI_WORDPARTLEFT}, - {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, - {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, - {'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND}, - {SCK_HOME, SCI_NORM, SCI_VCHOME}, - {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, - {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, - {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, - {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY}, - {SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND}, - {SCK_END, SCI_NORM, SCI_LINEEND}, - {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, - {SCK_END, SCI_CTRL, SCI_DOCUMENTEND}, - {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, - {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY}, - {SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND}, - {SCK_PRIOR, SCI_NORM, SCI_PAGEUP}, - {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, - {SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND}, - {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN}, - {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, - {SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND}, - {SCK_DELETE, SCI_NORM, SCI_CLEAR}, - {SCK_DELETE, SCI_SHIFT, SCI_CUT}, - {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, - {SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT}, - {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, - {SCK_INSERT, SCI_SHIFT, SCI_PASTE}, - {SCK_INSERT, SCI_CTRL, SCI_COPY}, - {SCK_ESCAPE, SCI_NORM, SCI_CANCEL}, - {SCK_BACK, SCI_NORM, SCI_DELETEBACK}, - {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK}, - {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, - {SCK_BACK, SCI_ALT, SCI_DELWORDLEFT}, - {SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT}, - {'z', SCI_CMD, SCI_UNDO}, - {'z', SCI_SCMD, SCI_REDO}, - {'x', SCI_CMD, SCI_CUT}, - {'c', SCI_CMD, SCI_COPY}, - {'v', SCI_CMD, SCI_PASTE}, - {'a', SCI_CMD, SCI_SELECTALL}, - {SCK_TAB, SCI_NORM, SCI_TAB}, - {SCK_TAB, SCI_SHIFT, SCI_BACKTAB}, - {SCK_RETURN, SCI_NORM, SCI_NEWLINE}, - {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE}, - {SCK_ADD, SCI_CMD, SCI_ZOOMIN}, - {SCK_SUBTRACT, SCI_CMD, SCI_ZOOMOUT}, - {SCK_DIVIDE, SCI_CMD, SCI_SETZOOM}, - {'l', SCI_CMD, SCI_LINECUT}, - {'l', SCI_CSHIFT, SCI_LINEDELETE}, - {'t', SCI_CSHIFT, SCI_LINECOPY}, - {'t', SCI_CTRL, SCI_LINETRANSPOSE}, - {'d', SCI_CTRL, SCI_SELECTIONDUPLICATE}, - {'u', SCI_CTRL, SCI_LOWERCASE}, - {'u', SCI_CSHIFT, SCI_UPPERCASE}, - {0, 0, 0}, + // Similar to Windows and GTK+ + // Where equivalent clashes with OS X standard, use Meta instead + {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, + {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, + {SCK_DOWN, SCI_META, SCI_LINESCROLLDOWN}, + {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, + {SCK_UP, SCI_NORM, SCI_LINEUP}, + {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, + {SCK_UP, SCI_META, SCI_LINESCROLLUP}, + {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, + {'[', SCI_CTRL, SCI_PARAUP}, + {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, + {']', SCI_CTRL, SCI_PARADOWN}, + {']', SCI_CSHIFT, SCI_PARADOWNEXTEND}, + {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, + {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, + {SCK_LEFT, SCI_ALT, SCI_WORDLEFT}, + {SCK_LEFT, SCI_META, SCI_WORDLEFT}, + {SCK_LEFT, SCI_SMETA, SCI_WORDLEFTEXTEND}, + {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, + {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, + {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, + {SCK_RIGHT, SCI_ALT, SCI_WORDRIGHT}, + {SCK_RIGHT, SCI_META, SCI_WORDRIGHT}, + {SCK_RIGHT, SCI_SMETA, SCI_WORDRIGHTEXTEND}, + {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, + {'/', SCI_CTRL, SCI_WORDPARTLEFT}, + {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, + {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, + {'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND}, + {SCK_HOME, SCI_NORM, SCI_VCHOME}, + {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, + {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, + {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY}, + {SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND}, + {SCK_END, SCI_NORM, SCI_LINEEND}, + {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, + {SCK_END, SCI_CTRL, SCI_DOCUMENTEND}, + {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY}, + {SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND}, + {SCK_PRIOR, SCI_NORM, SCI_PAGEUP}, + {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, + {SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND}, + {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN}, + {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, + {SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND}, + {SCK_DELETE, SCI_NORM, SCI_CLEAR}, + {SCK_DELETE, SCI_SHIFT, SCI_CUT}, + {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, + {SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT}, + {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, + {SCK_INSERT, SCI_SHIFT, SCI_PASTE}, + {SCK_INSERT, SCI_CTRL, SCI_COPY}, + {SCK_ESCAPE, SCI_NORM, SCI_CANCEL}, + {SCK_BACK, SCI_NORM, SCI_DELETEBACK}, + {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK}, + {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, + {SCK_BACK, SCI_ALT, SCI_DELWORDLEFT}, + {SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT}, + {'z', SCI_CMD, SCI_UNDO}, + {'z', SCI_SCMD, SCI_REDO}, + {'x', SCI_CMD, SCI_CUT}, + {'c', SCI_CMD, SCI_COPY}, + {'v', SCI_CMD, SCI_PASTE}, + {'a', SCI_CMD, SCI_SELECTALL}, + {SCK_TAB, SCI_NORM, SCI_TAB}, + {SCK_TAB, SCI_SHIFT, SCI_BACKTAB}, + {SCK_RETURN, SCI_NORM, SCI_NEWLINE}, + {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE}, + {SCK_ADD, SCI_CMD, SCI_ZOOMIN}, + {SCK_SUBTRACT, SCI_CMD, SCI_ZOOMOUT}, + {SCK_DIVIDE, SCI_CMD, SCI_SETZOOM}, + {'l', SCI_CMD, SCI_LINECUT}, + {'l', SCI_CSHIFT, SCI_LINEDELETE}, + {'t', SCI_CSHIFT, SCI_LINECOPY}, + {'t', SCI_CTRL, SCI_LINETRANSPOSE}, + {'d', SCI_CTRL, SCI_SELECTIONDUPLICATE}, + {'u', SCI_CTRL, SCI_LOWERCASE}, + {'u', SCI_CSHIFT, SCI_UPPERCASE}, + {0, 0, 0}, }; //-------------------------------------------------------------------------------------------------- @@ -142,11 +144,10 @@ static const KeyToCommand macMapDefault[] = /** * Class to display the animated gold roundrect used on OS X for matches. */ -@interface FindHighlightLayer : CAGradientLayer -{ +@interface FindHighlightLayer : CAGradientLayer { @private NSString *sFind; - int positionFind; + long positionFind; BOOL retaining; CGFloat widthText; CGFloat heightLine; @@ -154,15 +155,15 @@ static const KeyToCommand macMapDefault[] = CGFloat fontSize; } -@property (copy) NSString *sFind; -@property (assign) int positionFind; -@property (assign) BOOL retaining; -@property (assign) CGFloat widthText; -@property (assign) CGFloat heightLine; -@property (copy) NSString *sFont; -@property (assign) CGFloat fontSize; +@property(copy) NSString *sFind; +@property(assign) long positionFind; +@property(assign) BOOL retaining; +@property(assign) CGFloat widthText; +@property(assign) CGFloat heightLine; +@property(copy) NSString *sFont; +@property(assign) CGFloat fontSize; -- (void) animateMatch: (CGPoint)ptText bounce:(BOOL)bounce; +- (void) animateMatch: (CGPoint) ptText bounce: (BOOL) bounce; - (void) hideMatch; @end @@ -173,13 +174,13 @@ static const KeyToCommand macMapDefault[] = @synthesize sFind, positionFind, retaining, widthText, heightLine, sFont, fontSize; --(id) init { +- (id) init { if (self = [super init]) { [self setNeedsDisplayOnBoundsChange: YES]; // A gold to slightly redder gradient to match other applications CGColorRef colGold = CGColorCreateGenericRGB(1.0, 1.0, 0, 1.0); CGColorRef colGoldRed = CGColorCreateGenericRGB(1.0, 0.8, 0, 1.0); - self.colors = [NSArray arrayWithObjects:(id)colGoldRed, (id)colGold, nil]; + self.colors = @[(__bridge id)colGoldRed, (__bridge id)colGold]; CGColorRelease(colGoldRed); CGColorRelease(colGold); @@ -198,18 +199,19 @@ static const KeyToCommand macMapDefault[] = } + const CGFloat paddingHighlightX = 4; const CGFloat paddingHighlightY = 2; --(void) drawInContext:(CGContextRef)context { +- (void) drawInContext: (CGContextRef) context { if (!sFind || !sFont) return; - CFStringRef str = CFStringRef(sFind); + CFStringRef str = (__bridge CFStringRef)(sFind); CFMutableDictionaryRef styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); CGColorRef color = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 1.0); CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, color); CTFontRef fontRef = ::CTFontCreateWithName((CFStringRef)sFont, fontSize, NULL); @@ -228,8 +230,8 @@ const CGFloat paddingHighlightY = 2; CFRelease(styleDict); } -- (void) animateMatch: (CGPoint)ptText bounce:(BOOL)bounce { - if (!self.sFind || ![self.sFind length]) { +- (void) animateMatch: (CGPoint) ptText bounce: (BOOL) bounce { + if (!self.sFind || !(self.sFind).length) { [self hideMatch]; return; } @@ -248,8 +250,8 @@ const CGFloat paddingHighlightY = 2; ptText.y -= flipper * height / 2.0; [CATransaction begin]; - [CATransaction setValue:[NSNumber numberWithFloat:0.0] forKey:kCATransactionAnimationDuration]; - self.bounds = CGRectMake(0,0, width, height); + [CATransaction setValue: @0.0f forKey: kCATransactionAnimationDuration]; + self.bounds = CGRectMake(0, 0, width, height); self.position = ptText; if (bounce) { // Do not reset visibility when just moving @@ -260,33 +262,33 @@ const CGFloat paddingHighlightY = 2; [CATransaction commit]; if (bounce) { - CABasicAnimation *animBounce = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + CABasicAnimation *animBounce = [CABasicAnimation animationWithKeyPath: @"transform.scale"]; animBounce.duration = 0.15; animBounce.autoreverses = YES; animBounce.removedOnCompletion = NO; - animBounce.fromValue = [NSNumber numberWithFloat: 1.0]; - animBounce.toValue = [NSNumber numberWithFloat: 1.25]; + animBounce.fromValue = @1.0f; + animBounce.toValue = @1.25f; if (self.retaining) { - [self addAnimation: animBounce forKey:@"animateFound"]; + [self addAnimation: animBounce forKey: @"animateFound"]; } else { - CABasicAnimation *animFade = [CABasicAnimation animationWithKeyPath:@"opacity"]; + CABasicAnimation *animFade = [CABasicAnimation animationWithKeyPath: @"opacity"]; animFade.duration = 0.1; animFade.beginTime = 0.4; animFade.removedOnCompletion = NO; - animFade.fromValue = [NSNumber numberWithFloat: 1.0]; - animFade.toValue = [NSNumber numberWithFloat: 0.0]; + animFade.fromValue = @1.0f; + animFade.toValue = @0.0f; CAAnimationGroup *group = [CAAnimationGroup animation]; - [group setDuration:0.5]; + group.duration = 0.5; group.removedOnCompletion = NO; group.fillMode = kCAFillModeForwards; - [group setAnimations:[NSArray arrayWithObjects:animBounce, animFade, nil]]; + group.animations = @[animBounce, animFade]; - [self addAnimation:group forKey:@"animateFound"]; + [self addAnimation: group forKey: @"animateFound"]; } } } @@ -305,30 +307,35 @@ const CGFloat paddingHighlightY = 2; @implementation TimerTarget -- (id) init: (void*) target -{ - self = [super init]; - if (self != nil) - { - mTarget = target; +- (id) init: (void *) target { + self = [super init]; + if (self != nil) { + mTarget = target; - // Get the default notification queue for the thread which created the instance (usually the - // main thread). We need that later for idle event processing. - NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; - notificationQueue = [[NSNotificationQueue alloc] initWithNotificationCenter: center]; - [center addObserver: self selector: @selector(idleTriggered:) name: @"Idle" object: nil]; - } - return self; + // Get the default notification queue for the thread which created the instance (usually the + // main thread). We need that later for idle event processing. + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + notificationQueue = [[NSNotificationQueue alloc] initWithNotificationCenter: center]; + [center addObserver: self selector: @selector(idleTriggered:) name: @"Idle" object: nil]; + } + return self; } //-------------------------------------------------------------------------------------------------- -- (void) dealloc -{ - NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; - [center removeObserver:self]; - [notificationQueue release]; - [super dealloc]; +- (void) dealloc { + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center removeObserver: self]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Method called by owning ScintillaCocoa object when it is destroyed. + */ +- (void) ownerDestroyed { + mTarget = NULL; + notificationQueue = nil; } //-------------------------------------------------------------------------------------------------- @@ -337,9 +344,9 @@ const CGFloat paddingHighlightY = 2; * Method called by a timer installed by ScintillaCocoa. This two step approach is needed because * a native Obj-C class is required as target for the timer. */ -- (void) timerFired: (NSTimer*) timer -{ - reinterpret_cast(mTarget)->TimerFired(timer); +- (void) timerFired: (NSTimer *) timer { + if (mTarget) + static_cast(mTarget)->TimerFired(timer); } //-------------------------------------------------------------------------------------------------- @@ -347,18 +354,17 @@ const CGFloat paddingHighlightY = 2; /** * Another timer callback for the idle timer. */ -- (void) idleTimerFired: (NSTimer*) timer -{ +- (void) idleTimerFired: (NSTimer *) timer { #pragma unused(timer) - // Idle timer event. - // Post a new idle notification, which gets executed when the run loop is idle. - // Since we are coalescing on name and sender there will always be only one actual notification - // even for multiple requests. - NSNotification *notification = [NSNotification notificationWithName: @"Idle" object: self]; - [notificationQueue enqueueNotification: notification - postingStyle: NSPostWhenIdle - coalesceMask: (NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender) - forModes: nil]; + // Idle timer event. + // Post a new idle notification, which gets executed when the run loop is idle. + // Since we are coalescing on name and sender there will always be only one actual notification + // even for multiple requests. + NSNotification *notification = [NSNotification notificationWithName: @"Idle" object: self]; + [notificationQueue enqueueNotification: notification + postingStyle: NSPostWhenIdle + coalesceMask: (NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender) + forModes: @[NSDefaultRunLoopMode, NSModalPanelRunLoopMode]]; } //-------------------------------------------------------------------------------------------------- @@ -367,48 +373,46 @@ const CGFloat paddingHighlightY = 2; * Another step for idle events. The timer (for idle events) simply requests a notification on * idle time. Only when this notification is send we actually call back the editor. */ -- (void) idleTriggered: (NSNotification*) notification -{ +- (void) idleTriggered: (NSNotification *) notification { #pragma unused(notification) - reinterpret_cast(mTarget)->IdleTimerFired(); + if (mTarget) + static_cast(mTarget)->IdleTimerFired(); } @end //----------------- ScintillaCocoa ----------------------------------------------------------------- -ScintillaCocoa::ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin) -{ - vs.marginInside = false; - wMain = view; // Don't retain since we're owned by view, which would cause a cycle - wMargin = viewMargin; - timerTarget = [[TimerTarget alloc] init: this]; - lastMouseEvent = NULL; - delegate = NULL; - notifyObj = NULL; - notifyProc = NULL; - capturedMouse = false; - enteredSetScrollingSize = false; - scrollSpeed = 1; - scrollTicks = 2000; - tickTimer = NULL; - idleTimer = NULL; - observer = NULL; - layerFindIndicator = NULL; - imeInteraction = imeInline; - for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) - { - timers[tr] = nil; - } - Initialise(); +ScintillaCocoa::ScintillaCocoa(ScintillaView *sciView_, SCIContentView *viewContent, SCIMarginView *viewMargin) { + vs.marginInside = false; + + // Don't retain since we're owned by view, which would cause a cycle + sciView = sciView_; + wMain = (__bridge WindowID)viewContent; + wMargin = (__bridge WindowID)viewMargin; + + timerTarget = [[TimerTarget alloc] init: this]; + lastMouseEvent = NULL; + delegate = NULL; + notifyObj = NULL; + notifyProc = NULL; + capturedMouse = false; + enteredSetScrollingSize = false; + scrollSpeed = 1; + scrollTicks = 2000; + observer = NULL; + layerFindIndicator = NULL; + imeInteraction = imeInline; + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) { + timers[tr] = nil; + } + Init(); } //-------------------------------------------------------------------------------------------------- -ScintillaCocoa::~ScintillaCocoa() -{ - Finalise(); - [timerTarget release]; +ScintillaCocoa::~ScintillaCocoa() { + [timerTarget ownerDestroyed]; } //-------------------------------------------------------------------------------------------------- @@ -416,19 +420,18 @@ ScintillaCocoa::~ScintillaCocoa() /** * Core initialization of the control. Everything that needs to be set up happens here. */ -void ScintillaCocoa::Initialise() -{ - Scintilla_LinkLexers(); +void ScintillaCocoa::Init() { + Scintilla_LinkLexers(); - // Tell Scintilla not to buffer: Quartz buffers drawing for us. - WndProc(SCI_SETBUFFEREDDRAW, 0, 0); + // Tell Scintilla not to buffer: Quartz buffers drawing for us. + WndProc(SCI_SETBUFFEREDDRAW, 0, 0); - // We are working with Unicode exclusively. - WndProc(SCI_SETCODEPAGE, SC_CP_UTF8, 0); + // We are working with Unicode exclusively. + WndProc(SCI_SETCODEPAGE, SC_CP_UTF8, 0); - // Add Mac specific key bindings. - for (int i = 0; macMapDefault[i].key; i++) - kmap.AssignCmdKey(macMapDefault[i].key, macMapDefault[i].modifiers, macMapDefault[i].msg); + // Add Mac specific key bindings. + for (int i = 0; macMapDefault[i].key; i++) + kmap.AssignCmdKey(macMapDefault[i].key, macMapDefault[i].modifiers, macMapDefault[i].msg); } @@ -437,21 +440,19 @@ void ScintillaCocoa::Initialise() /** * We need some clean up. Do it here. */ -void ScintillaCocoa::Finalise() -{ - ObserverRemove(); - for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) - { - FineTickerCancel(tr); - } - ScintillaBase::Finalise(); +void ScintillaCocoa::Finalise() { + ObserverRemove(); + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) { + FineTickerCancel(tr); + } + ScintillaBase::Finalise(); } //-------------------------------------------------------------------------------------------------- void ScintillaCocoa::UpdateObserver(CFRunLoopObserverRef /* observer */, CFRunLoopActivity /* activity */, void *info) { - ScintillaCocoa* sci = reinterpret_cast(info); - sci->IdleWork(); + ScintillaCocoa *sci = static_cast(info); + sci->IdleWork(); } //-------------------------------------------------------------------------------------------------- @@ -461,19 +462,19 @@ void ScintillaCocoa::UpdateObserver(CFRunLoopObserverRef /* observer */, CFRunLo */ void ScintillaCocoa::ObserverAdd() { - if (!observer) { - CFRunLoopObserverContext context; - context.version = 0; - context.info = this; - context.retain = NULL; - context.release = NULL; - context.copyDescription = NULL; + if (!observer) { + CFRunLoopObserverContext context; + context.version = 0; + context.info = this; + context.retain = NULL; + context.release = NULL; + context.copyDescription = NULL; - CFRunLoopRef mainRunLoop = CFRunLoopGetMain(); - observer = CFRunLoopObserverCreate(NULL, kCFRunLoopEntry | kCFRunLoopBeforeWaiting, - true, 0, UpdateObserver, &context); - CFRunLoopAddObserver(mainRunLoop, observer, kCFRunLoopCommonModes); - } + CFRunLoopRef mainRunLoop = CFRunLoopGetMain(); + observer = CFRunLoopObserverCreate(NULL, kCFRunLoopEntry | kCFRunLoopBeforeWaiting, + true, 0, UpdateObserver, &context); + CFRunLoopAddObserver(mainRunLoop, observer, kCFRunLoopCommonModes); + } } //-------------------------------------------------------------------------------------------------- @@ -482,69 +483,65 @@ void ScintillaCocoa::ObserverAdd() { * Remove the run loop observer. */ void ScintillaCocoa::ObserverRemove() { - if (observer) { - CFRunLoopRef mainRunLoop = CFRunLoopGetMain(); - CFRunLoopRemoveObserver(mainRunLoop, observer, kCFRunLoopCommonModes); - CFRelease(observer); - } - observer = NULL; + if (observer) { + CFRunLoopRef mainRunLoop = CFRunLoopGetMain(); + CFRunLoopRemoveObserver(mainRunLoop, observer, kCFRunLoopCommonModes); + CFRelease(observer); + } + observer = NULL; } //-------------------------------------------------------------------------------------------------- void ScintillaCocoa::IdleWork() { - Editor::IdleWork(); - ObserverRemove(); + Editor::IdleWork(); + ObserverRemove(); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::QueueIdleWork(WorkNeeded::workItems items, int upTo) { - Editor::QueueIdleWork(items, upTo); - ObserverAdd(); +void ScintillaCocoa::QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) { + Editor::QueueIdleWork(items, upTo); + ObserverAdd(); } //-------------------------------------------------------------------------------------------------- /** - * Convert a core foundation string into an array of bytes in a particular encoding - */ - -static char *EncodedBytes(CFStringRef cfsRef, CFStringEncoding encoding) { - CFRange rangeAll = {0, CFStringGetLength(cfsRef)}; - CFIndex usedLen = 0; - CFStringGetBytes(cfsRef, rangeAll, encoding, '?', - false, NULL, 0, &usedLen); - - char *buffer = new char[usedLen+1]; - CFStringGetBytes(cfsRef, rangeAll, encoding, '?', - false, (UInt8 *)buffer,usedLen, NULL); - buffer[usedLen] = '\0'; - return buffer; -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Convert a core foundation string into a std::string in a particular encoding + * Convert a Core Foundation string into a std::string in a particular encoding. */ static std::string EncodedBytesString(CFStringRef cfsRef, CFStringEncoding encoding) { const CFRange rangeAll = {0, CFStringGetLength(cfsRef)}; CFIndex usedLen = 0; CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, - NULL, 0, &usedLen); - + NULL, 0, &usedLen); + std::string buffer(usedLen, '\0'); if (usedLen > 0) { CFStringGetBytes(cfsRef, rangeAll, encoding, '?', false, - reinterpret_cast(&buffer[0]), usedLen, NULL); + reinterpret_cast(&buffer[0]), usedLen, NULL); } return buffer; } //-------------------------------------------------------------------------------------------------- +/** + * Create a Core Foundation string from a string. + * This is a simple wrapper that specifies common arguments (the default allocator and + * false for isExternalRepresentation) and avoids casting since strings in Scintilla + * contain char, not UInt8 (unsigned char). + */ + +static CFStringRef CFStringFromString(const char *s, size_t len, CFStringEncoding encoding) { + return CFStringCreateWithBytes(kCFAllocatorDefault, + reinterpret_cast(s), + len, encoding, false); +} + +//-------------------------------------------------------------------------------------------------- + /** * Case folders. */ @@ -555,29 +552,30 @@ public: explicit CaseFolderDBCS(CFStringEncoding encoding_) : encoding(encoding_) { StandardASCII(); } - virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override { if ((lenMixed == 1) && (sizeFolded > 0)) { folded[0] = mapping[static_cast(mixed[0])]; return 1; } else { - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(mixed), - lenMixed, encoding, false); + CFStringRef cfsVal = CFStringFromString(mixed, lenMixed, encoding); + if (!cfsVal) { + folded[0] = '\0'; + return 1; + } - NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch - locale:[NSLocale currentLocale]]; + NSString *sMapped = [(__bridge NSString *)cfsVal stringByFoldingWithOptions: NSCaseInsensitiveSearch + locale: [NSLocale currentLocale]]; - char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); + std::string encoded = EncodedBytesString((__bridge CFStringRef)sMapped, encoding); - size_t lenMapped = strlen(encoded); - if (lenMapped < sizeFolded) { - memcpy(folded, encoded, lenMapped); - } else { - folded[0] = '\0'; - lenMapped = 1; - } - delete []encoded; - CFRelease(cfsVal); + size_t lenMapped = encoded.length(); + if (lenMapped < sizeFolded) { + memcpy(folded, encoded.c_str(), lenMapped); + } else { + folded[0] = '\0'; + lenMapped = 1; + } + CFRelease(cfsVal); return lenMapped; } } @@ -587,38 +585,34 @@ CaseFolder *ScintillaCocoa::CaseFolderForEncoding() { if (pdoc->dbcsCodePage == SC_CP_UTF8) { return new CaseFolderUnicode(); } else { - CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - if (pdoc->dbcsCodePage == 0) { - CaseFolderTable *pcf = new CaseFolderTable(); - pcf->StandardASCII(); - // Only for single byte encodings - for (int i=0x80; i<0x100; i++) { - char sCharacter[2] = "A"; - sCharacter[0] = static_cast(i); - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(sCharacter), - 1, encoding, false); - if (!cfsVal) - continue; + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + if (pdoc->dbcsCodePage == 0) { + CaseFolderTable *pcf = new CaseFolderTable(); + pcf->StandardASCII(); + // Only for single byte encodings + for (int i=0x80; i<0x100; i++) { + char sCharacter[2] = "A"; + sCharacter[0] = static_cast(i); + CFStringRef cfsVal = CFStringFromString(sCharacter, 1, encoding); + if (!cfsVal) + continue; - NSString *sMapped = [(NSString *)cfsVal stringByFoldingWithOptions:NSCaseInsensitiveSearch - locale:[NSLocale currentLocale]]; + NSString *sMapped = [(__bridge NSString *)cfsVal stringByFoldingWithOptions: NSCaseInsensitiveSearch + locale: [NSLocale currentLocale]]; - char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); + std::string encoded = EncodedBytesString((__bridge CFStringRef)sMapped, encoding); - if (strlen(encoded) == 1) { - pcf->SetTranslation(sCharacter[0], encoded[0]); - } + if (encoded.length() == 1) { + pcf->SetTranslation(sCharacter[0], encoded[0]); + } - delete []encoded; - CFRelease(cfsVal); - } - return pcf; - } else { - return new CaseFolderDBCS(encoding); - } - return 0; + CFRelease(cfsVal); + } + return pcf; + } else { + return new CaseFolderDBCS(encoding); + } } } @@ -628,44 +622,42 @@ CaseFolder *ScintillaCocoa::CaseFolderForEncoding() { /** * Case-fold the given string depending on the specified case mapping type. */ -std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) -{ - if ((s.size() == 0) || (caseMapping == cmSame)) - return s; +std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) { + if ((s.size() == 0) || (caseMapping == cmSame)) + return s; - if (IsUnicodeMode()) { - std::string retMapped(s.length() * maxExpansionCaseConversion, 0); - size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), - (caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower); - retMapped.resize(lenMapped); - return retMapped; - } + if (IsUnicodeMode()) { + std::string retMapped(s.length() * maxExpansionCaseConversion, 0); + size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), + (caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower); + retMapped.resize(lenMapped); + return retMapped; + } - CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(s.c_str()), - s.length(), encoding, false); + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); - NSString *sMapped; - switch (caseMapping) - { - case cmUpper: - sMapped = [(NSString *)cfsVal uppercaseString]; - break; - case cmLower: - sMapped = [(NSString *)cfsVal lowercaseString]; - break; - default: - sMapped = (NSString *)cfsVal; - } + CFStringRef cfsVal = CFStringFromString(s.c_str(), s.length(), encoding); + if (!cfsVal) { + return s; + } - // Back to encoding - char *encoded = EncodedBytes((CFStringRef)sMapped, encoding); - std::string result(encoded); - delete []encoded; - CFRelease(cfsVal); - return result; + NSString *sMapped; + switch (caseMapping) { + case cmUpper: + sMapped = ((__bridge NSString *)cfsVal).uppercaseString; + break; + case cmLower: + sMapped = ((__bridge NSString *)cfsVal).lowercaseString; + break; + default: + sMapped = (__bridge NSString *)cfsVal; + } + + // Back to encoding + std::string result = EncodedBytesString((__bridge CFStringRef)sMapped, encoding); + CFRelease(cfsVal); + return result; } //-------------------------------------------------------------------------------------------------- @@ -674,8 +666,8 @@ std::string ScintillaCocoa::CaseMapString(const std::string &s, int caseMapping) * Cancel all modes, both for base class and any find indicator. */ void ScintillaCocoa::CancelModes() { - ScintillaBase::CancelModes(); - HideFindIndicator(); + ScintillaBase::CancelModes(); + HideFindIndicator(); } //-------------------------------------------------------------------------------------------------- @@ -683,9 +675,9 @@ void ScintillaCocoa::CancelModes() { /** * Helper function to get the scrolling view. */ -NSScrollView* ScintillaCocoa::ScrollContainer() const { - NSView* container = static_cast(wMain.GetID()); - return static_cast([[container superview] superview]); +NSScrollView *ScintillaCocoa::ScrollContainer() const { + NSView *container = (__bridge NSView *)(wMain.GetID()); + return static_cast(container.superview.superview); } //-------------------------------------------------------------------------------------------------- @@ -693,9 +685,8 @@ NSScrollView* ScintillaCocoa::ScrollContainer() const { /** * Helper function to get the inner container which represents the actual "canvas" we work with. */ -SCIContentView* ScintillaCocoa::ContentView() -{ - return static_cast(wMain.GetID()); +SCIContentView *ScintillaCocoa::ContentView() { + return (__bridge SCIContentView *)(wMain.GetID()); } //-------------------------------------------------------------------------------------------------- @@ -703,11 +694,10 @@ SCIContentView* ScintillaCocoa::ContentView() /** * Return the top left visible point relative to the origin point of the whole document. */ -Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() const -{ - NSScrollView *scrollView = ScrollContainer(); - NSRect contentRect = [[scrollView contentView] bounds]; - return Point(static_cast(contentRect.origin.x), static_cast(contentRect.origin.y)); +Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() const { + NSScrollView *scrollView = ScrollContainer(); + NSRect contentRect = scrollView.contentView.bounds; + return Point(static_cast(contentRect.origin.x), static_cast(contentRect.origin.y)); } //-------------------------------------------------------------------------------------------------- @@ -717,13 +707,12 @@ Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() const * in order to make scrolling working properly. * The returned value is in document coordinates. */ -PRectangle ScintillaCocoa::GetClientRectangle() const -{ - NSScrollView *scrollView = ScrollContainer(); - NSSize size = [[scrollView contentView] bounds].size; - Point origin = GetVisibleOriginInMain(); - return PRectangle(origin.x, origin.y, static_cast(origin.x+size.width), - static_cast(origin.y + size.height)); +PRectangle ScintillaCocoa::GetClientRectangle() const { + NSScrollView *scrollView = ScrollContainer(); + NSSize size = scrollView.contentView.bounds.size; + Point origin = GetVisibleOriginInMain(); + return PRectangle(origin.x, origin.y, static_cast(origin.x+size.width), + static_cast(origin.y + size.height)); } //-------------------------------------------------------------------------------------------------- @@ -733,14 +722,14 @@ PRectangle ScintillaCocoa::GetClientRectangle() const */ PRectangle ScintillaCocoa::GetClientDrawingRectangle() { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 - NSView *content = ContentView(); - if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { - NSRect rcPrepared = [content preparedContentRect]; - if (!NSIsEmptyRect(rcPrepared)) - return NSRectToPRectangle(rcPrepared); - } + NSView *content = ContentView(); + if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { + NSRect rcPrepared = content.preparedContentRect; + if (!NSIsEmptyRect(rcPrepared)) + return NSRectToPRectangle(rcPrepared); + } #endif - return ScintillaCocoa::GetClientRectangle(); + return ScintillaCocoa::GetClientRectangle(); } //-------------------------------------------------------------------------------------------------- @@ -750,12 +739,11 @@ PRectangle ScintillaCocoa::GetClientDrawingRectangle() { * a native Point structure. Base coordinates are used for the top window used in the view hierarchy. * Returned value is in view coordinates. */ -Scintilla::Point ScintillaCocoa::ConvertPoint(NSPoint point) -{ - NSView* container = ContentView(); - NSPoint result = [container convertPoint: point fromView: nil]; - Scintilla::Point ptOrigin = GetVisibleOriginInMain(); - return Point(static_cast(result.x - ptOrigin.x), static_cast(result.y - ptOrigin.y)); +Scintilla::Point ScintillaCocoa::ConvertPoint(NSPoint point) { + NSView *container = ContentView(); + NSPoint result = [container convertPoint: point fromView: nil]; + Scintilla::Point ptOrigin = GetVisibleOriginInMain(); + return Point(static_cast(result.x - ptOrigin.x), static_cast(result.y - ptOrigin.y)); } //-------------------------------------------------------------------------------------------------- @@ -763,22 +751,20 @@ Scintilla::Point ScintillaCocoa::ConvertPoint(NSPoint point) /** * Do not clip like superclass as Cocoa is not reporting all of prepared area. */ -void ScintillaCocoa::RedrawRect(PRectangle rc) -{ - if (!rc.Empty()) - wMain.InvalidateRectangle(rc); +void ScintillaCocoa::RedrawRect(PRectangle rc) { + if (!rc.Empty()) + wMain.InvalidateRectangle(rc); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::DiscardOverdraw() -{ +void ScintillaCocoa::DiscardOverdraw() { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 - // If running on 10.9, reset prepared area to visible area - NSView *content = ContentView(); - if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { - content.preparedContentRect = [content visibleRect]; - } + // If running on 10.9, reset prepared area to visible area + NSView *content = ContentView(); + if ([content respondsToSelector: @selector(setPreparedContentRect:)]) { + content.preparedContentRect = content.visibleRect; + } #endif } @@ -787,11 +773,10 @@ void ScintillaCocoa::DiscardOverdraw() /** * Ensure all of prepared content is also redrawn. */ -void ScintillaCocoa::Redraw() -{ - wMargin.InvalidateAll(); - DiscardOverdraw(); - wMain.InvalidateAll(); +void ScintillaCocoa::Redraw() { + wMargin.InvalidateAll(); + DiscardOverdraw(); + wMain.InvalidateAll(); } //-------------------------------------------------------------------------------------------------- @@ -808,9 +793,8 @@ void ScintillaCocoa::Redraw() * @param lParam The other of the two free parameters. A signed long. */ sptr_t ScintillaCocoa::DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, - sptr_t lParam) -{ - return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); + sptr_t lParam) { + return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); } //-------------------------------------------------------------------------------------------------- @@ -819,10 +803,24 @@ sptr_t ScintillaCocoa::DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t * This method is very similar to DirectFunction. On Windows it sends a message (not in the Obj-C sense) * to the target window. Here we simply call our fake window proc. */ -sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) -{ - ScintillaView *control = reinterpret_cast(sci); - return [control message:iMessage wParam:wParam lParam:lParam]; +sptr_t scintilla_send_message(void *sci, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + ScintillaView *control = (__bridge ScintillaView *)(sci); + return [control message: iMessage wParam: wParam lParam: lParam]; +} + +//-------------------------------------------------------------------------------------------------- + +namespace { + +/** + * The animated find indicator fails with a "bogus layer size" message on macOS 10.13 + * and causes drawing failures on macOS 10.12. + */ + +bool SupportAnimatedFind() { + return floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12; +} + } //-------------------------------------------------------------------------------------------------- @@ -835,54 +833,78 @@ sptr_t scintilla_send_message(void* sci, unsigned int iMessage, uptr_t wParam, s * would be system messages on Windows (e.g. for key down, mouse move etc.) are handled by * directly calling appropriate handlers. */ -sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) -{ - switch (iMessage) - { - case SCI_GETDIRECTFUNCTION: - return reinterpret_cast(DirectFunction); +sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + try { + switch (iMessage) { + case SCI_GETDIRECTFUNCTION: + return reinterpret_cast(DirectFunction); - case SCI_GETDIRECTPOINTER: - return reinterpret_cast(this); + case SCI_GETDIRECTPOINTER: + return reinterpret_cast(this); - case SCI_TARGETASUTF8: - return TargetAsUTF8(reinterpret_cast(lParam)); + case SCI_SETBIDIRECTIONAL: + bidirectional = static_cast(wParam); + // Invalidate all cached information including layout. + DropGraphics(true); + InvalidateStyleRedraw(); + return 0; - case SCI_ENCODEDFROMUTF8: - return EncodedFromUTF8(reinterpret_cast(wParam), - reinterpret_cast(lParam)); + case SCI_TARGETASUTF8: + return TargetAsUTF8(CharPtrFromSPtr(lParam)); - case SCI_SETIMEINTERACTION: - // Only inline IME supported on Cocoa - break; + case SCI_ENCODEDFROMUTF8: + return EncodedFromUTF8(ConstCharPtrFromUPtr(wParam), + CharPtrFromSPtr(lParam)); - case SCI_GRABFOCUS: - [[ContentView() window] makeFirstResponder:ContentView()]; - break; + case SCI_SETIMEINTERACTION: + // Only inline IME supported on Cocoa + break; - case SCI_SETBUFFEREDDRAW: - // Buffered drawing not supported on Cocoa - view.bufferedDraw = false; - break; + case SCI_GRABFOCUS: + [ContentView().window makeFirstResponder: ContentView()]; + break; - case SCI_FINDINDICATORSHOW: - ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), YES); - return 0; + case SCI_SETBUFFEREDDRAW: + // Buffered drawing not supported on Cocoa + view.bufferedDraw = false; + break; - case SCI_FINDINDICATORFLASH: - ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), NO); - return 0; + case SCI_FINDINDICATORSHOW: + if (SupportAnimatedFind()) { + ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), YES); + } + return 0; - case SCI_FINDINDICATORHIDE: - HideFindIndicator(); - return 0; + case SCI_FINDINDICATORFLASH: + if (SupportAnimatedFind()) { + ShowFindIndicatorForRange(NSMakeRange(wParam, lParam-wParam), NO); + } + return 0; - default: - sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + case SCI_FINDINDICATORHIDE: + HideFindIndicator(); + return 0; - return r; - } - return 0l; + case SCI_SETPHASESDRAW: { + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + [sciView updateIndicatorIME]; + return r; + } + + case SCI_GETACCESSIBILITY: + return SC_ACCESSIBILITY_ENABLED; + + default: + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + + return r; + } + } catch (std::bad_alloc &) { + errorStatus = SC_STATUS_BADALLOC; + } catch (...) { + errorStatus = SC_STATUS_FAILURE; + } + return 0; } //-------------------------------------------------------------------------------------------------- @@ -891,9 +913,8 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar * In Windows lingo this is the handler which handles anything that wasn't handled in the normal * window proc which would usually send the message back to generic window proc that Windows uses. */ -sptr_t ScintillaCocoa::DefWndProc(unsigned int, uptr_t, sptr_t) -{ - return 0; +sptr_t ScintillaCocoa::DefWndProc(unsigned int, uptr_t, sptr_t) { + return 0; } //-------------------------------------------------------------------------------------------------- @@ -901,26 +922,12 @@ sptr_t ScintillaCocoa::DefWndProc(unsigned int, uptr_t, sptr_t) /** * Handle any ScintillaCocoa-specific ticking or call superclass. */ -void ScintillaCocoa::TickFor(TickReason reason) -{ - if (reason == tickPlatform) - { - DragScroll(); - } - else - { - Editor::TickFor(reason); - } -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Report that this Editor subclass has a working implementation of FineTickerStart. - */ -bool ScintillaCocoa::FineTickerAvailable() -{ - return true; +void ScintillaCocoa::TickFor(TickReason reason) { + if (reason == tickPlatform) { + DragScroll(); + } else { + Editor::TickFor(reason); + } } //-------------------------------------------------------------------------------------------------- @@ -928,9 +935,8 @@ bool ScintillaCocoa::FineTickerAvailable() /** * Is a particular timer currently running? */ -bool ScintillaCocoa::FineTickerRunning(TickReason reason) -{ - return timers[reason] != nil; +bool ScintillaCocoa::FineTickerRunning(TickReason reason) { + return timers[reason] != nil; } //-------------------------------------------------------------------------------------------------- @@ -938,19 +944,19 @@ bool ScintillaCocoa::FineTickerRunning(TickReason reason) /** * Start a fine-grained timer. */ -void ScintillaCocoa::FineTickerStart(TickReason reason, int millis, int tolerance) -{ - FineTickerCancel(reason); - NSTimer *fineTimer = [NSTimer scheduledTimerWithTimeInterval: millis / 1000.0 - target: timerTarget - selector: @selector(timerFired:) - userInfo: nil - repeats: YES]; - if (tolerance && [fineTimer respondsToSelector: @selector(setTolerance:)]) - { - [fineTimer setTolerance: tolerance / 1000.0]; - } - timers[reason] = fineTimer; +void ScintillaCocoa::FineTickerStart(TickReason reason, int millis, int tolerance) { + FineTickerCancel(reason); + NSTimer *fineTimer = [NSTimer timerWithTimeInterval: millis / 1000.0 + target: timerTarget + selector: @selector(timerFired:) + userInfo: nil + repeats: YES]; + if (tolerance && [fineTimer respondsToSelector: @selector(setTolerance:)]) { + fineTimer.tolerance = tolerance / 1000.0; + } + timers[reason] = fineTimer; + [NSRunLoop.currentRunLoop addTimer: fineTimer forMode: NSDefaultRunLoopMode]; + [NSRunLoop.currentRunLoop addTimer: fineTimer forMode: NSModalPanelRunLoopMode]; } //-------------------------------------------------------------------------------------------------- @@ -958,76 +964,64 @@ void ScintillaCocoa::FineTickerStart(TickReason reason, int millis, int toleranc /** * Cancel a fine-grained timer. */ -void ScintillaCocoa::FineTickerCancel(TickReason reason) -{ - if (timers[reason]) - { - [timers[reason] invalidate]; - timers[reason] = nil; - } +void ScintillaCocoa::FineTickerCancel(TickReason reason) { + if (timers[reason]) { + [timers[reason] invalidate]; + timers[reason] = nil; + } } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::SetIdle(bool on) -{ - if (idler.state != on) - { - idler.state = on; - if (idler.state) - { - // Scintilla ticks = milliseconds - idleTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 - target: timerTarget - selector: @selector(idleTimerFired:) - userInfo: nil - repeats: YES]; - idler.idlerID = reinterpret_cast(idleTimer); - } - else - if (idler.idlerID != NULL) - { - [reinterpret_cast(idler.idlerID) invalidate]; - idler.idlerID = 0; - } - } - return true; +bool ScintillaCocoa::SetIdle(bool on) { + if (idler.state != on) { + idler.state = on; + if (idler.state) { + // Scintilla ticks = milliseconds + NSTimer *idleTimer = [NSTimer scheduledTimerWithTimeInterval: timer.tickSize / 1000.0 + target: timerTarget + selector: @selector(idleTimerFired:) + userInfo: nil + repeats: YES]; + [NSRunLoop.currentRunLoop addTimer: idleTimer forMode: NSModalPanelRunLoopMode]; + idler.idlerID = (__bridge IdlerID)idleTimer; + } else if (idler.idlerID != NULL) { + [(__bridge NSTimer *)(idler.idlerID) invalidate]; + idler.idlerID = 0; + } + } + return true; } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::CopyToClipboard(const SelectionText &selectedText) -{ - SetPasteboardData([NSPasteboard generalPasteboard], selectedText); +void ScintillaCocoa::CopyToClipboard(const SelectionText &selectedText) { + SetPasteboardData([NSPasteboard generalPasteboard], selectedText); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::Copy() -{ - if (!sel.Empty()) - { - SelectionText selectedText; - CopySelectionRange(&selectedText); - CopyToClipboard(selectedText); - } +void ScintillaCocoa::Copy() { + if (!sel.Empty()) { + SelectionText selectedText; + CopySelectionRange(&selectedText); + CopyToClipboard(selectedText); + } } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::CanPaste() -{ - if (!Editor::CanPaste()) - return false; +bool ScintillaCocoa::CanPaste() { + if (!Editor::CanPaste()) + return false; - return GetPasteboardData([NSPasteboard generalPasteboard], NULL); + return GetPasteboardData([NSPasteboard generalPasteboard], NULL); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::Paste() -{ - Paste(false); +void ScintillaCocoa::Paste() { + Paste(false); } //-------------------------------------------------------------------------------------------------- @@ -1035,157 +1029,148 @@ void ScintillaCocoa::Paste() /** * Pastes data from the paste board into the editor. */ -void ScintillaCocoa::Paste(bool forceRectangular) -{ - SelectionText selectedText; - bool ok = GetPasteboardData([NSPasteboard generalPasteboard], &selectedText); - if (forceRectangular) - selectedText.rectangular = forceRectangular; +void ScintillaCocoa::Paste(bool forceRectangular) { + SelectionText selectedText; + bool ok = GetPasteboardData([NSPasteboard generalPasteboard], &selectedText); + if (forceRectangular) + selectedText.rectangular = forceRectangular; - if (!ok || selectedText.Empty()) - // No data or no flavor we support. - return; + if (!ok || selectedText.Empty()) + // No data or no flavor we support. + return; - pdoc->BeginUndoAction(); - ClearSelection(false); - InsertPasteShape(selectedText.Data(), static_cast(selectedText.Length()), - selectedText.rectangular ? pasteRectangular : pasteStream); - pdoc->EndUndoAction(); + pdoc->BeginUndoAction(); + ClearSelection(false); + InsertPasteShape(selectedText.Data(), selectedText.Length(), + selectedText.rectangular ? pasteRectangular : pasteStream); + pdoc->EndUndoAction(); - Redraw(); - EnsureCaretVisible(); + Redraw(); + EnsureCaretVisible(); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::CTPaint(void* gc, NSRect rc) { +void ScintillaCocoa::CTPaint(void *gc, NSRect rc) { #pragma unused(rc) - Surface *surfaceWindow = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); - if (surfaceWindow) { - surfaceWindow->Init(gc, wMain.GetID()); - surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ct.codePage); - surfaceWindow->SetDBCSMode(ct.codePage); - ct.PaintCT(surfaceWindow); - surfaceWindow->Release(); - delete surfaceWindow; - } + std::unique_ptr surfaceWindow(Surface::Allocate(SC_TECHNOLOGY_DEFAULT)); + surfaceWindow->Init(gc, wMain.GetID()); + surfaceWindow->SetUnicodeMode(SC_CP_UTF8 == ct.codePage); + surfaceWindow->SetDBCSMode(ct.codePage); + ct.PaintCT(surfaceWindow.get()); + surfaceWindow->Release(); } @interface CallTipView : NSControl { - ScintillaCocoa *sci; + ScintillaCocoa *sci; } @end @implementation CallTipView -- (NSView*) initWithFrame: (NSRect) frame { +- (NSView *) initWithFrame: (NSRect) frame { self = [super initWithFrame: frame]; if (self) { - sci = NULL; + sci = NULL; } return self; } -- (void) dealloc { - [super dealloc]; -} - (BOOL) isFlipped { return YES; } - (void) setSci: (ScintillaCocoa *) sci_ { - sci = sci_; + sci = sci_; } - (void) drawRect: (NSRect) needsDisplayInRect { - if (sci) { - CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; - sci->CTPaint(context, needsDisplayInRect); - } + if (sci) { + CGContextRef context = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; + sci->CTPaint(context, needsDisplayInRect); + } } - (void) mouseDown: (NSEvent *) event { - if (sci) { - sci->CallTipMouseDown([event locationInWindow]); - } + if (sci) { + sci->CallTipMouseDown(event.locationInWindow); + } } // On OS X, only the key view should modify the cursor so the calltip can't. // This view does not become key so resetCursorRects never called. - (void) resetCursorRects { - //[super resetCursorRects]; - //[self addCursorRect: [self bounds] cursor: [NSCursor arrowCursor]]; + //[super resetCursorRects]; + //[self addCursorRect: [self bounds] cursor: [NSCursor arrowCursor]]; } @end void ScintillaCocoa::CallTipMouseDown(NSPoint pt) { - NSRect rectBounds = [(NSView *)(ct.wDraw.GetID()) bounds]; - Point location(static_cast(pt.x), - static_cast(rectBounds.size.height - pt.y)); - ct.MouseClick(location); - CallTipClick(); + NSRect rectBounds = ((__bridge NSView *)(ct.wDraw.GetID())).bounds; + Point location(static_cast(pt.x), + static_cast(rectBounds.size.height - pt.y)); + ct.MouseClick(location); + CallTipClick(); } static bool HeightDifferent(WindowID wCallTip, PRectangle rc) { - NSWindow *callTip = (NSWindow *)wCallTip; - CGFloat height = NSHeight([callTip frame]); + NSWindow *callTip = (__bridge NSWindow *)wCallTip; + CGFloat height = NSHeight(callTip.frame); return height != rc.Height(); } void ScintillaCocoa::CreateCallTipWindow(PRectangle rc) { - if (ct.wCallTip.Created() && HeightDifferent(ct.wCallTip.GetID(), rc)) { - ct.wCallTip.Destroy(); - } - if (!ct.wCallTip.Created()) { - NSRect ctRect = NSMakeRect(rc.top,rc.bottom, rc.Width(), rc.Height()); - NSWindow *callTip = [[NSWindow alloc] initWithContentRect: ctRect - styleMask: NSBorderlessWindowMask - backing: NSBackingStoreBuffered - defer: NO]; - [callTip setLevel:NSFloatingWindowLevel]; - [callTip setHasShadow:YES]; - NSRect ctContent = NSMakeRect(0,0, rc.Width(), rc.Height()); - CallTipView *caption = [[CallTipView alloc] initWithFrame: ctContent]; - [caption setAutoresizingMask: NSViewWidthSizable | NSViewMaxYMargin]; - [caption setSci: this]; - [[callTip contentView] addSubview: caption]; - [callTip orderFront:caption]; - ct.wCallTip = callTip; - ct.wDraw = caption; - } + if (ct.wCallTip.Created() && HeightDifferent(ct.wCallTip.GetID(), rc)) { + ct.wCallTip.Destroy(); + } + if (!ct.wCallTip.Created()) { + NSRect ctRect = NSMakeRect(rc.top, rc.bottom, rc.Width(), rc.Height()); + NSWindow *callTip = [[NSWindow alloc] initWithContentRect: ctRect + styleMask: NSWindowStyleMaskBorderless + backing: NSBackingStoreBuffered + defer: NO]; + [callTip setLevel: NSFloatingWindowLevel]; + [callTip setHasShadow: YES]; + NSRect ctContent = NSMakeRect(0, 0, rc.Width(), rc.Height()); + CallTipView *caption = [[CallTipView alloc] initWithFrame: ctContent]; + caption.autoresizingMask = NSViewWidthSizable | NSViewMaxYMargin; + [caption setSci: this]; + [callTip.contentView addSubview: caption]; + [callTip orderFront: caption]; + ct.wCallTip = (__bridge_retained WindowID)callTip; + ct.wDraw = (__bridge WindowID)caption; + } } -void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) -{ - NSMenuItem* item; - ScintillaContextMenu *menu= reinterpret_cast(popup.GetID()); - [menu setOwner: this]; - [menu setAutoenablesItems: NO]; +void ScintillaCocoa::AddToPopUp(const char *label, int cmd, bool enabled) { + NSMenuItem *item; + ScintillaContextMenu *menu = (__bridge ScintillaContextMenu *)(popup.GetID()); + [menu setOwner: this]; + [menu setAutoenablesItems: NO]; - if (cmd == 0) { - item = [NSMenuItem separatorItem]; - } else { - item = [[[NSMenuItem alloc] init] autorelease]; - [item setTitle: [NSString stringWithUTF8String: label]]; - } - [item setTarget: menu]; - [item setAction: @selector(handleCommand:)]; - [item setTag: cmd]; - [item setEnabled: enabled]; + if (cmd == 0) { + item = [NSMenuItem separatorItem]; + } else { + item = [[NSMenuItem alloc] init]; + item.title = @(label); + } + item.target = menu; + item.action = @selector(handleCommand:); + item.tag = cmd; + item.enabled = enabled; - [menu addItem: item]; + [menu addItem: item]; } // ------------------------------------------------------------------------------------------------- -void ScintillaCocoa::ClaimSelection() -{ - // Mac OS X does not have a primary selection. +void ScintillaCocoa::ClaimSelection() { + // Mac OS X does not have a primary selection. } // ------------------------------------------------------------------------------------------------- @@ -1194,14 +1179,14 @@ void ScintillaCocoa::ClaimSelection() * Returns the current caret position (which is tracked as an offset into the entire text string) * as a row:column pair. The result is zero-based. */ -NSPoint ScintillaCocoa::GetCaretPosition() -{ - const int line = pdoc->LineFromPosition(sel.RangeMain().caret.Position()); - NSPoint result; +NSPoint ScintillaCocoa::GetCaretPosition() { + const Sci::Line line = static_cast( + pdoc->LineFromPosition(sel.RangeMain().caret.Position())); + NSPoint result; - result.y = line; - result.x = sel.RangeMain().caret.Position() - pdoc->LineStart(line); - return result; + result.y = line; + result.x = sel.RangeMain().caret.Position() - pdoc->LineStart(line); + return result; } // ------------------------------------------------------------------------------------------------- @@ -1211,96 +1196,86 @@ NSPoint ScintillaCocoa::GetCaretPosition() /** * Triggered by the tick timer on a regular basis to scroll the content during a drag operation. */ -void ScintillaCocoa::DragScroll() -{ - if (!posDrag.IsValid()) - { - scrollSpeed = 1; - scrollTicks = 2000; - return; - } +void ScintillaCocoa::DragScroll() { + if (!posDrag.IsValid()) { + scrollSpeed = 1; + scrollTicks = 2000; + return; + } - // TODO: does not work for wrapped lines, fix it. - int line = pdoc->LineFromPosition(posDrag.Position()); - int currentVisibleLine = cs.DisplayFromDoc(line); - int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen(), cs.LinesDisplayed()) - 2; + // TODO: does not work for wrapped lines, fix it. + Sci::Line line = static_cast(pdoc->LineFromPosition(posDrag.Position())); + Sci::Line currentVisibleLine = pcs->DisplayFromDoc(line); + Sci::Line lastVisibleLine = std::min(topLine + LinesOnScreen(), pcs->LinesDisplayed()) - 2; - if (currentVisibleLine <= topLine && topLine > 0) - ScrollTo(topLine - scrollSpeed); - else - if (currentVisibleLine >= lastVisibleLine) - ScrollTo(topLine + scrollSpeed); - else - { - scrollSpeed = 1; - scrollTicks = 2000; - return; - } + if (currentVisibleLine <= topLine && topLine > 0) + ScrollTo(topLine - scrollSpeed); + else if (currentVisibleLine >= lastVisibleLine) + ScrollTo(topLine + scrollSpeed); + else { + scrollSpeed = 1; + scrollTicks = 2000; + return; + } - // TODO: also handle horizontal scrolling. + // TODO: also handle horizontal scrolling. - if (scrollSpeed == 1) - { - scrollTicks -= timer.tickSize; - if (scrollTicks <= 0) - { - scrollSpeed = 5; - scrollTicks = 2000; - } - } + if (scrollSpeed == 1) { + scrollTicks -= timer.tickSize; + if (scrollTicks <= 0) { + scrollSpeed = 5; + scrollTicks = 2000; + } + } } //----------------- DragProviderSource ------------------------------------------------------- -@interface DragProviderSource : NSObject -{ - SelectionText selectedText; +@interface DragProviderSource : NSObject { + SelectionText selectedText; } @end @implementation DragProviderSource -- (id)initWithSelectedText:(const SelectionText *)other -{ - self = [super init]; - - if (self) { - selectedText.Copy(*other); - } - - return self; +- (id) initWithSelectedText: (const SelectionText *) other { + self = [super init]; + + if (self) { + selectedText.Copy(*other); + } + + return self; } -- (void)pasteboard:(NSPasteboard *)pasteboard item:(NSPasteboardItem *)item provideDataForType:(NSString *)type -{ - if (selectedText.Length() == 0) - return; +- (void) pasteboard: (NSPasteboard *) pasteboard item: (NSPasteboardItem *) item provideDataForType: (NSString *) type { +#pragma unused(item) + if (selectedText.Length() == 0) + return; - if (([type compare: NSPasteboardTypeString] != NSOrderedSame) && - ([type compare: ScintillaRecPboardType] != NSOrderedSame)) - return; + if (([type compare: NSPasteboardTypeString] != NSOrderedSame) && + ([type compare: ScintillaRecPboardType] != NSOrderedSame)) + return; - CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, - selectedText.characterSet); - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(selectedText.Data()), - selectedText.Length(), encoding, false); - - if ([type compare: NSPasteboardTypeString] == NSOrderedSame) - { - [pasteboard setString:(NSString *)cfsVal forType: NSStringPboardType]; - } - else if ([type compare: ScintillaRecPboardType] == NSOrderedSame) - { - // This is specific to scintilla, allows us to drag rectangular selections around the document. - if (selectedText.rectangular) - [pasteboard setString:(NSString *)cfsVal forType: ScintillaRecPboardType]; - } + CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, + selectedText.characterSet); - if (cfsVal) - CFRelease(cfsVal); + CFStringRef cfsVal = CFStringFromString(selectedText.Data(), selectedText.Length(), encoding); + if (!cfsVal) + return; + + if ([type compare: NSPasteboardTypeString] == NSOrderedSame) { + [pasteboard setString: (__bridge NSString *)cfsVal forType: NSStringPboardType]; + } else if ([type compare: ScintillaRecPboardType] == NSOrderedSame) { + // This is specific to scintilla, allows us to drag rectangular selections around the document. + if (selectedText.rectangular) + [pasteboard setString: (__bridge NSString *)cfsVal forType: ScintillaRecPboardType]; + } + + if (cfsVal) + CFRelease(cfsVal); } @end @@ -1310,182 +1285,165 @@ void ScintillaCocoa::DragScroll() /** * Called when a drag operation was initiated from within Scintilla. */ -void ScintillaCocoa::StartDrag() -{ - if (sel.Empty()) - return; +void ScintillaCocoa::StartDrag() { + if (sel.Empty()) + return; - inDragDrop = ddDragging; + inDragDrop = ddDragging; - FineTickerStart(tickPlatform, timer.tickSize, 0); + FineTickerStart(tickPlatform, timer.tickSize, 0); - // Put the data to be dragged on the drag pasteboard. - SelectionText selectedText; - NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard]; - CopySelectionRange(&selectedText); - SetPasteboardData(pasteboard, selectedText); + // Put the data to be dragged on the drag pasteboard. + SelectionText selectedText; + NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName: NSDragPboard]; + CopySelectionRange(&selectedText); + SetPasteboardData(pasteboard, selectedText); - // calculate the bounds of the selection - PRectangle client = GetTextRectangle(); - int selStart = sel.RangeMain().Start().Position(); - int selEnd = sel.RangeMain().End().Position(); - int startLine = pdoc->LineFromPosition(selStart); - int endLine = pdoc->LineFromPosition(selEnd); - Point pt; - long startPos, endPos, ep; - PRectangle rcSel; + // calculate the bounds of the selection + PRectangle client = GetTextRectangle(); + Sci::Position selStart = sel.RangeMain().Start().Position(); + Sci::Position selEnd = sel.RangeMain().End().Position(); + Sci::Line startLine = static_cast(pdoc->LineFromPosition(selStart)); + Sci::Line endLine = static_cast(pdoc->LineFromPosition(selEnd)); + Point pt; + Sci::Position startPos; + Sci::Position endPos; + Sci::Position ep; + PRectangle rcSel; - if (startLine==endLine && WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE) { - // Komodo bug http://bugs.activestate.com/show_bug.cgi?id=87571 - // Scintilla bug https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3040200&group_id=2439 - // If the width on a wrapped-line selection is negative, - // find a better bounding rectangle. + if (startLine==endLine && WndProc(SCI_GETWRAPMODE, 0, 0) != SC_WRAP_NONE) { + // Komodo bug http://bugs.activestate.com/show_bug.cgi?id=87571 + // Scintilla bug https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3040200&group_id=2439 + // If the width on a wrapped-line selection is negative, + // find a better bounding rectangle. - Point ptStart, ptEnd; - startPos = WndProc(SCI_GETLINESELSTARTPOSITION, startLine, 0); - endPos = WndProc(SCI_GETLINESELENDPOSITION, startLine, 0); - // step back a position if we're counting the newline - ep = WndProc(SCI_GETLINEENDPOSITION, startLine, 0); - if (endPos > ep) endPos = ep; - ptStart = LocationFromPosition(static_cast(startPos)); - ptEnd = LocationFromPosition(static_cast(endPos)); - if (ptStart.y == ptEnd.y) { - // We're just selecting part of one visible line - rcSel.left = ptStart.x; - rcSel.right = ptEnd.x < client.right ? ptEnd.x : client.right; - } else { - // Find the bounding box. - startPos = WndProc(SCI_POSITIONFROMLINE, startLine, 0); - rcSel.left = LocationFromPosition(static_cast(startPos)).x; - rcSel.right = client.right; - } - rcSel.top = ptStart.y; - rcSel.bottom = ptEnd.y + vs.lineHeight; - if (rcSel.bottom > client.bottom) { - rcSel.bottom = client.bottom; - } - } else { - rcSel.top = rcSel.bottom = rcSel.right = rcSel.left = -1; - for (int l = startLine; l <= endLine; l++) { - startPos = WndProc(SCI_GETLINESELSTARTPOSITION, l, 0); - endPos = WndProc(SCI_GETLINESELENDPOSITION, l, 0); - if (endPos == startPos) continue; - // step back a position if we're counting the newline - ep = WndProc(SCI_GETLINEENDPOSITION, l, 0); - if (endPos > ep) endPos = ep; - pt = LocationFromPosition(static_cast(startPos)); // top left of line selection - if (pt.x < rcSel.left || rcSel.left < 0) rcSel.left = pt.x; - if (pt.y < rcSel.top || rcSel.top < 0) rcSel.top = pt.y; - pt = LocationFromPosition(static_cast(endPos)); // top right of line selection - pt.y += vs.lineHeight; // get to the bottom of the line - if (pt.x > rcSel.right || rcSel.right < 0) { - if (pt.x > client.right) - rcSel.right = client.right; - else - rcSel.right = pt.x; - } - if (pt.y > rcSel.bottom || rcSel.bottom < 0) { - if (pt.y > client.bottom) - rcSel.bottom = client.bottom; - else - rcSel.bottom = pt.y; - } - } - } - // must convert to global coordinates for drag regions, but also save the - // image rectangle for further calculations and copy operations + Point ptStart, ptEnd; + startPos = WndProc(SCI_GETLINESELSTARTPOSITION, startLine, 0); + endPos = WndProc(SCI_GETLINESELENDPOSITION, startLine, 0); + // step back a position if we're counting the newline + ep = WndProc(SCI_GETLINEENDPOSITION, startLine, 0); + if (endPos > ep) endPos = ep; + ptStart = LocationFromPosition(startPos); + ptEnd = LocationFromPosition(endPos); + if (ptStart.y == ptEnd.y) { + // We're just selecting part of one visible line + rcSel.left = ptStart.x; + rcSel.right = ptEnd.x < client.right ? ptEnd.x : client.right; + } else { + // Find the bounding box. + startPos = WndProc(SCI_POSITIONFROMLINE, startLine, 0); + rcSel.left = LocationFromPosition(startPos).x; + rcSel.right = client.right; + } + rcSel.top = ptStart.y; + rcSel.bottom = ptEnd.y + vs.lineHeight; + if (rcSel.bottom > client.bottom) { + rcSel.bottom = client.bottom; + } + } else { + rcSel.top = rcSel.bottom = rcSel.right = rcSel.left = -1; + for (Sci::Line l = startLine; l <= endLine; l++) { + startPos = WndProc(SCI_GETLINESELSTARTPOSITION, l, 0); + endPos = WndProc(SCI_GETLINESELENDPOSITION, l, 0); + if (endPos == startPos) continue; + // step back a position if we're counting the newline + ep = WndProc(SCI_GETLINEENDPOSITION, l, 0); + if (endPos > ep) endPos = ep; + pt = LocationFromPosition(startPos); // top left of line selection + if (pt.x < rcSel.left || rcSel.left < 0) rcSel.left = pt.x; + if (pt.y < rcSel.top || rcSel.top < 0) rcSel.top = pt.y; + pt = LocationFromPosition(endPos); // top right of line selection + pt.y += vs.lineHeight; // get to the bottom of the line + if (pt.x > rcSel.right || rcSel.right < 0) { + if (pt.x > client.right) + rcSel.right = client.right; + else + rcSel.right = pt.x; + } + if (pt.y > rcSel.bottom || rcSel.bottom < 0) { + if (pt.y > client.bottom) + rcSel.bottom = client.bottom; + else + rcSel.bottom = pt.y; + } + } + } + // must convert to global coordinates for drag regions, but also save the + // image rectangle for further calculations and copy operations - // Prepare drag image. - NSRect selectionRectangle = PRectangleToNSRect(rcSel); + // Prepare drag image. + NSRect selectionRectangle = PRectangleToNSRect(rcSel); - SCIContentView* content = ContentView(); + SCIContentView *content = ContentView(); - // To get a bitmap of the text we're dragging, we just use Paint on a pixmap surface. - SurfaceImpl *sw = new SurfaceImpl(); - SurfaceImpl *pixmap = NULL; + // To get a bitmap of the text we're dragging, we just use Paint on a pixmap surface. + SurfaceImpl sw; + sw.InitPixMap(static_cast(client.Width()), static_cast(client.Height()), NULL, NULL); - bool lastHideSelection = view.hideSelection; - view.hideSelection = true; - if (sw) - { - pixmap = new SurfaceImpl(); - if (pixmap) - { - PRectangle imageRect = rcSel; - paintState = painting; - sw->InitPixMap(static_cast(client.Width()), static_cast(client.Height()), NULL, NULL); - paintingAllText = true; - // Have to create a new context and make current as text drawing goes - // to the current context, not a passed context. - CGContextRef gcsw = sw->GetContext(); - NSGraphicsContext *nsgc = [NSGraphicsContext graphicsContextWithGraphicsPort: gcsw - flipped: YES]; - [NSGraphicsContext setCurrentContext:nsgc]; - CGContextTranslateCTM(gcsw, -client.left, -client.top); - Paint(sw, client); - paintState = notPainting; + const bool lastHideSelection = view.hideSelection; + view.hideSelection = true; + PRectangle imageRect = rcSel; + paintState = painting; + paintingAllText = true; + CGContextRef gcsw = sw.GetContext(); + CGContextTranslateCTM(gcsw, -client.left, -client.top); + Paint(&sw, client); + paintState = notPainting; + view.hideSelection = lastHideSelection; - pixmap->InitPixMap(static_cast(imageRect.Width()), static_cast(imageRect.Height()), NULL, NULL); + SurfaceImpl pixmap; + pixmap.InitPixMap(static_cast(imageRect.Width()), static_cast(imageRect.Height()), NULL, NULL); + pixmap.SetUnicodeMode(IsUnicodeMode()); + pixmap.SetDBCSMode(CodePage()); - CGContextRef gc = pixmap->GetContext(); - // To make Paint() work on a bitmap, we have to flip our coordinates and translate the origin - CGContextTranslateCTM(gc, 0, imageRect.Height()); - CGContextScaleCTM(gc, 1.0, -1.0); + CGContextRef gc = pixmap.GetContext(); + // To make Paint() work on a bitmap, we have to flip our coordinates and translate the origin + CGContextTranslateCTM(gc, 0, imageRect.Height()); + CGContextScaleCTM(gc, 1.0, -1.0); - pixmap->CopyImageRectangle(*sw, imageRect, PRectangle(0.0f, 0.0f, imageRect.Width(), imageRect.Height())); - // XXX TODO: overwrite any part of the image that is not part of the - // selection to make it transparent. right now we just use - // the full rectangle which may include non-selected text. - } - sw->Release(); - delete sw; - } - view.hideSelection = lastHideSelection; + pixmap.CopyImageRectangle(sw, imageRect, PRectangle(0.0f, 0.0f, imageRect.Width(), imageRect.Height())); + // XXX TODO: overwrite any part of the image that is not part of the + // selection to make it transparent. right now we just use + // the full rectangle which may include non-selected text. - NSBitmapImageRep* bitmap = NULL; - if (pixmap) - { - CGImageRef imagePixmap = pixmap->GetImage(); - if (imagePixmap) - bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: imagePixmap] autorelease]; - CGImageRelease(imagePixmap); - pixmap->Release(); - delete pixmap; - } + NSBitmapImageRep *bitmap = NULL; + CGImageRef imagePixmap = pixmap.GetImage(); + if (imagePixmap) + bitmap = [[NSBitmapImageRep alloc] initWithCGImage: imagePixmap]; + CGImageRelease(imagePixmap); - NSImage* image = [[[NSImage alloc] initWithSize: selectionRectangle.size] autorelease]; - [image addRepresentation: bitmap]; + NSImage *image = [[NSImage alloc] initWithSize: selectionRectangle.size]; + [image addRepresentation: bitmap]; - NSImage* dragImage = [[[NSImage alloc] initWithSize: selectionRectangle.size] autorelease]; - [dragImage setBackgroundColor: [NSColor clearColor]]; - [dragImage lockFocus]; - [image drawAtPoint: NSZeroPoint fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 0.5]; - [dragImage unlockFocus]; + NSImage *dragImage = [[NSImage alloc] initWithSize: selectionRectangle.size]; + dragImage.backgroundColor = [NSColor clearColor]; + [dragImage lockFocus]; + [image drawAtPoint: NSZeroPoint fromRect: NSZeroRect operation: NSCompositingOperationSourceOver fraction: 0.5]; + [dragImage unlockFocus]; - NSPoint startPoint; - startPoint.x = selectionRectangle.origin.x + client.left; - startPoint.y = selectionRectangle.origin.y + selectionRectangle.size.height + client.top; - - NSPasteboardItem *pbItem = [NSPasteboardItem new]; - DragProviderSource *dps = [[[DragProviderSource alloc] initWithSelectedText:&selectedText] autorelease]; - - NSArray *pbTypes = selectedText.rectangular ? - @[NSPasteboardTypeString, ScintillaRecPboardType] : - @[NSPasteboardTypeString]; - [pbItem setDataProvider:dps forTypes:pbTypes]; - NSDraggingItem *dragItem = [[NSDraggingItem alloc ]initWithPasteboardWriter:pbItem]; - [pbItem release]; - - NSScrollView *scrollContainer = ScrollContainer(); - NSRect contentRect = [[scrollContainer contentView] bounds]; - NSRect draggingRect = NSOffsetRect(selectionRectangle, contentRect.origin.x, contentRect.origin.y); - [dragItem setDraggingFrame:draggingRect contents:dragImage]; - NSDraggingSession *dragSession = - [content beginDraggingSessionWithItems:@[[dragItem autorelease]] - event:lastMouseEvent - source:content]; - dragSession.animatesToStartingPositionsOnCancelOrFail = YES; - dragSession.draggingFormation = NSDraggingFormationNone; + NSPoint startPoint; + startPoint.x = selectionRectangle.origin.x + client.left; + startPoint.y = selectionRectangle.origin.y + selectionRectangle.size.height + client.top; + + NSPasteboardItem *pbItem = [NSPasteboardItem new]; + DragProviderSource *dps = [[DragProviderSource alloc] initWithSelectedText: &selectedText]; + + NSArray *pbTypes = selectedText.rectangular ? + @[NSPasteboardTypeString, ScintillaRecPboardType] : + @[NSPasteboardTypeString]; + [pbItem setDataProvider: dps forTypes: pbTypes]; + NSDraggingItem *dragItem = [[NSDraggingItem alloc ]initWithPasteboardWriter: pbItem]; + + NSScrollView *scrollContainer = ScrollContainer(); + NSRect contentRect = scrollContainer.contentView.bounds; + NSRect draggingRect = NSOffsetRect(selectionRectangle, contentRect.origin.x, contentRect.origin.y); + [dragItem setDraggingFrame: draggingRect contents: dragImage]; + NSDraggingSession *dragSession = + [content beginDraggingSessionWithItems: @[dragItem] + event: lastMouseEvent + source: content]; + dragSession.animatesToStartingPositionsOnCancelOrFail = YES; + dragSession.draggingFormation = NSDraggingFormationNone; } //-------------------------------------------------------------------------------------------------- @@ -1493,10 +1451,9 @@ void ScintillaCocoa::StartDrag() /** * Called when a drag operation reaches the control which was initiated outside. */ -NSDragOperation ScintillaCocoa::DraggingEntered(id info) -{ - FineTickerStart(tickPlatform, timer.tickSize, 0); - return DraggingUpdated(info); +NSDragOperation ScintillaCocoa::DraggingEntered(id info) { + FineTickerStart(tickPlatform, timer.tickSize, 0); + return DraggingUpdated(info); } //-------------------------------------------------------------------------------------------------- @@ -1506,27 +1463,26 @@ NSDragOperation ScintillaCocoa::DraggingEntered(id info) * what drag operation we accept and update the drop caret position to indicate the * potential insertion point of the dragged data. */ -NSDragOperation ScintillaCocoa::DraggingUpdated(id info) -{ - // Convert the drag location from window coordinates to view coordinates and - // from there to a text position to finally set the drag position. - Point location = ConvertPoint([info draggingLocation]); - SetDragPosition(SPositionFromLocation(location)); +NSDragOperation ScintillaCocoa::DraggingUpdated(id info) { + // Convert the drag location from window coordinates to view coordinates and + // from there to a text position to finally set the drag position. + Point location = ConvertPoint([info draggingLocation]); + SetDragPosition(SPositionFromLocation(location)); - NSDragOperation sourceDragMask = [info draggingSourceOperationMask]; - if (sourceDragMask == NSDragOperationNone) - return sourceDragMask; + NSDragOperation sourceDragMask = [info draggingSourceOperationMask]; + if (sourceDragMask == NSDragOperationNone) + return sourceDragMask; - NSPasteboard* pasteboard = [info draggingPasteboard]; + NSPasteboard *pasteboard = [info draggingPasteboard]; - // Return what type of operation we will perform. Prefer move over copy. - if ([[pasteboard types] containsObject: NSStringPboardType] || - [[pasteboard types] containsObject: ScintillaRecPboardType]) - return (sourceDragMask & NSDragOperationMove) ? NSDragOperationMove : NSDragOperationCopy; + // Return what type of operation we will perform. Prefer move over copy. + if ([pasteboard.types containsObject: NSStringPboardType] || + [pasteboard.types containsObject: ScintillaRecPboardType]) + return (sourceDragMask & NSDragOperationMove) ? NSDragOperationMove : NSDragOperationCopy; - if ([[pasteboard types] containsObject: NSFilenamesPboardType]) - return (sourceDragMask & NSDragOperationGeneric); - return NSDragOperationNone; + if ([pasteboard.types containsObject: NSFilenamesPboardType]) + return (sourceDragMask & NSDragOperationGeneric); + return NSDragOperationNone; } //-------------------------------------------------------------------------------------------------- @@ -1534,12 +1490,11 @@ NSDragOperation ScintillaCocoa::DraggingUpdated(id info) /** * Resets the current drag position as we are no longer the drag target. */ -void ScintillaCocoa::DraggingExited(id info) -{ +void ScintillaCocoa::DraggingExited(id info) { #pragma unused(info) - SetDragPosition(SelectionPosition(invalidPosition)); - FineTickerCancel(tickPlatform); - inDragDrop = ddNone; + SetDragPosition(SelectionPosition(Sci::invalidPosition)); + FineTickerCancel(tickPlatform); + inDragDrop = ddNone; } //-------------------------------------------------------------------------------------------------- @@ -1547,61 +1502,55 @@ void ScintillaCocoa::DraggingExited(id info) /** * Here is where the real work is done. Insert the text from the pasteboard. */ -bool ScintillaCocoa::PerformDragOperation(id info) -{ - NSPasteboard* pasteboard = [info draggingPasteboard]; +bool ScintillaCocoa::PerformDragOperation(id info) { + NSPasteboard *pasteboard = [info draggingPasteboard]; - if ([[pasteboard types] containsObject: NSFilenamesPboardType]) - { - NSArray* files = [pasteboard propertyListForType: NSFilenamesPboardType]; - for (NSString* uri in files) - NotifyURIDropped([uri UTF8String]); - } - else - { - SelectionText text; - GetPasteboardData(pasteboard, &text); + if ([pasteboard.types containsObject: NSFilenamesPboardType]) { + NSArray *files = [pasteboard propertyListForType: NSFilenamesPboardType]; + for (NSString* uri in files) + NotifyURIDropped(uri.UTF8String); + } else { + SelectionText text; + GetPasteboardData(pasteboard, &text); - if (text.Length() > 0) - { - NSDragOperation operation = [info draggingSourceOperationMask]; - bool moving = (operation & NSDragOperationMove) != 0; + if (text.Length() > 0) { + NSDragOperation operation = [info draggingSourceOperationMask]; + bool moving = (operation & NSDragOperationMove) != 0; - DropAt(posDrag, text.Data(), text.Length(), moving, text.rectangular); - }; - } + DropAt(posDrag, text.Data(), text.Length(), moving, text.rectangular); + }; + } - return true; + return true; } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::SetPasteboardData(NSPasteboard* board, const SelectionText &selectedText) -{ - if (selectedText.Length() == 0) - return; +void ScintillaCocoa::SetPasteboardData(NSPasteboard *board, const SelectionText &selectedText) { + if (selectedText.Length() == 0) + return; - CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, - selectedText.characterSet); - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(selectedText.Data()), - selectedText.Length(), encoding, false); + CFStringEncoding encoding = EncodingFromCharacterSet(selectedText.codePage == SC_CP_UTF8, + selectedText.characterSet); - NSArray *pbTypes = selectedText.rectangular ? - [NSArray arrayWithObjects: NSStringPboardType, ScintillaRecPboardType, nil] : - [NSArray arrayWithObjects: NSStringPboardType, nil]; - [board declareTypes:pbTypes owner:nil]; + CFStringRef cfsVal = CFStringFromString(selectedText.Data(), selectedText.Length(), encoding); + if (!cfsVal) + return; - if (selectedText.rectangular) - { - // This is specific to scintilla, allows us to drag rectangular selections around the document. - [board setString: (NSString *)cfsVal forType: ScintillaRecPboardType]; - } + NSArray *pbTypes = selectedText.rectangular ? + @[NSStringPboardType, ScintillaRecPboardType] : + @[NSStringPboardType]; + [board declareTypes: pbTypes owner: nil]; - [board setString: (NSString *)cfsVal forType: NSStringPboardType]; + if (selectedText.rectangular) { + // This is specific to scintilla, allows us to drag rectangular selections around the document. + [board setString: (__bridge NSString *)cfsVal forType: ScintillaRecPboardType]; + } - if (cfsVal) - CFRelease(cfsVal); + [board setString: (__bridge NSString *)cfsVal forType: NSStringPboardType]; + + if (cfsVal) + CFRelease(cfsVal); } //-------------------------------------------------------------------------------------------------- @@ -1609,117 +1558,177 @@ void ScintillaCocoa::SetPasteboardData(NSPasteboard* board, const SelectionText /** * Helper method to retrieve the best fitting alternative from the general pasteboard. */ -bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selectedText) -{ - NSArray* supportedTypes = [NSArray arrayWithObjects: ScintillaRecPboardType, - NSStringPboardType, - nil]; - NSString *bestType = [board availableTypeFromArray: supportedTypes]; - NSString* data = [board stringForType: bestType]; +bool ScintillaCocoa::GetPasteboardData(NSPasteboard *board, SelectionText *selectedText) { + NSArray *supportedTypes = @[ScintillaRecPboardType, + NSStringPboardType]; + NSString *bestType = [board availableTypeFromArray: supportedTypes]; + NSString *data = [board stringForType: bestType]; - if (data != nil) - { - if (selectedText != nil) - { - CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - CFRange rangeAll = {0, static_cast([data length])}; - CFIndex usedLen = 0; - CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', - false, NULL, 0, &usedLen); + if (data != nil) { + if (selectedText != nil) { + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + CFRange rangeAll = {0, static_cast(data.length)}; + CFIndex usedLen = 0; + CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', + false, NULL, 0, &usedLen); - std::vector buffer(usedLen); + std::vector buffer(usedLen); - CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', - false, buffer.data(),usedLen, NULL); + CFStringGetBytes((CFStringRef)data, rangeAll, encoding, '?', + false, buffer.data(), usedLen, NULL); - bool rectangular = bestType == ScintillaRecPboardType; + bool rectangular = bestType == ScintillaRecPboardType; - std::string dest(reinterpret_cast(buffer.data()), usedLen); + std::string dest(reinterpret_cast(buffer.data()), usedLen); - selectedText->Copy(dest, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet , rectangular, false); - } - return true; - } + selectedText->Copy(dest, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet, rectangular, false); + } + return true; + } - return false; + return false; } //-------------------------------------------------------------------------------------------------- // Returns the target converted to UTF8. // Return the length in bytes. -int ScintillaCocoa::TargetAsUTF8(char *text) -{ - const int targetLength = targetEnd - targetStart; - if (IsUnicodeMode()) - { - if (text) - pdoc->GetCharRange(text, targetStart, targetLength); - } - else - { - // Need to convert - const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - const std::string s = RangeText(targetStart, targetEnd); - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(s.c_str()), - s.length(), encoding, false); - - const std::string tmputf = EncodedBytesString(cfsVal, kCFStringEncodingUTF8); - - if (text) - memcpy(text, tmputf.c_str(), tmputf.length()); - CFRelease(cfsVal); - return tmputf.length(); - } - return targetLength; +Sci::Position ScintillaCocoa::TargetAsUTF8(char *text) const { + const Sci::Position targetLength = targetEnd - targetStart; + if (IsUnicodeMode()) { + if (text) + pdoc->GetCharRange(text, targetStart, targetLength); + } else { + // Need to convert + const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + const std::string s = RangeText(targetStart, targetEnd); + CFStringRef cfsVal = CFStringFromString(s.c_str(), s.length(), encoding); + if (!cfsVal) { + return 0; + } + + const std::string tmputf = EncodedBytesString(cfsVal, kCFStringEncodingUTF8); + + if (text) + memcpy(text, tmputf.c_str(), tmputf.length()); + CFRelease(cfsVal); + return tmputf.length(); + } + return targetLength; +} + +//-------------------------------------------------------------------------------------------------- + +// Returns the text in the range converted to an NSString. +NSString *ScintillaCocoa::RangeTextAsString(NSRange rangePositions) const { + const std::string text = RangeText(rangePositions.location, + NSMaxRange(rangePositions)); + if (IsUnicodeMode()) { + return @(text.c_str()); + } else { + // Need to convert + const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + CFStringRef cfsVal = CFStringFromString(text.c_str(), text.length(), encoding); + + return (__bridge NSString *)cfsVal; + } +} + +//-------------------------------------------------------------------------------------------------- + +// Return character range of a line. +NSRange ScintillaCocoa::RangeForVisibleLine(NSInteger lineVisible) { + const Range posRangeLine = RangeDisplayLine(static_cast(lineVisible)); + return CharactersFromPositions(NSMakeRange(posRangeLine.First(), + posRangeLine.Last() - posRangeLine.First())); +} + +//-------------------------------------------------------------------------------------------------- + +// Returns visible line number of a text position in characters. +NSInteger ScintillaCocoa::VisibleLineForIndex(NSInteger index) { + const NSRange rangePosition = PositionsFromCharacters(NSMakeRange(index, 0)); + const Sci::Line lineVisible = DisplayFromPosition(rangePosition.location); + return lineVisible; +} + +//-------------------------------------------------------------------------------------------------- + +// Returns a rectangle that frames the range for use by the VoiceOver cursor. +NSRect ScintillaCocoa::FrameForRange(NSRange rangeCharacters) { + const NSRange posRange = PositionsFromCharacters(rangeCharacters); + + NSUInteger rangeEnd = NSMaxRange(posRange); + const bool endsWithLineEnd = rangeCharacters.length && + (pdoc->GetColumn(rangeEnd) == 0); + + Point ptStart = LocationFromPosition(posRange.location); + const PointEnd peEndRange = static_cast(peSubLineEnd|peLineEnd); + Point ptEnd = LocationFromPosition(rangeEnd, peEndRange); + + NSRect rect = NSMakeRect(ptStart.x, ptStart.y, + ptEnd.x - ptStart.x, + ptEnd.y - ptStart.y); + + rect.size.width += 2; // Shows the last character better + if (endsWithLineEnd) { + // Add a block to the right to indicate a line end is selected + rect.size.width += 20; + } + + rect.size.height += vs.lineHeight; + + // Adjust for margin and scroll + rect.origin.x = rect.origin.x - vs.textStart + vs.fixedColumnWidth; + + return rect; +} + +//-------------------------------------------------------------------------------------------------- + +// Returns a rectangle that frames the range for use by the VoiceOver cursor. +NSRect ScintillaCocoa::GetBounds() const { + return PRectangleToNSRect(GetClientRectangle()); } //-------------------------------------------------------------------------------------------------- // Translates a UTF8 string into the document encoding. // Return the length of the result in bytes. -int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const -{ - const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); - if (IsUnicodeMode()) - { - if (encoded) - memcpy(encoded, utf8, inputLength); - return inputLength; - } - else - { - // Need to convert - const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - - CFStringRef cfsVal = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(utf8), - inputLength, kCFStringEncodingUTF8, false); - const std::string sEncoded = EncodedBytesString(cfsVal, encoding); - if (encoded) - memcpy(encoded, sEncoded.c_str(), sEncoded.length()); - CFRelease(cfsVal); - return sEncoded.length(); - } +Sci::Position ScintillaCocoa::EncodedFromUTF8(const char *utf8, char *encoded) const { + const size_t inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); + if (IsUnicodeMode()) { + if (encoded) + memcpy(encoded, utf8, inputLength); + return inputLength; + } else { + // Need to convert + const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + + CFStringRef cfsVal = CFStringFromString(utf8, inputLength, kCFStringEncodingUTF8); + const std::string sEncoded = EncodedBytesString(cfsVal, encoding); + if (encoded) + memcpy(encoded, sEncoded.c_str(), sEncoded.length()); + CFRelease(cfsVal); + return sEncoded.length(); + } } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::SetMouseCapture(bool on) -{ - capturedMouse = on; +void ScintillaCocoa::SetMouseCapture(bool on) { + capturedMouse = on; } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::HaveMouseCapture() -{ - return capturedMouse; +bool ScintillaCocoa::HaveMouseCapture() { + return capturedMouse; } //-------------------------------------------------------------------------------------------------- @@ -1727,36 +1736,29 @@ bool ScintillaCocoa::HaveMouseCapture() /** * Synchronously paint a rectangle of the window. */ -bool ScintillaCocoa::SyncPaint(void* gc, PRectangle rc) -{ - paintState = painting; - rcPaint = rc; - PRectangle rcText = GetTextRectangle(); - paintingAllText = rcPaint.Contains(rcText); - bool succeeded = true; - Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); - if (sw) - { - CGContextSetAllowsAntialiasing((CGContextRef)gc, - vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); - CGContextSetAllowsFontSmoothing((CGContextRef)gc, - vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); - CGContextSetAllowsFontSubpixelPositioning((CGContextRef)gc, - vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || - vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); - sw->Init(gc, wMain.GetID()); - Paint(sw, rc); - succeeded = paintState != paintAbandoned; - sw->Release(); - delete sw; - } - paintState = notPainting; - if (!succeeded) - { - NSView *marginView = static_cast(wMargin.GetID()); - [marginView setNeedsDisplay:YES]; - } - return succeeded; +bool ScintillaCocoa::SyncPaint(void *gc, PRectangle rc) { + paintState = painting; + rcPaint = rc; + PRectangle rcText = GetTextRectangle(); + paintingAllText = rcPaint.Contains(rcText); + std::unique_ptr sw(Surface::Allocate(SC_TECHNOLOGY_DEFAULT)); + CGContextSetAllowsAntialiasing((CGContextRef)gc, + vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); + CGContextSetAllowsFontSmoothing((CGContextRef)gc, + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); + CGContextSetAllowsFontSubpixelPositioning((CGContextRef)gc, + vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); + sw->Init(gc, wMain.GetID()); + Paint(sw.get(), rc); + const bool succeeded = paintState != paintAbandoned; + sw->Release(); + paintState = notPainting; + if (!succeeded) { + NSView *marginView = (__bridge NSView *)(wMargin.GetID()); + [marginView setNeedsDisplay: YES]; + } + return succeeded; } //-------------------------------------------------------------------------------------------------- @@ -1764,27 +1766,24 @@ bool ScintillaCocoa::SyncPaint(void* gc, PRectangle rc) /** * Paint the margin into the SCIMarginView space. */ -void ScintillaCocoa::PaintMargin(NSRect aRect) -{ - CGContextRef gc = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; +void ScintillaCocoa::PaintMargin(NSRect aRect) { + CGContextRef gc = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; - PRectangle rc = NSRectToPRectangle(aRect); - rcPaint = rc; - Surface *sw = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); - if (sw) - { - CGContextSetAllowsAntialiasing(gc, - vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); - CGContextSetAllowsFontSmoothing(gc, - vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); - CGContextSetAllowsFontSubpixelPositioning(gc, - vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || - vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); - sw->Init(gc, wMargin.GetID()); - PaintSelMargin(sw, rc); - sw->Release(); - delete sw; - } + PRectangle rc = NSRectToPRectangle(aRect); + rcPaint = rc; + std::unique_ptr sw(Surface::Allocate(SC_TECHNOLOGY_DEFAULT)); + if (sw) { + CGContextSetAllowsAntialiasing(gc, + vs.extraFontFlag != SC_EFF_QUALITY_NON_ANTIALIASED); + CGContextSetAllowsFontSmoothing(gc, + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); + CGContextSetAllowsFontSubpixelPositioning(gc, + vs.extraFontFlag == SC_EFF_QUALITY_DEFAULT || + vs.extraFontFlag == SC_EFF_QUALITY_LCD_OPTIMIZED); + sw->Init(gc, wMargin.GetID()); + PaintSelMargin(sw.get(), rc); + sw->Release(); + } } //-------------------------------------------------------------------------------------------------- @@ -1794,20 +1793,21 @@ void ScintillaCocoa::PaintMargin(NSRect aRect) * * @param rect The area that will be drawn, given in the sender's coordinate system. */ -void ScintillaCocoa::WillDraw(NSRect rect) -{ - RefreshStyleData(); - PRectangle rcWillDraw = NSRectToPRectangle(rect); - int positionAfterRect = PositionAfterArea(rcWillDraw); - pdoc->EnsureStyledTo(positionAfterRect); - NotifyUpdateUI(); - if (WrapLines(wsVisible)) { - // Wrap may have reduced number of lines so more lines may need to be styled - positionAfterRect = PositionAfterArea(rcWillDraw); - pdoc->EnsureStyledTo(positionAfterRect); - // The wrapping process has changed the height of some lines so redraw all. - Redraw(); - } +void ScintillaCocoa::WillDraw(NSRect rect) { + RefreshStyleData(); + PRectangle rcWillDraw = NSRectToPRectangle(rect); + const Sci::Position posAfterArea = PositionAfterArea(rcWillDraw); + const Sci::Position posAfterMax = PositionAfterMaxStyling(posAfterArea, true); + pdoc->StyleToAdjustingLineDuration(posAfterMax); + StartIdleStyling(posAfterMax < posAfterArea); + NotifyUpdateUI(); + if (WrapLines(WrapScope::wsVisible)) { + // Wrap may have reduced number of lines so more lines may need to be styled + const Sci::Position posAfterAreaWrapped = PositionAfterArea(rcWillDraw); + pdoc->EnsureStyledTo(posAfterAreaWrapped); + // The wrapping process has changed the height of some lines so redraw all. + Redraw(); + } } //-------------------------------------------------------------------------------------------------- @@ -1815,8 +1815,7 @@ void ScintillaCocoa::WillDraw(NSRect rect) /** * ScrollText is empty because scrolling is handled by the NSScrollView. */ -void ScintillaCocoa::ScrollText(int) -{ +void ScintillaCocoa::ScrollText(Sci::Line) { } //-------------------------------------------------------------------------------------------------- @@ -1824,15 +1823,14 @@ void ScintillaCocoa::ScrollText(int) /** * Modifies the vertical scroll position to make the current top line show up as such. */ -void ScintillaCocoa::SetVerticalScrollPos() -{ - NSScrollView *scrollView = ScrollContainer(); - if (scrollView) { - NSClipView *clipView = [scrollView contentView]; - NSRect contentRect = [clipView bounds]; - [clipView scrollToPoint: NSMakePoint(contentRect.origin.x, topLine * vs.lineHeight)]; - [scrollView reflectScrolledClipView:clipView]; - } +void ScintillaCocoa::SetVerticalScrollPos() { + NSScrollView *scrollView = ScrollContainer(); + if (scrollView) { + NSClipView *clipView = scrollView.contentView; + NSRect contentRect = clipView.bounds; + [clipView scrollToPoint: NSMakePoint(contentRect.origin.x, topLine * vs.lineHeight)]; + [scrollView reflectScrolledClipView: clipView]; + } } //-------------------------------------------------------------------------------------------------- @@ -1840,23 +1838,22 @@ void ScintillaCocoa::SetVerticalScrollPos() /** * Modifies the horizontal scroll position to match xOffset. */ -void ScintillaCocoa::SetHorizontalScrollPos() -{ - PRectangle textRect = GetTextRectangle(); +void ScintillaCocoa::SetHorizontalScrollPos() { + PRectangle textRect = GetTextRectangle(); - int maxXOffset = scrollWidth - static_cast(textRect.Width()); - if (maxXOffset < 0) - maxXOffset = 0; - if (xOffset > maxXOffset) - xOffset = maxXOffset; - NSScrollView *scrollView = ScrollContainer(); - if (scrollView) { - NSClipView * clipView = [scrollView contentView]; - NSRect contentRect = [clipView bounds]; - [clipView scrollToPoint: NSMakePoint(xOffset, contentRect.origin.y)]; - [scrollView reflectScrolledClipView:clipView]; - } - MoveFindIndicatorWithBounce(NO); + int maxXOffset = scrollWidth - static_cast(textRect.Width()); + if (maxXOffset < 0) + maxXOffset = 0; + if (xOffset > maxXOffset) + xOffset = maxXOffset; + NSScrollView *scrollView = ScrollContainer(); + if (scrollView) { + NSClipView *clipView = scrollView.contentView; + NSRect contentRect = clipView.bounds; + [clipView scrollToPoint: NSMakePoint(xOffset, contentRect.origin.y)]; + [scrollView reflectScrolledClipView: clipView]; + } + MoveFindIndicatorWithBounce(NO); } //-------------------------------------------------------------------------------------------------- @@ -1869,10 +1866,9 @@ void ScintillaCocoa::SetHorizontalScrollPos() * @param nPage Number of lines per scroll page. * @return True if there was a change, otherwise false. */ -bool ScintillaCocoa::ModifyScrollBars(int nMax, int nPage) -{ +bool ScintillaCocoa::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) { #pragma unused(nMax, nPage) - return SetScrollingSize(); + return SetScrollingSize(); } bool ScintillaCocoa::SetScrollingSize(void) { @@ -1881,11 +1877,11 @@ bool ScintillaCocoa::SetScrollingSize(void) { if (!enteredSetScrollingSize) { enteredSetScrollingSize = true; NSScrollView *scrollView = ScrollContainer(); - NSClipView *clipView = [ScrollContainer() contentView]; - NSRect clipRect = [clipView bounds]; - CGFloat docHeight = cs.LinesDisplayed() * vs.lineHeight; + NSClipView *clipView = ScrollContainer().contentView; + NSRect clipRect = clipView.bounds; + CGFloat docHeight = pcs->LinesDisplayed() * vs.lineHeight; if (!endAtLastLine) - docHeight += (int([scrollView bounds].size.height / vs.lineHeight)-3) * vs.lineHeight; + docHeight += (int(scrollView.bounds.size.height / vs.lineHeight)-3) * vs.lineHeight; // Allow extra space so that last scroll position places whole line at top int clipExtra = int(clipRect.size.height) % vs.lineHeight; docHeight += clipExtra; @@ -1894,31 +1890,30 @@ bool ScintillaCocoa::SetScrollingSize(void) { docHeight = clipRect.size.height; CGFloat docWidth = scrollWidth; bool showHorizontalScroll = horizontalScrollBarVisible && - !Wrapping(); + !Wrapping(); if (!showHorizontalScroll) docWidth = clipRect.size.width; NSRect contentRect = {{0, 0}, {docWidth, docHeight}}; - NSRect contentRectNow = [inner frame]; + NSRect contentRectNow = inner.frame; changes = (contentRect.size.width != contentRectNow.size.width) || - (contentRect.size.height != contentRectNow.size.height); + (contentRect.size.height != contentRectNow.size.height); if (changes) { - [inner setFrame: contentRect]; + inner.frame = contentRect; } - [scrollView setHasVerticalScroller: verticalScrollBarVisible]; - [scrollView setHasHorizontalScroller: showHorizontalScroll]; + scrollView.hasVerticalScroller = verticalScrollBarVisible; + scrollView.hasHorizontalScroller = showHorizontalScroll; SetVerticalScrollPos(); enteredSetScrollingSize = false; } - [inner.owner setMarginWidth: vs.fixedColumnWidth]; + [sciView setMarginWidth: vs.fixedColumnWidth]; return changes; } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::Resize() -{ - SetScrollingSize(); - ChangeSize(); +void ScintillaCocoa::Resize() { + SetScrollingSize(); + ChangeSize(); } //-------------------------------------------------------------------------------------------------- @@ -1927,10 +1922,10 @@ void ScintillaCocoa::Resize() * Update fields to match scroll position after receiving a notification that the user has scrolled. */ void ScintillaCocoa::UpdateForScroll() { - Point ptOrigin = GetVisibleOriginInMain(); - xOffset = static_cast(ptOrigin.x); - int newTop = Platform::Minimum(static_cast(ptOrigin.y / vs.lineHeight), MaxScrollPos()); - SetTopLine(newTop); + Point ptOrigin = GetVisibleOriginInMain(); + xOffset = static_cast(ptOrigin.x); + Sci::Line newTop = std::min(static_cast(ptOrigin.y / vs.lineHeight), MaxScrollPos()); + SetTopLine(newTop); } //-------------------------------------------------------------------------------------------------- @@ -1943,9 +1938,8 @@ void ScintillaCocoa::UpdateForScroll() { * @param delegate_ A pointer to an object that implements ScintillaNotificationProtocol. */ -void ScintillaCocoa::SetDelegate(id delegate_) -{ - delegate = delegate_; +void ScintillaCocoa::SetDelegate(id delegate_) { + delegate = delegate_; } //-------------------------------------------------------------------------------------------------- @@ -1959,31 +1953,28 @@ void ScintillaCocoa::SetDelegate(id delegate_) * @param callback The callback function to be used for future notifications. If NULL then no * notifications will be sent anymore. */ -void ScintillaCocoa::RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback) -{ - notifyObj = windowid; - notifyProc = callback; +void ScintillaCocoa::RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback) { + notifyObj = windowid; + notifyProc = callback; } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::NotifyChange() -{ - if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), SCEN_CHANGE), - (uintptr_t) this); +void ScintillaCocoa::NotifyChange() { + if (notifyProc != NULL) + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), SCEN_CHANGE), + (uintptr_t) this); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::NotifyFocus(bool focus) -{ - if (notifyProc != NULL) - notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), - (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), - (uintptr_t) this); +void ScintillaCocoa::NotifyFocus(bool focus) { + if (commandEvents && notifyProc) + notifyProc(notifyObj, WM_COMMAND, Platform::LongFromTwoShorts(static_cast(GetCtrlID()), + (focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS)), + (uintptr_t) this); - Editor::NotifyFocus(focus); + Editor::NotifyFocus(focus); } //-------------------------------------------------------------------------------------------------- @@ -1994,68 +1985,68 @@ void ScintillaCocoa::NotifyFocus(bool focus) * * @param scn The notification to send. */ -void ScintillaCocoa::NotifyParent(SCNotification scn) -{ - scn.nmhdr.hwndFrom = (void*) this; - scn.nmhdr.idFrom = GetCtrlID(); - if (notifyProc != NULL) - notifyProc(notifyObj, WM_NOTIFY, GetCtrlID(), (uintptr_t) &scn); - if (delegate) - [delegate notification:&scn]; +void ScintillaCocoa::NotifyParent(SCNotification scn) { + scn.nmhdr.hwndFrom = (void *) this; + scn.nmhdr.idFrom = GetCtrlID(); + if (notifyProc != NULL) + notifyProc(notifyObj, WM_NOTIFY, GetCtrlID(), (uintptr_t) &scn); + if (delegate) + [delegate notification: &scn]; + if (scn.nmhdr.code == SCN_UPDATEUI) { + NSView *content = ContentView(); + if (scn.updated & SC_UPDATE_CONTENT) { + NSAccessibilityPostNotification(content, NSAccessibilityValueChangedNotification); + } + if (scn.updated & SC_UPDATE_SELECTION) { + NSAccessibilityPostNotification(content, NSAccessibilitySelectedTextChangedNotification); + } + } } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::NotifyURIDropped(const char *uri) -{ - SCNotification scn; - scn.nmhdr.code = SCN_URIDROPPED; - scn.text = uri; +void ScintillaCocoa::NotifyURIDropped(const char *uri) { + SCNotification scn; + scn.nmhdr.code = SCN_URIDROPPED; + scn.text = uri; - NotifyParent(scn); + NotifyParent(scn); } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::HasSelection() -{ - return !sel.Empty(); +bool ScintillaCocoa::HasSelection() { + return !sel.Empty(); } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::CanUndo() -{ - return pdoc->CanUndo(); +bool ScintillaCocoa::CanUndo() { + return pdoc->CanUndo(); } //-------------------------------------------------------------------------------------------------- -bool ScintillaCocoa::CanRedo() -{ - return pdoc->CanRedo(); +bool ScintillaCocoa::CanRedo() { + return pdoc->CanRedo(); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::TimerFired(NSTimer* timer) -{ - for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) - { - if (timers[tr] == timer) - { - TickFor(tr); - } - } +void ScintillaCocoa::TimerFired(NSTimer *timer) { + for (TickReason tr=tickCaret; tr<=tickPlatform; tr = static_cast(tr+1)) { + if (timers[tr] == timer) { + TickFor(tr); + } + } } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::IdleTimerFired() -{ - bool more = Idle(); - if (!more) - SetIdle(false); +void ScintillaCocoa::IdleTimerFired() { + bool more = Idle(); + if (!more) + SetIdle(false); } //-------------------------------------------------------------------------------------------------- @@ -2066,9 +2057,8 @@ void ScintillaCocoa::IdleTimerFired() * @param rect The area to paint, given in the sender's coordinate system. * @param gc The context we can use to paint. */ -bool ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) -{ - return SyncPaint(gc, NSRectToPRectangle(rect)); +bool ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) { + return SyncPaint(gc, NSRectToPRectangle(rect)); } //-------------------------------------------------------------------------------------------------- @@ -2076,43 +2066,56 @@ bool ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) /** * Helper function to translate OS X key codes to Scintilla key codes. */ -static inline UniChar KeyTranslate(UniChar unicodeChar) -{ - switch (unicodeChar) - { - case NSDownArrowFunctionKey: - return SCK_DOWN; - case NSUpArrowFunctionKey: - return SCK_UP; - case NSLeftArrowFunctionKey: - return SCK_LEFT; - case NSRightArrowFunctionKey: - return SCK_RIGHT; - case NSHomeFunctionKey: - return SCK_HOME; - case NSEndFunctionKey: - return SCK_END; - case NSPageUpFunctionKey: - return SCK_PRIOR; - case NSPageDownFunctionKey: - return SCK_NEXT; - case NSDeleteFunctionKey: - return SCK_DELETE; - case NSInsertFunctionKey: - return SCK_INSERT; - case '\n': - case 3: - return SCK_RETURN; - case 27: - return SCK_ESCAPE; - case 127: - return SCK_BACK; - case '\t': - case 25: // Shift tab, return to unmodified tab and handle that via modifiers. - return SCK_TAB; - default: - return unicodeChar; - } +static inline UniChar KeyTranslate(UniChar unicodeChar, NSEventModifierFlags modifierFlags) { + switch (unicodeChar) { + case NSDownArrowFunctionKey: + return SCK_DOWN; + case NSUpArrowFunctionKey: + return SCK_UP; + case NSLeftArrowFunctionKey: + return SCK_LEFT; + case NSRightArrowFunctionKey: + return SCK_RIGHT; + case NSHomeFunctionKey: + return SCK_HOME; + case NSEndFunctionKey: + return SCK_END; + case NSPageUpFunctionKey: + return SCK_PRIOR; + case NSPageDownFunctionKey: + return SCK_NEXT; + case NSDeleteFunctionKey: + return SCK_DELETE; + case NSInsertFunctionKey: + return SCK_INSERT; + case '\n': + case 3: + return SCK_RETURN; + case 27: + return SCK_ESCAPE; + case '+': + if (modifierFlags & NSEventModifierFlagNumericPad) + return SCK_ADD; + else + return unicodeChar; + case '-': + if (modifierFlags & NSEventModifierFlagNumericPad) + return SCK_SUBTRACT; + else + return unicodeChar; + case '/': + if (modifierFlags & NSEventModifierFlagNumericPad) + return SCK_DIVIDE; + else + return unicodeChar; + case 127: + return SCK_BACK; + case '\t': + case 25: // Shift tab, return to unmodified tab and handle that via modifiers. + return SCK_TAB; + default: + return unicodeChar; + } } //-------------------------------------------------------------------------------------------------- @@ -2123,14 +2126,13 @@ static inline UniChar KeyTranslate(UniChar unicodeChar) * @param modifiers An integer bit set of NSSEvent modifier flags. * @return A set of SCI_* modifier flags. */ -static int TranslateModifierFlags(NSUInteger modifiers) -{ - // Signal Control as SCI_META - return - (((modifiers & NSShiftKeyMask) != 0) ? SCI_SHIFT : 0) | - (((modifiers & NSCommandKeyMask) != 0) ? SCI_CTRL : 0) | - (((modifiers & NSAlternateKeyMask) != 0) ? SCI_ALT : 0) | - (((modifiers & NSControlKeyMask) != 0) ? SCI_META : 0); +static int TranslateModifierFlags(NSUInteger modifiers) { + // Signal Control as SCI_META + return + (((modifiers & NSEventModifierFlagShift) != 0) ? SCI_SHIFT : 0) | + (((modifiers & NSEventModifierFlagCommand) != 0) ? SCI_CTRL : 0) | + (((modifiers & NSEventModifierFlagOption) != 0) ? SCI_ALT : 0) | + (((modifiers & NSEventModifierFlagControl) != 0) ? SCI_META : 0); } //-------------------------------------------------------------------------------------------------- @@ -2142,28 +2144,28 @@ static int TranslateModifierFlags(NSUInteger modifiers) * @param event The event instance associated with the key down event. * @return True if the input was handled, false otherwise. */ -bool ScintillaCocoa::KeyboardInput(NSEvent* event) -{ - // For now filter out function keys. - NSString* input = [event characters]; +bool ScintillaCocoa::KeyboardInput(NSEvent *event) { + // For now filter out function keys. + NSString *input = event.charactersIgnoringModifiers; - bool handled = false; + bool handled = false; - // Handle each entry individually. Usually we only have one entry anyway. - for (size_t i = 0; i < input.length; i++) - { - const UniChar originalKey = [input characterAtIndex: i]; - UniChar key = KeyTranslate(originalKey); + // Handle each entry individually. Usually we only have one entry anyway. + for (size_t i = 0; i < input.length; i++) { + const UniChar originalKey = [input characterAtIndex: i]; + NSEventModifierFlags modifierFlags = event.modifierFlags; - bool consumed = false; // Consumed as command? + UniChar key = KeyTranslate(originalKey, modifierFlags); - if (KeyDownWithModifiers(key, TranslateModifierFlags([event modifierFlags]), &consumed)) - handled = true; - if (consumed) - handled = true; - } + bool consumed = false; // Consumed as command? - return handled; + if (KeyDownWithModifiers(key, TranslateModifierFlags(modifierFlags), &consumed)) + handled = true; + if (consumed) + handled = true; + } + + return handled; } //-------------------------------------------------------------------------------------------------- @@ -2171,17 +2173,26 @@ bool ScintillaCocoa::KeyboardInput(NSEvent* event) /** * Used to insert already processed text provided by the Cocoa text input system. */ -int ScintillaCocoa::InsertText(NSString* input) -{ - CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - std::string encoded = EncodedBytesString((CFStringRef)input, encoding); - - if (encoded.length() > 0) - { - AddCharUTF((char*) encoded.c_str(), static_cast(encoded.length()), false); - } - return static_cast(encoded.length()); +ptrdiff_t ScintillaCocoa::InsertText(NSString *input) { + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + std::string encoded = EncodedBytesString((__bridge CFStringRef)input, encoding); + + if (encoded.length() > 0) { + if (encoding == kCFStringEncodingUTF8) { + // There may be multiple characters in input so loop over them + std::string_view sv = encoded; + while (sv.length()) { + const unsigned char leadByte = sv[0]; + const unsigned int bytesInCharacter = UTF8BytesOfLead[leadByte]; + AddCharUTF(sv.data(), bytesInCharacter, false); + sv.remove_prefix(bytesInCharacter); + } + } else { + AddCharUTF(encoded.c_str(), static_cast(encoded.length()), false); + } + } + return encoded.length(); } //-------------------------------------------------------------------------------------------------- @@ -2189,15 +2200,14 @@ int ScintillaCocoa::InsertText(NSString* input) /** * Convert from a range of characters to a range of bytes. */ -NSRange ScintillaCocoa::PositionsFromCharacters(NSRange range) const -{ - long start = pdoc->GetRelativePositionUTF16(0, range.location); - if (start == INVALID_POSITION) - start = pdoc->Length(); - long end = pdoc->GetRelativePositionUTF16(start, range.length); - if (end == INVALID_POSITION) - end = pdoc->Length(); - return NSMakeRange(start, end - start); +NSRange ScintillaCocoa::PositionsFromCharacters(NSRange rangeCharacters) const { + Sci::Position start = pdoc->GetRelativePositionUTF16(0, rangeCharacters.location); + if (start == INVALID_POSITION) + start = pdoc->Length(); + Sci::Position end = pdoc->GetRelativePositionUTF16(start, rangeCharacters.length); + if (end == INVALID_POSITION) + end = pdoc->Length(); + return NSMakeRange(start, end - start); } //-------------------------------------------------------------------------------------------------- @@ -2205,11 +2215,11 @@ NSRange ScintillaCocoa::PositionsFromCharacters(NSRange range) const /** * Convert from a range of characters from a range of bytes. */ -NSRange ScintillaCocoa::CharactersFromPositions(NSRange range) const -{ - const long start = pdoc->CountUTF16(0, range.location); - const long len = pdoc->CountUTF16(range.location, NSMaxRange(range)); - return NSMakeRange(start, len); +NSRange ScintillaCocoa::CharactersFromPositions(NSRange rangePositions) const { + const Sci::Position start = pdoc->CountUTF16(0, rangePositions.location); + const Sci::Position len = pdoc->CountUTF16(rangePositions.location, + NSMaxRange(rangePositions)); + return NSMakeRange(start, len); } //-------------------------------------------------------------------------------------------------- @@ -2218,10 +2228,9 @@ NSRange ScintillaCocoa::CharactersFromPositions(NSRange range) const * Used to ensure that only one selection is active for input composition as composition * does not support multi-typing. */ -void ScintillaCocoa::SelectOnlyMainSelection() -{ - sel.SetSelection(sel.RangeMain()); - Redraw(); +void ScintillaCocoa::SelectOnlyMainSelection() { + sel.SetSelection(sel.RangeMain()); + Redraw(); } //-------------------------------------------------------------------------------------------------- @@ -2229,9 +2238,8 @@ void ScintillaCocoa::SelectOnlyMainSelection() /** * Convert virtual space before selection into real space. */ -void ScintillaCocoa::ConvertSelectionVirtualSpace() -{ - FillVirtualSpace(); +void ScintillaCocoa::ConvertSelectionVirtualSpace() { + ClearBeforeTentativeStart(); } //-------------------------------------------------------------------------------------------------- @@ -2240,10 +2248,9 @@ void ScintillaCocoa::ConvertSelectionVirtualSpace() * Erase all selected text and return whether the selection is now empty. * The selection may not be empty if the selection contained protected text. */ -bool ScintillaCocoa::ClearAllSelections() -{ - ClearSelection(true); - return sel.Empty(); +bool ScintillaCocoa::ClearAllSelections() { + ClearSelection(true); + return sel.Empty(); } //-------------------------------------------------------------------------------------------------- @@ -2251,13 +2258,11 @@ bool ScintillaCocoa::ClearAllSelections() /** * Start composing for IME. */ -void ScintillaCocoa::CompositionStart() -{ - if (!sel.Empty()) - { - NSLog(@"Selection not empty when starting composition"); - } - pdoc->TentativeStart(); +void ScintillaCocoa::CompositionStart() { + if (!sel.Empty()) { + NSLog(@"Selection not empty when starting composition"); + } + pdoc->TentativeStart(); } //-------------------------------------------------------------------------------------------------- @@ -2265,11 +2270,10 @@ void ScintillaCocoa::CompositionStart() /** * Commit the IME text. */ -void ScintillaCocoa::CompositionCommit() -{ - pdoc->TentativeCommit(); - pdoc->decorations.SetCurrentIndicator(INDIC_IME); - pdoc->DecorationFillRange(0, 0, pdoc->Length()); +void ScintillaCocoa::CompositionCommit() { + pdoc->TentativeCommit(); + pdoc->DecorationSetCurrentIndicator(INDIC_IME); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); } //-------------------------------------------------------------------------------------------------- @@ -2277,9 +2281,8 @@ void ScintillaCocoa::CompositionCommit() /** * Remove the IME text. */ -void ScintillaCocoa::CompositionUndo() -{ - pdoc->TentativeUndo(); +void ScintillaCocoa::CompositionUndo() { + pdoc->TentativeUndo(); } //-------------------------------------------------------------------------------------------------- @@ -2287,14 +2290,27 @@ void ScintillaCocoa::CompositionUndo() * When switching documents discard any incomplete character composition state as otherwise tries to * act on the new document. */ -void ScintillaCocoa::SetDocPointer(Document *document) -{ - // Drop input composition. - NSTextInputContext *inctxt = [NSTextInputContext currentInputContext]; - [inctxt discardMarkedText]; - SCIContentView *inner = ContentView(); - [inner unmarkText]; - Editor::SetDocPointer(document); +void ScintillaCocoa::SetDocPointer(Document *document) { + // Drop input composition. + NSTextInputContext *inctxt = [NSTextInputContext currentInputContext]; + [inctxt discardMarkedText]; + SCIContentView *inner = ContentView(); + [inner unmarkText]; + Editor::SetDocPointer(document); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Convert NSEvent timestamp NSTimeInterval into unsigned int milliseconds wanted by Editor methods. + */ + +namespace { + +unsigned int TimeOfEvent(NSEvent *event) { + return static_cast(event.timestamp * 1000); +} + } //-------------------------------------------------------------------------------------------------- @@ -2302,125 +2318,124 @@ void ScintillaCocoa::SetDocPointer(Document *document) /** * Called by the owning view when the mouse pointer enters the control. */ -void ScintillaCocoa::MouseEntered(NSEvent* event) -{ - if (!HaveMouseCapture()) - { - WndProc(SCI_SETCURSOR, (long int)SC_CURSORNORMAL, 0); +void ScintillaCocoa::MouseEntered(NSEvent *event) { + if (!HaveMouseCapture()) { + WndProc(SCI_SETCURSOR, (long int)SC_CURSORNORMAL, 0); - // Mouse location is given in screen coordinates and might also be outside of our bounds. - Point location = ConvertPoint([event locationInWindow]); - ButtonMove(location); - } + // Mouse location is given in screen coordinates and might also be outside of our bounds. + Point location = ConvertPoint(event.locationInWindow); + ButtonMoveWithModifiers(location, + TimeOfEvent(event), + TranslateModifierFlags(event.modifierFlags)); + } } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseExited(NSEvent* /* event */) -{ - // Nothing to do here. +void ScintillaCocoa::MouseExited(NSEvent * /* event */) { + // Nothing to do here. } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseDown(NSEvent* event) -{ - Point location = ConvertPoint([event locationInWindow]); - NSTimeInterval time = [event timestamp]; - bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; - bool shift = ([event modifierFlags] & NSShiftKeyMask) != 0; - bool alt = ([event modifierFlags] & NSAlternateKeyMask) != 0; +void ScintillaCocoa::MouseDown(NSEvent *event) { + Point location = ConvertPoint(event.locationInWindow); + ButtonDownWithModifiers(location, + TimeOfEvent(event), + TranslateModifierFlags(event.modifierFlags)); +} - ButtonDown(Point(location.x, location.y), (int) (time * 1000), shift, command, alt); +void ScintillaCocoa::RightMouseDown(NSEvent *event) { + Point location = ConvertPoint(event.locationInWindow); + RightButtonDownWithModifiers(location, + TimeOfEvent(event), + TranslateModifierFlags(event.modifierFlags)); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseMove(NSEvent* event) -{ - lastMouseEvent = event; +void ScintillaCocoa::MouseMove(NSEvent *event) { + lastMouseEvent = event; - ButtonMoveWithModifiers(ConvertPoint([event locationInWindow]), TranslateModifierFlags([event modifierFlags])); + ButtonMoveWithModifiers(ConvertPoint(event.locationInWindow), + TimeOfEvent(event), + TranslateModifierFlags(event.modifierFlags)); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseUp(NSEvent* event) -{ - NSTimeInterval time = [event timestamp]; - bool control = ([event modifierFlags] & NSControlKeyMask) != 0; - - ButtonUp(ConvertPoint([event locationInWindow]), (int) (time * 1000), control); +void ScintillaCocoa::MouseUp(NSEvent *event) { + ButtonUpWithModifiers(ConvertPoint(event.locationInWindow), + TimeOfEvent(event), + TranslateModifierFlags(event.modifierFlags)); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::MouseWheel(NSEvent* event) -{ - bool command = ([event modifierFlags] & NSCommandKeyMask) != 0; - int dY = 0; +void ScintillaCocoa::MouseWheel(NSEvent *event) { + bool command = (event.modifierFlags & NSEventModifierFlagCommand) != 0; + int dY = 0; - // In order to make scrolling with larger offset smoother we scroll less lines the larger the - // delta value is. - if ([event deltaY] < 0) - dY = -(int) sqrt(-10.0 * [event deltaY]); - else - dY = (int) sqrt(10.0 * [event deltaY]); + // In order to make scrolling with larger offset smoother we scroll less lines the larger the + // delta value is. + if (event.deltaY < 0) + dY = -static_cast(sqrt(-10.0 * event.deltaY)); + else + dY = static_cast(sqrt(10.0 * event.deltaY)); - if (command) - { - // Zoom! We play with the font sizes in the styles. - // Number of steps/line is ignored, we just care if sizing up or down. - if (dY > 0.5) - KeyCommand(SCI_ZOOMIN); - else if (dY < -0.5) - KeyCommand(SCI_ZOOMOUT); - } - else - { - } + if (command) { + // Zoom! We play with the font sizes in the styles. + // Number of steps/line is ignored, we just care if sizing up or down. + if (dY > 0.5) + KeyCommand(SCI_ZOOMIN); + else if (dY < -0.5) + KeyCommand(SCI_ZOOMOUT); + } else { + } } //-------------------------------------------------------------------------------------------------- // Helper methods for NSResponder actions. -void ScintillaCocoa::SelectAll() -{ - Editor::SelectAll(); +void ScintillaCocoa::SelectAll() { + Editor::SelectAll(); } -void ScintillaCocoa::DeleteBackward() -{ - KeyDown(SCK_BACK, false, false, false, nil); +void ScintillaCocoa::DeleteBackward() { + KeyDownWithModifiers(SCK_BACK, 0, nil); } -void ScintillaCocoa::Cut() -{ - Editor::Cut(); +void ScintillaCocoa::Cut() { + Editor::Cut(); } -void ScintillaCocoa::Undo() -{ - Editor::Undo(); +void ScintillaCocoa::Undo() { + Editor::Undo(); } -void ScintillaCocoa::Redo() -{ - Editor::Redo(); +void ScintillaCocoa::Redo() { + Editor::Redo(); } //-------------------------------------------------------------------------------------------------- +bool ScintillaCocoa::ShouldDisplayPopupOnMargin() { + return displayPopupMenu == SC_POPUP_ALL; +} + +bool ScintillaCocoa::ShouldDisplayPopupOnText() { + return displayPopupMenu == SC_POPUP_ALL || displayPopupMenu == SC_POPUP_TEXT; +} + /** * Creates and returns a popup menu, which is then displayed by the Cocoa framework. */ -NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* /* event */) -{ - // Call ScintillaBase to create the context menu. - ContextMenu(Point(0, 0)); +NSMenu *ScintillaCocoa::CreateContextMenu(NSEvent * /* event */) { + // Call ScintillaBase to create the context menu. + ContextMenu(Point(0, 0)); - return reinterpret_cast(popup.GetID()); + return (__bridge NSMenu *)(popup.GetID()); } //-------------------------------------------------------------------------------------------------- @@ -2429,23 +2444,32 @@ NSMenu* ScintillaCocoa::CreateContextMenu(NSEvent* /* event */) * An intermediate function to forward context menu commands from the menu action handler to * scintilla. */ -void ScintillaCocoa::HandleCommand(NSInteger command) -{ - Command(static_cast(command)); +void ScintillaCocoa::HandleCommand(NSInteger command) { + Command(static_cast(command)); } //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::ActiveStateChanged(bool isActive) -{ - // If the window is being deactivated, lose the focus and turn off the ticking - if (!isActive) { - DropCaret(); - //SetFocusState( false ); - FineTickerCancel(tickCaret); - } else { - ShowCaretAtCurrentPosition(); - } +void ScintillaCocoa::ActiveStateChanged(bool isActive) { + // If the window is being deactivated, lose the focus and turn off the ticking + if (!isActive) { + DropCaret(); + //SetFocusState( false ); + FineTickerCancel(tickCaret); + } else { + ShowCaretAtCurrentPosition(); + } +} + +//-------------------------------------------------------------------------------------------------- + +/** + * When the window is about to move, the calltip and autcoimpletion stay in the same spot, + * so cancel them. + */ +void ScintillaCocoa::WindowWillMove() { + AutoCompleteCancel(); + ct.CallTipCancel(); } // If building with old SDK, need to define version number for 10.8 @@ -2455,85 +2479,74 @@ void ScintillaCocoa::ActiveStateChanged(bool isActive) //-------------------------------------------------------------------------------------------------- -void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining) -{ +void ScintillaCocoa::ShowFindIndicatorForRange(NSRange charRange, BOOL retaining) { #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - NSView *content = ContentView(); - if (!layerFindIndicator) - { - layerFindIndicator = [[FindHighlightLayer alloc] init]; - [content setWantsLayer: YES]; - layerFindIndicator.geometryFlipped = content.layer.geometryFlipped; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) - { - // Content layer is unflipped on 10.9, but the indicator shows wrong unless flipped - layerFindIndicator.geometryFlipped = YES; - } - [[content layer] addSublayer:layerFindIndicator]; - } - [layerFindIndicator removeAnimationForKey:@"animateFound"]; + NSView *content = ContentView(); + if (!layerFindIndicator) { + layerFindIndicator = [[FindHighlightLayer alloc] init]; + [content setWantsLayer: YES]; + layerFindIndicator.geometryFlipped = content.layer.geometryFlipped; + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_8) { + // Content layer is unflipped on 10.9, but the indicator shows wrong unless flipped + layerFindIndicator.geometryFlipped = YES; + } + [content.layer addSublayer: layerFindIndicator]; + } + [layerFindIndicator removeAnimationForKey: @"animateFound"]; - if (charRange.length) - { - CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), - vs.styles[STYLE_DEFAULT].characterSet); - std::vector buffer(charRange.length); - pdoc->GetCharRange(&buffer[0], static_cast(charRange.location), static_cast(charRange.length)); + if (charRange.length) { + CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), + vs.styles[STYLE_DEFAULT].characterSet); + std::vector buffer(charRange.length); + pdoc->GetCharRange(&buffer[0], charRange.location, charRange.length); - CFStringRef cfsFind = CFStringCreateWithBytes(kCFAllocatorDefault, - reinterpret_cast(&buffer[0]), - charRange.length, encoding, false); - layerFindIndicator.sFind = (NSString *)cfsFind; - if (cfsFind) - CFRelease(cfsFind); - layerFindIndicator.retaining = retaining; - layerFindIndicator.positionFind = static_cast(charRange.location); - long style = WndProc(SCI_GETSTYLEAT, charRange.location, 0); - std::vector bufferFontName(WndProc(SCI_STYLEGETFONT, style, 0) + 1); - WndProc(SCI_STYLEGETFONT, style, (sptr_t)&bufferFontName[0]); - layerFindIndicator.sFont = [NSString stringWithUTF8String: &bufferFontName[0]]; + CFStringRef cfsFind = CFStringFromString(&buffer[0], charRange.length, encoding); + layerFindIndicator.sFind = (__bridge NSString *)cfsFind; + if (cfsFind) + CFRelease(cfsFind); + layerFindIndicator.retaining = retaining; + layerFindIndicator.positionFind = charRange.location; + // SCI_GETSTYLEAT reports a signed byte but want an unsigned to index into styles + const char styleByte = static_cast(WndProc(SCI_GETSTYLEAT, charRange.location, 0)); + const long style = static_cast(styleByte); + std::vector bufferFontName(WndProc(SCI_STYLEGETFONT, style, 0) + 1); + WndProc(SCI_STYLEGETFONT, style, (sptr_t)&bufferFontName[0]); + layerFindIndicator.sFont = @(&bufferFontName[0]); - layerFindIndicator.fontSize = WndProc(SCI_STYLEGETSIZEFRACTIONAL, style, 0) / - (float)SC_FONT_SIZE_MULTIPLIER; - layerFindIndicator.widthText = WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location + charRange.length) - - WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location); - layerFindIndicator.heightLine = WndProc(SCI_TEXTHEIGHT, 0, 0); - MoveFindIndicatorWithBounce(YES); - } - else - { - [layerFindIndicator hideMatch]; - } + layerFindIndicator.fontSize = WndProc(SCI_STYLEGETSIZEFRACTIONAL, style, 0) / + (float)SC_FONT_SIZE_MULTIPLIER; + layerFindIndicator.widthText = WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location + charRange.length) - + WndProc(SCI_POINTXFROMPOSITION, 0, charRange.location); + layerFindIndicator.heightLine = WndProc(SCI_TEXTHEIGHT, 0, 0); + MoveFindIndicatorWithBounce(YES); + } else { + [layerFindIndicator hideMatch]; + } #endif } -void ScintillaCocoa::MoveFindIndicatorWithBounce(BOOL bounce) -{ +void ScintillaCocoa::MoveFindIndicatorWithBounce(BOOL bounce) { #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - if (layerFindIndicator) - { - CGPoint ptText = CGPointMake( - WndProc(SCI_POINTXFROMPOSITION, 0, layerFindIndicator.positionFind), - WndProc(SCI_POINTYFROMPOSITION, 0, layerFindIndicator.positionFind)); - ptText.x = ptText.x - vs.fixedColumnWidth + xOffset; - ptText.y += topLine * vs.lineHeight; - if (!layerFindIndicator.geometryFlipped) - { - NSView *content = ContentView(); - ptText.y = content.bounds.size.height - ptText.y; - } - [layerFindIndicator animateMatch:ptText bounce:bounce]; - } + if (layerFindIndicator) { + CGPoint ptText = CGPointMake( + WndProc(SCI_POINTXFROMPOSITION, 0, layerFindIndicator.positionFind), + WndProc(SCI_POINTYFROMPOSITION, 0, layerFindIndicator.positionFind)); + ptText.x = ptText.x - vs.fixedColumnWidth + xOffset; + ptText.y += topLine * vs.lineHeight; + if (!layerFindIndicator.geometryFlipped) { + NSView *content = ContentView(); + ptText.y = content.bounds.size.height - ptText.y; + } + [layerFindIndicator animateMatch: ptText bounce: bounce]; + } #endif } -void ScintillaCocoa::HideFindIndicator() -{ +void ScintillaCocoa::HideFindIndicator() { #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - if (layerFindIndicator) - { - [layerFindIndicator hideMatch]; - } + if (layerFindIndicator) { + [layerFindIndicator hideMatch]; + } #endif } diff --git a/scintilla/cocoa/ScintillaFramework/Info.plist b/scintilla/cocoa/ScintillaFramework/Info.plist index 13ee4cc2..cd679f5d 100644 --- a/scintilla/cocoa/ScintillaFramework/Info.plist +++ b/scintilla/cocoa/ScintillaFramework/Info.plist @@ -9,17 +9,19 @@ CFBundleIconFile CFBundleIdentifier - com.sun.${PRODUCT_NAME:identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType FMWK + CFBundleShortVersionString + 4.1.4 CFBundleSignature ???? CFBundleVersion - 1.0 + 4.1.4 NSPrincipalClass diff --git a/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj index 2822fb89..f71b1525 100644 --- a/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj +++ b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj @@ -11,7 +11,6 @@ 1100F1EC178E393200105727 /* CaseConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E7178E393200105727 /* CaseConvert.h */; }; 1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1100F1E8178E393200105727 /* CaseFolder.cxx */; }; 1100F1EE178E393200105727 /* CaseFolder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E9178E393200105727 /* CaseFolder.h */; }; - 1100F1EF178E393200105727 /* UnicodeFromUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1EA178E393200105727 /* UnicodeFromUTF8.h */; }; 1102C31C169FB49300DC16AB /* LexLaTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */; }; 11126B8214CD3A6200803C49 /* LexAVS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11126B8114CD3A6200803C49 /* LexAVS.cxx */; }; 1114D6CB1602A951001DC345 /* LexPO.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1114D6CA1602A951001DC345 /* LexPO.cxx */; }; @@ -63,7 +62,6 @@ 114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */; }; 114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */; }; 114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EED11FA7526004FB6AB /* LexOpal.cxx */; }; - 114B6F3D11FA7526004FB6AB /* LexOthers.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEE11FA7526004FB6AB /* LexOthers.cxx */; }; 114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */; }; 114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF011FA7526004FB6AB /* LexPB.cxx */; }; 114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF111FA7526004FB6AB /* LexPerl.cxx */; }; @@ -126,7 +124,7 @@ 114B6F9D11FA75BE004FB6AB /* PropSetSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */; }; 114B6F9E11FA75BE004FB6AB /* StyleContext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9511FA75BE004FB6AB /* StyleContext.cxx */; }; 114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9611FA75BE004FB6AB /* WordList.cxx */; }; - 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA011FA75DB004FB6AB /* ILexer.h */; }; + 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA011FA75DB004FB6AB /* ILexer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA211FA7623004FB6AB /* AutoComplete.h */; }; 114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA311FA7623004FB6AB /* CallTip.h */; }; 114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA411FA7623004FB6AB /* Catalogue.h */; }; @@ -200,6 +198,8 @@ 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F9188DDD2C00F200AE /* StringCopy.h */; }; 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056FA188DDD2C00F200AE /* SubStyles.h */; }; 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28064A04190F12E100E6E47F /* LexDMIS.cxx */; }; + 282D4A961F53FE270082E4D3 /* ILoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 282D4A951F53FE270082E4D3 /* ILoader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28804B2B1EEE232E00C0D154 /* DBCS.cxx */; }; 28A067111A36B42600B4966A /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A067101A36B42600B4966A /* LexHex.cxx */; }; 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */; }; 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */; }; @@ -208,12 +208,29 @@ 28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD55196BE0ED006EFCDD /* EditView.h */; }; 28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD56196BE0ED006EFCDD /* MarginView.h */; }; 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A7D6041995E47D0062D204 /* LexRegistry.cxx */; }; + 28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647061B54C0720009DC49 /* LexBatch.cxx */; }; + 28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647071B54C0720009DC49 /* LexDiff.cxx */; }; + 28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647081B54C0720009DC49 /* LexErrorList.cxx */; }; + 28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647091B54C0720009DC49 /* LexMake.cxx */; }; + 28B647101B54C0720009DC49 /* LexNull.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470A1B54C0720009DC49 /* LexNull.cxx */; }; + 28B647111B54C0720009DC49 /* LexProps.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470B1B54C0720009DC49 /* LexProps.cxx */; }; + 28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */; }; + 28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */; }; + 28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28C40CA71CB7321200B089F2 /* LexJSON.cxx */; }; + 28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */; }; 28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */; }; 28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */; }; 28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */; }; 28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */; }; + 3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */; }; 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; + F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */; }; + FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */; }; + 5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7623427695416AB1270EE023 /* LexStata.cxx */; }; + 0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 47814937A6B72D2B0F065B61 /* LexNim.cxx */; }; + 00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 577F46B88F633198B56D088D /* LexCIL.cxx */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -225,7 +242,6 @@ 1100F1E7178E393200105727 /* CaseConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseConvert.h; path = ../../src/CaseConvert.h; sourceTree = ""; }; 1100F1E8178E393200105727 /* CaseFolder.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CaseFolder.cxx; path = ../../src/CaseFolder.cxx; sourceTree = ""; }; 1100F1E9178E393200105727 /* CaseFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseFolder.h; path = ../../src/CaseFolder.h; sourceTree = ""; }; - 1100F1EA178E393200105727 /* UnicodeFromUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnicodeFromUTF8.h; path = ../../src/UnicodeFromUTF8.h; sourceTree = ""; }; 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLaTeX.cxx; path = ../../lexers/LexLaTeX.cxx; sourceTree = ""; }; 11126B8114CD3A6200803C49 /* LexAVS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVS.cxx; path = ../../lexers/LexAVS.cxx; sourceTree = ""; }; 1114D6CA1602A951001DC345 /* LexPO.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPO.cxx; path = ../../lexers/LexPO.cxx; sourceTree = ""; }; @@ -277,7 +293,6 @@ 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNimrod.cxx; path = ../../lexers/LexNimrod.cxx; sourceTree = SOURCE_ROOT; }; 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNsis.cxx; path = ../../lexers/LexNsis.cxx; sourceTree = SOURCE_ROOT; }; 114B6EED11FA7526004FB6AB /* LexOpal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOpal.cxx; path = ../../lexers/LexOpal.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EEE11FA7526004FB6AB /* LexOthers.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOthers.cxx; path = ../../lexers/LexOthers.cxx; sourceTree = SOURCE_ROOT; }; 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPascal.cxx; path = ../../lexers/LexPascal.cxx; sourceTree = SOURCE_ROOT; }; 114B6EF011FA7526004FB6AB /* LexPB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPB.cxx; path = ../../lexers/LexPB.cxx; sourceTree = SOURCE_ROOT; }; 114B6EF111FA7526004FB6AB /* LexPerl.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPerl.cxx; path = ../../lexers/LexPerl.cxx; sourceTree = SOURCE_ROOT; }; @@ -414,6 +429,9 @@ 280056F9188DDD2C00F200AE /* StringCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringCopy.h; path = ../../lexlib/StringCopy.h; sourceTree = ""; }; 280056FA188DDD2C00F200AE /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../lexlib/SubStyles.h; sourceTree = ""; }; 28064A04190F12E100E6E47F /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../lexers/LexDMIS.cxx; sourceTree = ""; }; + 282D4A951F53FE270082E4D3 /* ILoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILoader.h; path = ../../include/ILoader.h; sourceTree = ""; }; + 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexIndent.cxx; path = ../../lexers/LexIndent.cxx; sourceTree = SOURCE_ROOT; }; + 28804B2B1EEE232E00C0D154 /* DBCS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBCS.cxx; path = ../../src/DBCS.cxx; sourceTree = ""; }; 28A067101A36B42600B4966A /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../lexers/LexHex.cxx; sourceTree = ""; }; 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditModel.cxx; path = ../../src/EditModel.cxx; sourceTree = ""; }; 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditView.cxx; path = ../../src/EditView.cxx; sourceTree = ""; }; @@ -422,14 +440,31 @@ 28A1DD55196BE0ED006EFCDD /* EditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditView.h; path = ../../src/EditView.h; sourceTree = ""; }; 28A1DD56196BE0ED006EFCDD /* MarginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MarginView.h; path = ../../src/MarginView.h; sourceTree = ""; }; 28A7D6041995E47D0062D204 /* LexRegistry.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRegistry.cxx; path = ../../lexers/LexRegistry.cxx; sourceTree = ""; }; + 28B647061B54C0720009DC49 /* LexBatch.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBatch.cxx; path = ../../lexers/LexBatch.cxx; sourceTree = ""; }; + 28B647071B54C0720009DC49 /* LexDiff.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDiff.cxx; path = ../../lexers/LexDiff.cxx; sourceTree = ""; }; + 28B647081B54C0720009DC49 /* LexErrorList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErrorList.cxx; path = ../../lexers/LexErrorList.cxx; sourceTree = ""; }; + 28B647091B54C0720009DC49 /* LexMake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMake.cxx; path = ../../lexers/LexMake.cxx; sourceTree = ""; }; + 28B6470A1B54C0720009DC49 /* LexNull.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNull.cxx; path = ../../lexers/LexNull.cxx; sourceTree = ""; }; + 28B6470B1B54C0720009DC49 /* LexProps.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProps.cxx; path = ../../lexers/LexProps.cxx; sourceTree = ""; }; + 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sci_Position.h; path = ../../include/Sci_Position.h; sourceTree = ""; }; + 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultLexer.cxx; path = ../../lexlib/DefaultLexer.cxx; sourceTree = ""; }; + 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultLexer.h; path = ../../lexlib/DefaultLexer.h; sourceTree = ""; }; + 28C40CA71CB7321200B089F2 /* LexJSON.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexJSON.cxx; path = ../../lexers/LexJSON.cxx; sourceTree = ""; }; + 28D1919E1DE69FC100159938 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; + 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEDIFACT.cxx; path = ../../lexers/LexEDIFACT.cxx; sourceTree = ""; }; 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "info_bar_bg@2x.png"; sourceTree = ""; }; 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_busy@2x.png"; sourceTree = ""; }; 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_flipped@2x.png"; sourceTree = ""; }; 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBibTeX.cxx; path = ../../lexers/LexBibTeX.cxx; sourceTree = ""; }; + 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMaxima.cxx; path = ../../lexers/LexMaxima.cxx; sourceTree = SOURCE_ROOT; }; 32DBCF5E0370ADEE00C91783 /* Scintilla_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scintilla_Prefix.pch; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* Scintilla.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scintilla.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSAS.cxx; path = ../../lexers/LexSAS.cxx; sourceTree = SOURCE_ROOT; }; + 7623427695416AB1270EE023 /* LexStata.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexStata.cxx; path = ../../lexers/LexStata.cxx; sourceTree = SOURCE_ROOT; }; + 47814937A6B72D2B0F065B61 /* LexNim.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNim.cxx; path = ../../lexers/LexNim.cxx; sourceTree = SOURCE_ROOT; }; + 577F46B88F633198B56D088D /* LexCIL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCIL.cxx; path = ../../lexers/LexCIL.cxx; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -489,6 +524,7 @@ 08FB77AEFE84172EC02AAC07 /* Classes */ = { isa = PBXGroup; children = ( + 28D1919E1DE69FC100159938 /* module.modulemap */, 2744E4980FC167ED00E85C33 /* Source Files */, 2744E4970FC167E400E85C33 /* Header Files */, ); @@ -526,7 +562,6 @@ 2744E47D0FC1674E00E85C33 /* Lexers */ = { isa = PBXGroup; children = ( - 11126B8114CD3A6200803C49 /* LexAVS.cxx */, 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */, 114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */, 114B6EBF11FA7526004FB6AB /* LexAda.cxx */, @@ -536,12 +571,15 @@ 114B6EC311FA7526004FB6AB /* LexASY.cxx */, 114B6EC411FA7526004FB6AB /* LexAU3.cxx */, 114B6EC511FA7526004FB6AB /* LexAVE.cxx */, + 11126B8114CD3A6200803C49 /* LexAVS.cxx */, 114B6EC611FA7526004FB6AB /* LexBaan.cxx */, 114B6EC711FA7526004FB6AB /* LexBash.cxx */, 114B6EC811FA7526004FB6AB /* LexBasic.cxx */, + 28B647061B54C0720009DC49 /* LexBatch.cxx */, 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */, 114B6EC911FA7526004FB6AB /* LexBullant.cxx */, 114B6ECA11FA7526004FB6AB /* LexCaml.cxx */, + 577F46B88F633198B56D088D /* LexCIL.cxx */, 114B6ECB11FA7526004FB6AB /* LexCLW.cxx */, 114B6ECC11FA7526004FB6AB /* LexCmake.cxx */, 114B6ECD11FA7526004FB6AB /* LexCOBOL.cxx */, @@ -552,11 +590,14 @@ 114B6ED111FA7526004FB6AB /* LexCsound.cxx */, 114B6ED211FA7526004FB6AB /* LexCSS.cxx */, 114B6ED311FA7526004FB6AB /* LexD.cxx */, + 28B647071B54C0720009DC49 /* LexDiff.cxx */, 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */, 28064A04190F12E100E6E47F /* LexDMIS.cxx */, 11BEB6A114EF189600BDE92A /* LexECL.cxx */, + 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */, 114B6ED411FA7526004FB6AB /* LexEiffel.cxx */, 114B6ED511FA7526004FB6AB /* LexErlang.cxx */, + 28B647081B54C0720009DC49 /* LexErrorList.cxx */, 114B6ED611FA7526004FB6AB /* LexEScript.cxx */, 114B6ED711FA7526004FB6AB /* LexFlagship.cxx */, 114B6ED811FA7526004FB6AB /* LexForth.cxx */, @@ -566,7 +607,9 @@ 114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */, 28A067101A36B42600B4966A /* LexHex.cxx */, 114B6EDD11FA7526004FB6AB /* LexHTML.cxx */, + 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */, 114B6EDE11FA7526004FB6AB /* LexInno.cxx */, + 28C40CA71CB7321200B089F2 /* LexJSON.cxx */, 114B6EDF11FA7526004FB6AB /* LexKix.cxx */, 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */, 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */, @@ -574,19 +617,22 @@ 114B6EE111FA7526004FB6AB /* LexLout.cxx */, 114B6EE211FA7526004FB6AB /* LexLua.cxx */, 114B6EE311FA7526004FB6AB /* LexMagik.cxx */, + 28B647091B54C0720009DC49 /* LexMake.cxx */, 114B6EE411FA7526004FB6AB /* LexMarkdown.cxx */, 114B6EE511FA7526004FB6AB /* LexMatlab.cxx */, + 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */, 114B6EE611FA7526004FB6AB /* LexMetapost.cxx */, 114B6EE711FA7526004FB6AB /* LexMMIXAL.cxx */, 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */, 114B6EE811FA7526004FB6AB /* LexMPT.cxx */, 114B6EE911FA7526004FB6AB /* LexMSSQL.cxx */, 114B6EEA11FA7526004FB6AB /* LexMySQL.cxx */, + 47814937A6B72D2B0F065B61 /* LexNim.cxx */, 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */, 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */, + 28B6470A1B54C0720009DC49 /* LexNull.cxx */, 114B6EED11FA7526004FB6AB /* LexOpal.cxx */, 11594BE7155B91DF0099E1FA /* LexOScript.cxx */, - 114B6EEE11FA7526004FB6AB /* LexOthers.cxx */, 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */, 114B6EF011FA7526004FB6AB /* LexPB.cxx */, 114B6EF111FA7526004FB6AB /* LexPerl.cxx */, @@ -596,6 +642,7 @@ 114B6EF411FA7526004FB6AB /* LexPowerPro.cxx */, 114B6EF511FA7526004FB6AB /* LexPowerShell.cxx */, 114B6EF611FA7526004FB6AB /* LexProgress.cxx */, + 28B6470B1B54C0720009DC49 /* LexProps.cxx */, 114B6EF711FA7526004FB6AB /* LexPS.cxx */, 114B6EF811FA7526004FB6AB /* LexPython.cxx */, 114B6EF911FA7526004FB6AB /* LexR.cxx */, @@ -603,6 +650,7 @@ 28A7D6041995E47D0062D204 /* LexRegistry.cxx */, 114B6EFB11FA7526004FB6AB /* LexRuby.cxx */, 1160E0371803651C00BCEBCB /* LexRust.cxx */, + A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */, 114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */, 114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */, 114B6EFE11FA7526004FB6AB /* LexSML.cxx */, @@ -610,6 +658,7 @@ 114B6F0011FA7526004FB6AB /* LexSpecman.cxx */, 114B6F0111FA7526004FB6AB /* LexSpice.cxx */, 114B6F0211FA7526004FB6AB /* LexSQL.cxx */, + 7623427695416AB1270EE023 /* LexStata.cxx */, 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */, 114B6F0311FA7526004FB6AB /* LexTACL.cxx */, 114B6F0411FA7526004FB6AB /* LexTADS3.cxx */, @@ -642,6 +691,7 @@ 114B6FA611FA7623004FB6AB /* CharClassify.h */, 114B6FA711FA7623004FB6AB /* ContractionState.h */, 114B6FA811FA7623004FB6AB /* Decoration.h */, + 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */, 114B6FA911FA7623004FB6AB /* Document.h */, 28A1DD54196BE0ED006EFCDD /* EditModel.h */, 114B6FAA11FA7623004FB6AB /* Editor.h */, @@ -649,6 +699,7 @@ 114B6FAB11FA7623004FB6AB /* ExternalLexer.h */, 114B6FAC11FA7623004FB6AB /* FontQuality.h */, 114B6FA011FA75DB004FB6AB /* ILexer.h */, + 282D4A951F53FE270082E4D3 /* ILoader.h */, 114B6FAD11FA7623004FB6AB /* Indicator.h */, 114B6FAE11FA7623004FB6AB /* KeyMap.h */, 114B6FDA11FA7645004FB6AB /* LexAccessor.h */, @@ -673,7 +724,6 @@ 114B6FB811FA7623004FB6AB /* Style.h */, 114B6FE111FA7645004FB6AB /* StyleContext.h */, 280056FA188DDD2C00F200AE /* SubStyles.h */, - 1100F1EA178E393200105727 /* UnicodeFromUTF8.h */, 114B6FBA11FA7623004FB6AB /* UniConversion.h */, 114B6FBB11FA7623004FB6AB /* ViewStyle.h */, 114B6FE211FA7645004FB6AB /* WordList.h */, @@ -696,7 +746,9 @@ 114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */, 114B6F6411FA7597004FB6AB /* CharClassify.cxx */, 114B6F6511FA7597004FB6AB /* ContractionState.cxx */, + 28804B2B1EEE232E00C0D154 /* DBCS.cxx */, 114B6F6611FA7597004FB6AB /* Decoration.cxx */, + 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */, 114B6F6711FA7597004FB6AB /* Document.cxx */, 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */, 114B6F6811FA7597004FB6AB /* Editor.cxx */, @@ -737,6 +789,7 @@ 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */, 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */, 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */, + 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */, 2744E4870FC1678600E85C33 /* SciLexer.h */, 2744E4880FC1678600E85C33 /* Scintilla.h */, 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */, @@ -785,9 +838,12 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */, + 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */, 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */, 2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */, 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */, + 28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */, 280056FB188DDD2C00F200AE /* SparseState.h in Headers */, 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */, 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */, @@ -796,7 +852,6 @@ 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */, 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */, 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */, - 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */, 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */, 114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */, 114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */, @@ -804,6 +859,7 @@ 114B6FC111FA7623004FB6AB /* CharClassify.h in Headers */, 114B6FC211FA7623004FB6AB /* ContractionState.h in Headers */, 114B6FC311FA7623004FB6AB /* Decoration.h in Headers */, + 282D4A961F53FE270082E4D3 /* ILoader.h in Headers */, 114B6FC411FA7623004FB6AB /* Document.h in Headers */, 114B6FC511FA7623004FB6AB /* Editor.h in Headers */, 114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */, @@ -843,7 +899,6 @@ 11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */, 1100F1EC178E393200105727 /* CaseConvert.h in Headers */, 1100F1EE178E393200105727 /* CaseFolder.h in Headers */, - 1100F1EF178E393200105727 /* UnicodeFromUTF8.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -875,7 +930,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0930; }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */; compatibilityVersion = "Xcode 3.2"; @@ -923,8 +978,12 @@ 2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */, 2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */, 2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */, + 28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */, + 28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */, 114B6F0D11FA7526004FB6AB /* LexAbaqus.cxx in Sources */, 114B6F0E11FA7526004FB6AB /* LexAda.cxx in Sources */, + 28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */, + 28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */, 114B6F0F11FA7526004FB6AB /* LexAPDL.cxx in Sources */, 114B6F1011FA7526004FB6AB /* LexAsm.cxx in Sources */, 114B6F1111FA7526004FB6AB /* LexAsn1.cxx in Sources */, @@ -938,10 +997,13 @@ 114B6F1911FA7526004FB6AB /* LexCaml.cxx in Sources */, 114B6F1A11FA7526004FB6AB /* LexCLW.cxx in Sources */, 114B6F1B11FA7526004FB6AB /* LexCmake.cxx in Sources */, + 28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */, 114B6F1C11FA7526004FB6AB /* LexCOBOL.cxx in Sources */, 114B6F1D11FA7526004FB6AB /* LexConf.cxx in Sources */, + 28B647101B54C0720009DC49 /* LexNull.cxx in Sources */, 114B6F1E11FA7526004FB6AB /* LexCPP.cxx in Sources */, 114B6F1F11FA7526004FB6AB /* LexCrontab.cxx in Sources */, + 28B647111B54C0720009DC49 /* LexProps.cxx in Sources */, 114B6F2011FA7526004FB6AB /* LexCsound.cxx in Sources */, 114B6F2111FA7526004FB6AB /* LexCSS.cxx in Sources */, 114B6F2211FA7526004FB6AB /* LexD.cxx in Sources */, @@ -974,9 +1036,10 @@ 114B6F3911FA7526004FB6AB /* LexMySQL.cxx in Sources */, 114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */, 114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */, + 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */, 114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */, - 114B6F3D11FA7526004FB6AB /* LexOthers.cxx in Sources */, 114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */, + 28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */, 114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */, 114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */, 114B6F4111FA7526004FB6AB /* LexPLM.cxx in Sources */, @@ -1029,6 +1092,7 @@ 114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */, 114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */, 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */, + 28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */, 114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */, 114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */, 114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */, @@ -1058,6 +1122,12 @@ 11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */, 1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */, 11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */, + F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */, + 3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */, + FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */, + 5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */, + 0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */, + 00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1080,8 +1150,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; + DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ".bzr *.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj"; @@ -1091,10 +1163,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Scintilla_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - SCI_NAMESPACE, - SCI_LEXER, - ); + GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; @@ -1102,6 +1171,8 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.7; + MODULEMAP_FILE = module.modulemap; + PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = Scintilla; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; @@ -1113,18 +1184,17 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Scintilla_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - SCI_NAMESPACE, - SCI_LEXER, - ); + GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER; GCC_WARN_UNINITIALIZED_AUTOS = NO; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; @@ -1132,6 +1202,8 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.7; + MODULEMAP_FILE = module.modulemap; + PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = Scintilla; SKIP_INSTALL = YES; WRAPPER_EXTENSION = framework; @@ -1141,17 +1213,43 @@ 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( ../../include, ../../src, ../../lexlib, ); - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; }; @@ -1160,16 +1258,41 @@ 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( ../../include, ../../src, ../../lexlib, ); - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.7; SDKROOT = macosx; }; name = Release; diff --git a/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..acc8e3f9 --- /dev/null +++ b/scintilla/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/scintilla/cocoa/ScintillaFramework/module.modulemap b/scintilla/cocoa/ScintillaFramework/module.modulemap new file mode 100644 index 00000000..d09ce2e3 --- /dev/null +++ b/scintilla/cocoa/ScintillaFramework/module.modulemap @@ -0,0 +1,10 @@ +framework module Scintilla { + umbrella header "ScintillaView.h" + module InfoBar { + header "InfoBar.h" + } + // ILexer.h is not included as Swift doesn't yet interoperate with C++ + exclude header "ILexer.h" + export * + module * { export * } +} diff --git a/scintilla/cocoa/ScintillaTest/AppController.h b/scintilla/cocoa/ScintillaTest/AppController.h index e89ad4c0..83b36032 100644 --- a/scintilla/cocoa/ScintillaTest/AppController.h +++ b/scintilla/cocoa/ScintillaTest/AppController.h @@ -15,10 +15,12 @@ @interface AppController : NSObject { IBOutlet NSBox *mEditHost; ScintillaView* mEditor; + ScintillaView* sciExtra; // For testing Scintilla tear-down } - (void) awakeFromNib; - (void) setupEditor; - (IBAction) searchText: (id) sender; +- (IBAction) addRemoveExtra: (id) sender; @end diff --git a/scintilla/cocoa/ScintillaTest/AppController.mm b/scintilla/cocoa/ScintillaTest/AppController.mm index 71dc130e..b25a7ca3 100644 --- a/scintilla/cocoa/ScintillaTest/AppController.mm +++ b/scintilla/cocoa/ScintillaTest/AppController.mm @@ -72,20 +72,30 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL. [mEditor setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; // Let's load some text for the editor, as initial content. - NSError* error = nil; - - NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData" - ofType: @"sql" inDirectory: nil]; - - NSString* sql = [NSString stringWithContentsOfFile: path - encoding: NSUTF8StringEncoding - error: &error]; - if (error && [[error domain] isEqual: NSCocoaErrorDomain]) - NSLog(@"%@", error); - + NSString *sql = [self exampleText]; + [mEditor setString: sql]; [self setupEditor]; + + sciExtra = nil; +} + +- (NSString *) exampleText +{ + NSError* error = nil; + + NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData" + ofType: @"sql" inDirectory: nil]; + + NSString *sql = [NSString stringWithContentsOfFile: path + encoding: NSUTF8StringEncoding + error: &error]; + + if (error && [[error domain] isEqual: NSCocoaErrorDomain]) + NSLog(@"%@", error); + + return sql; } //-------------------------------------------------------------------------------------------------- @@ -99,9 +109,6 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL. [mEditor setGeneralProperty: SCI_SETLEXER parameter: SCLEX_MYSQL value: 0]; // alternatively: [mEditor setEditorProperty: SCI_SETLEXERLANGUAGE parameter: nil value: (sptr_t) "mysql"]; - // Number of styles we use with this lexer. - [mEditor setGeneralProperty: SCI_SETSTYLEBITS value: [mEditor getGeneralProperty: SCI_GETSTYLEBITSNEEDED]]; - // Keywords to highlight. Indices are: // 0 - Major keywords (reserved keywords) // 1 - Normal keywords (everything not reserved but integral part of the language) @@ -234,7 +241,7 @@ static const char * box_xpm[] = { - (void) showAutocompletion { - const char *words = "Babylon-5?1 Battlestar-Galactica Millenium-Falcon?2 Moya?2 Serenity Voyager"; + const char *words = "Babylon-5?1 Battlestar-Galactica Millennium-Falcon?2 Moya?2 Serenity Voyager"; [mEditor setGeneralProperty: SCI_AUTOCSETIGNORECASE parameter: 1 value:0]; [mEditor setGeneralProperty: SCI_REGISTERIMAGE parameter: 1 value:(sptr_t)box_xpm]; const int imSize = 12; @@ -271,6 +278,26 @@ static const char * box_xpm[] = { [self showAutocompletion]; } +- (IBAction) addRemoveExtra: (id) sender +{ + if (sciExtra) { + [sciExtra removeFromSuperview]; + sciExtra = nil; + } else { + NSRect newFrame = mEditHost.frame; + newFrame.origin.x += newFrame.size.width + 5; + newFrame.origin.y += 46; + newFrame.size.width = 96; + newFrame.size.height -= 60; + + sciExtra = [[[ScintillaView alloc] initWithFrame: newFrame] autorelease]; + [[[mEditHost window]contentView] addSubview: sciExtra]; + [sciExtra setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 1]; + NSString *sql = [self exampleText]; + [sciExtra setString: sql]; + } +} + -(IBAction) setFontQuality: (id) sender { [ScintillaView directCall:mEditor message:SCI_SETFONTQUALITY wParam:[sender tag] lParam:0]; diff --git a/scintilla/cocoa/ScintillaTest/English.lproj/MainMenu.xib b/scintilla/cocoa/ScintillaTest/English.lproj/MainMenu.xib index e2d93cca..d2292d8c 100644 --- a/scintilla/cocoa/ScintillaTest/English.lproj/MainMenu.xib +++ b/scintilla/cocoa/ScintillaTest/English.lproj/MainMenu.xib @@ -1,3992 +1,609 @@ - - - 1050 - 10D573 - 762 - 1038.29 - 460.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 762 - - - YES - - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - YES - - - YES - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - NewApplication - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - NewApplication - - YES - - - About NewApplication - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide NewApplication - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit NewApplication - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - New - n - 1048576 - 2147483647 - - - - - - Open… - o - 1048576 - 2147483647 - - - - - - Open Recent - - 1048576 - 2147483647 - - - submenuAction: - - Open Recent - - YES - - - Clear Menu - - 1048576 - 2147483647 - - - - - _NSRecentDocumentsMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Close - w - 1048576 - 2147483647 - - - - - - Save - s - 1048576 - 2147483647 - - - - - - Save As… - S - 1179648 - 2147483647 - - - - - - Revert to Saved - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Page Setup... - P - 1179648 - 2147483647 - - - - - - - Print… - p - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Spelling and Grammar - - 1048576 - 2147483647 - - - submenuAction: - - Spelling and Grammar - - YES - - - Show Spelling… - : - 1048576 - 2147483647 - - - - - - Check Spelling - ; - 1048576 - 2147483647 - - - - - - Check Spelling While Typing - - 1048576 - 2147483647 - - - - - - Check Grammar With Spelling - - 1048576 - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Smart Copy/Paste - f - 1048576 - 2147483647 - - - 1 - - - - Smart Quotes - g - 1048576 - 2147483647 - - - 2 - - - - Smart Links - G - 1179648 - 2147483647 - - - 3 - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Format - - 2147483647 - - - submenuAction: - - Format - - YES - - - Font - - 2147483647 - - - submenuAction: - - Font - - YES - - - Show Fonts - t - 1048576 - 2147483647 - - - - - - Bold - b - 1048576 - 2147483647 - - - 2 - - - - Italic - i - 1048576 - 2147483647 - - - 1 - - - - Underline - u - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Bigger - + - 1048576 - 2147483647 - - - 3 - - - - Smaller - - - 1048576 - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Kern - - 2147483647 - - - submenuAction: - - Kern - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Tighten - - 2147483647 - - - - - - Loosen - - 2147483647 - - - - - - - - - Ligature - - 2147483647 - - - submenuAction: - - Ligature - - YES - - - Use Default - - 2147483647 - - - - - - Use None - - 2147483647 - - - - - - Use All - - 2147483647 - - - - - - - - - Baseline - - 2147483647 - - - submenuAction: - - Baseline - - YES - - - Use Default - - 2147483647 - - - - - - Superscript - - 2147483647 - - - - - - Subscript - - 2147483647 - - - - - - Raise - - 2147483647 - - - - - - Lower - - 2147483647 - - - - - - - - - Font Quality - - 2147483647 - - - submenuAction: - - Font Quality - - YES - - - Default - - 2147483647 - - - - - - Non-antialiased - - 2147483647 - - - 1 - - - - Antialiased - - 2147483647 - - - 2 - - - - LCD Optimized - - 2147483647 - - - 3 - - - - - - - YES - YES - - - 2147483647 - - - - - - Show Colors - C - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Copy Style - c - 1572864 - 2147483647 - - - - - - Paste Style - v - 1572864 - 2147483647 - - - - - _NSFontMenu - - - - - Text - - 2147483647 - - - submenuAction: - - Text - - YES - - - Align Left - { - 1048576 - 2147483647 - - - - - - Center - | - 1048576 - 2147483647 - - - - - - Justify - - 2147483647 - - - - - - Align Right - } - 1048576 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Show Ruler - - 2147483647 - - - - - - Copy Ruler - c - 1310720 - 2147483647 - - - - - - Paste Ruler - v - 1310720 - 2147483647 - - - - - - - - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Show Toolbar - t - 1572864 - 2147483647 - - - - - - Customize Toolbar… - - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 1048576 - 2147483647 - - - submenuAction: - - Help - - YES - - - NewApplication Help - ? - 1048576 - 2147483647 - - - - - - - - _NSMainMenu - - - 15 - 2 - {{335, 58}, {982, 692}} - 1946157056 - Window - NSWindow - - {1.79769e+308, 1.79769e+308} - - - 319 - - YES - - - 18 - - YES - - - 256 - {{1, 1}, {842, 590}} - - - - {{17, 16}, {844, 606}} - - {0, 0} - - 67239424 - 0 - Scintilla Editor - - LucidaGrande - 11 - 3100 - - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 3 - MCAwLjgwMDAwMDAxAA - - - - 1 - 0 - 2 - NO - - - - 289 - {{872, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - Quit - - LucidaGrande - 13 - 1044 - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{20, 630}, {287, 22}} - - YES - - 343014976 - 268436480 - - - - YES - 1 - - - 6 - System - controlTextColor - - 3 - MAA - - - - 130560 - 0 - search - - _searchFieldSearch: - - 138690815 - 0 - - 400 - 75 - - - 130560 - 0 - clear - - YES - - YES - - YES - AXDescription - NSAccessibilityEncodedAttributesValueType - - - YES - cancel - - - - - - _searchFieldCancel: - - 138690815 - 0 - - 400 - 75 - - 255 - - - - {982, 692} - - - {{0, 0}, {1440, 878}} - {1.79769e+308, 1.79769e+308} - - - NSFontManager - - - AppController - - - - - YES - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - print: - - - - 86 - - - - runPageLayout: - - - - 87 - - - - clearRecentDocuments: - - - - 127 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - performClose: - - - - 193 - - - - toggleContinuousSpellChecking: - - - - 222 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - checkSpelling: - - - - 225 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - showGuessPanel: - - - - 230 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleGrammarChecking: - - - - 347 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - showHelp: - - - - 360 - - - - saveDocument: - - - - 362 - - - - saveDocumentAs: - - - - 363 - - - - revertDocumentToSaved: - - - - 364 - - - - runToolbarCustomizationPalette: - - - - 365 - - - - toggleToolbarShown: - - - - 366 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - newDocument: - - - - 373 - - - - openDocument: - - - - 374 - - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - - - - raiseBaseline: - - - - 426 - - - - lowerBaseline: - - - - 427 - - - - copyFont: - - - - 428 - - - - subscript: - - - - 429 - - - - superscript: - - - - 430 - - - - tightenKerning: - - - - 431 - - - - underline: - - - - 432 - - - - orderFrontColorPanel: - - - - 433 - - - - useAllLigatures: - - - - 434 - - - - loosenKerning: - - - - 435 - - - - pasteFont: - - - - 436 - - - - unscript: - - - - 437 - - - - useStandardKerning: - - - - 438 - - - - useStandardLigatures: - - - - 439 - - - - turnOffLigatures: - - - - 440 - - - - turnOffKerning: - - - - 441 - - - - alignLeft: - - - - 442 - - - - alignJustified: - - - - 443 - - - - copyRuler: - - - - 444 - - - - alignCenter: - - - - 445 - - - - toggleRuler: - - - - 446 - - - - alignRight: - - - - 447 - - - - pasteRuler: - - - - 448 - - - - terminate: - - - - 449 - - - - mEditHost - - - - 454 - - - - terminate: - - - - 455 - - - - searchText: - - - - 468 - - - - setFontQuality: - - - - 475 - - - - setFontQuality: - - - - 476 - - - - setFontQuality: - - - - 477 - - - - setFontQuality: - - - - 478 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - MainMenu - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 103 - - - YES - - - - 1 - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - - - - - - - - - - - 75 - - - 3 - - - 80 - - - 8 - - - 78 - - - 6 - - - 72 - - - - - 82 - - - 9 - - - 124 - - - YES - - - - - - 77 - - - 5 - - - 73 - - - 1 - - - 79 - - - 7 - - - 112 - - - 10 - - - 74 - - - 2 - - - 125 - - - YES - - - - - - 126 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 216 - - - YES - - - - - - 200 - - - YES - - - - - - - - - 219 - - - - - 201 - - - - - 204 - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 106 - - - YES - - - - 2 - - - 111 - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - 1111 - - - 144 - - - - - 129 - - - 121 - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - - 297 - - - - - 298 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 346 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 371 - - - YES - - - - - - 372 - - - YES - - - - - - - - 375 - - - YES - - - - - - 376 - - - YES - - - - - - - 377 - - - YES - - - - - - 378 - - - YES - - - - - - 379 - - - YES - - - - - - - - - - - - - 380 - - - - - 381 - - - - - 382 - - - - - 383 - - - - - 384 - - - - - 385 - - - - - 386 - - - - - 387 - - - - - 388 - - - YES - - - - - - - - - - - - - - - - - - - - - - 389 - - - - - 390 - - - - - 391 - - - - - 392 - - - - - 393 - - - - - 394 - - - - - 395 - - - - - 396 - - - - - 397 - - - YES - - - - - - 398 - - - YES - - - - - - 399 - - - YES - - - - - - 400 - - - - - 401 - - - - - 402 - - - - - 403 - - - - - 404 - - - - - 405 - - - YES - - - - - - - - - - 406 - - - - - 407 - - - - - 408 - - - - - 409 - - - - - 410 - - - - - 411 - - - YES - - - - - - - - 412 - - - - - 413 - - - - - 414 - - - - - 415 - - - YES - - - - - - - - - 416 - - - - - 417 - - - - - 418 - - - - - 419 - - - - - 420 - - - - - 450 - - - - - 451 - - - - - 452 - - - YES - - - - - - 453 - - - - - 466 - - - YES - - - - - - 467 - - - - - 469 - - - YES - - - - - - 470 - - - YES - - - - - - - - - 471 - - - - - 472 - - - - - 473 - - - - - 474 - - - - - - - YES - - YES - -3.IBPluginDependency - 103.IBPluginDependency - 103.ImportedFromIB2 - 106.IBPluginDependency - 106.ImportedFromIB2 - 106.editorWindowContentRectSynchronizationRect - 111.IBPluginDependency - 111.ImportedFromIB2 - 112.IBPluginDependency - 112.ImportedFromIB2 - 124.IBPluginDependency - 124.ImportedFromIB2 - 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect - 126.IBPluginDependency - 126.ImportedFromIB2 - 129.IBPluginDependency - 129.ImportedFromIB2 - 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect - 131.IBPluginDependency - 131.ImportedFromIB2 - 134.IBPluginDependency - 134.ImportedFromIB2 - 136.IBPluginDependency - 136.ImportedFromIB2 - 143.IBPluginDependency - 143.ImportedFromIB2 - 144.IBPluginDependency - 144.ImportedFromIB2 - 145.IBPluginDependency - 145.ImportedFromIB2 - 149.IBPluginDependency - 149.ImportedFromIB2 - 150.IBPluginDependency - 150.ImportedFromIB2 - 19.IBPluginDependency - 19.ImportedFromIB2 - 195.IBPluginDependency - 195.ImportedFromIB2 - 196.IBPluginDependency - 196.ImportedFromIB2 - 197.IBPluginDependency - 197.ImportedFromIB2 - 198.IBPluginDependency - 198.ImportedFromIB2 - 199.IBPluginDependency - 199.ImportedFromIB2 - 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect - 201.IBPluginDependency - 201.ImportedFromIB2 - 202.IBPluginDependency - 202.ImportedFromIB2 - 203.IBPluginDependency - 203.ImportedFromIB2 - 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect - 206.IBPluginDependency - 206.ImportedFromIB2 - 207.IBPluginDependency - 207.ImportedFromIB2 - 208.IBPluginDependency - 208.ImportedFromIB2 - 209.IBPluginDependency - 209.ImportedFromIB2 - 210.IBPluginDependency - 210.ImportedFromIB2 - 211.IBPluginDependency - 211.ImportedFromIB2 - 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect - 213.IBPluginDependency - 213.ImportedFromIB2 - 214.IBPluginDependency - 214.ImportedFromIB2 - 215.IBPluginDependency - 215.ImportedFromIB2 - 216.IBPluginDependency - 216.ImportedFromIB2 - 217.IBPluginDependency - 217.ImportedFromIB2 - 218.IBPluginDependency - 218.ImportedFromIB2 - 219.IBPluginDependency - 219.ImportedFromIB2 - 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect - 221.IBPluginDependency - 221.ImportedFromIB2 - 23.IBPluginDependency - 23.ImportedFromIB2 - 236.IBPluginDependency - 236.ImportedFromIB2 - 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect - 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect - 295.IBPluginDependency - 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect - 297.IBPluginDependency - 298.IBPluginDependency - 346.IBPluginDependency - 346.ImportedFromIB2 - 348.IBPluginDependency - 348.ImportedFromIB2 - 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect - 350.IBPluginDependency - 350.ImportedFromIB2 - 351.IBPluginDependency - 351.ImportedFromIB2 - 354.IBPluginDependency - 354.ImportedFromIB2 - 371.IBEditorWindowLastContentRect - 371.IBPluginDependency - 371.IBWindowTemplateEditedContentRect - 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.maxSize - 372.IBPluginDependency - 375.IBPluginDependency - 376.IBEditorWindowLastContentRect - 376.IBPluginDependency - 377.IBPluginDependency - 378.IBPluginDependency - 379.IBPluginDependency - 380.IBPluginDependency - 381.IBPluginDependency - 382.IBPluginDependency - 383.IBPluginDependency - 384.IBPluginDependency - 385.IBPluginDependency - 386.IBPluginDependency - 387.IBPluginDependency - 388.IBEditorWindowLastContentRect - 388.IBPluginDependency - 389.IBPluginDependency - 390.IBPluginDependency - 391.IBPluginDependency - 392.IBPluginDependency - 393.IBPluginDependency - 394.IBPluginDependency - 395.IBPluginDependency - 396.IBPluginDependency - 397.IBPluginDependency - 398.IBPluginDependency - 399.IBPluginDependency - 400.IBPluginDependency - 401.IBPluginDependency - 402.IBPluginDependency - 403.IBPluginDependency - 404.IBPluginDependency - 405.IBPluginDependency - 406.IBPluginDependency - 407.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 417.IBPluginDependency - 418.IBPluginDependency - 419.IBPluginDependency - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 466.IBPluginDependency - 467.IBPluginDependency - 5.IBPluginDependency - 5.ImportedFromIB2 - 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect - 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect - 58.IBPluginDependency - 58.ImportedFromIB2 - 72.IBPluginDependency - 72.ImportedFromIB2 - 73.IBPluginDependency - 73.ImportedFromIB2 - 74.IBPluginDependency - 74.ImportedFromIB2 - 75.IBPluginDependency - 75.ImportedFromIB2 - 77.IBPluginDependency - 77.ImportedFromIB2 - 78.IBPluginDependency - 78.ImportedFromIB2 - 79.IBPluginDependency - 79.ImportedFromIB2 - 80.IBPluginDependency - 80.ImportedFromIB2 - 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect - 82.IBPluginDependency - 82.ImportedFromIB2 - 83.IBPluginDependency - 83.ImportedFromIB2 - 92.IBPluginDependency - 92.ImportedFromIB2 - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{596, 852}, {216, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{207, 285}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{274, 370}, {982, 692}} - com.apple.InterfaceBuilder.CocoaPlugin - {{274, 370}, {982, 692}} - - {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{437, 242}, {86, 43}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{523, 2}, {178, 283}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{219, 102}, {245, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - YES - - - YES - - - - - YES - - - YES - - - - 468 - - - - YES - - AppController - NSObject - - searchText: - id - - - mEditHost - NSBox - - - IBProjectSource - AppController.h - - - - - YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBox - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSBox.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSDocument - NSObject - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - - YES - - YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: - - - YES - id - id - id - id - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSSearchField - NSTextField - - IBFrameworkSource - AppKit.framework/Headers/NSSearchField.h - - - - NSSearchFieldCell - NSTextFieldCell - - IBFrameworkSource - AppKit.framework/Headers/NSSearchFieldCell.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - ../ScintillaTest.xcodeproj - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scintilla/cocoa/ScintillaTest/Info.plist b/scintilla/cocoa/ScintillaTest/Info.plist index 6364d76a..ef71339a 100644 --- a/scintilla/cocoa/ScintillaTest/Info.plist +++ b/scintilla/cocoa/ScintillaTest/Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - com.sun.${PRODUCT_NAME:identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj index ff962ef6..6934a5a5 100644 --- a/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj +++ b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 271FA52C0F850BE20033D021 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 271FA52B0F850BE20033D021 /* AppController.mm */; }; 2791F4490FC1A8E9009DBCF9 /* TestData.sql in Resources */ = {isa = PBXBuildFile; fileRef = 2791F4480FC1A8E9009DBCF9 /* TestData.sql */; }; 27AF7EC30FC2C351007160EF /* Scintilla.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; }; - 27AF7ECA0FC2C388007160EF /* Scintilla.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; }; + 27AF7ECA0FC2C388007160EF /* Scintilla.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -191,7 +191,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0930; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */; compatibilityVersion = "Xcode 3.2"; @@ -285,7 +285,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -294,15 +294,13 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ScintillaTest_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - SCI_LEXER, - SCI_NAMESPACE, - ); + GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = ScintillaTest; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = ""; @@ -313,22 +311,20 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ScintillaTest_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - SCI_LEXER, - SCI_NAMESPACE, - ); + GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER; HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(HOME)/Applications"; LIBRARY_SEARCH_PATHS = "$(inherited)"; OTHER_LDFLAGS = ""; + PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = ScintillaTest; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = ""; @@ -338,14 +334,28 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -363,14 +373,27 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..b3258829 --- /dev/null +++ b/scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/scintilla/cocoa/ScintillaView.h b/scintilla/cocoa/ScintillaView.h index a70399fa..c0e755df 100644 --- a/scintilla/cocoa/ScintillaView.h +++ b/scintilla/cocoa/ScintillaView.h @@ -23,7 +23,6 @@ #define WM_COMMAND 1001 #define WM_NOTIFY 1002 -namespace Scintilla { /** * On the Mac, there is no WM_COMMAND or WM_NOTIFY message that can be sent * back to the parent. Therefore, there must be a callback handler that acts @@ -35,34 +34,25 @@ namespace Scintilla { *
* WM_NOTIFY: wParam = control ID, lParam = ptr to SCNotification structure, with hwndFrom set to ScintillaCocoa* */ -typedef void(*SciNotifyFunc) (intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam); - -class ScintillaCocoa; -} - -@class ScintillaView; +typedef void(*SciNotifyFunc)(intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam); extern NSString *const SCIUpdateUINotification; @protocol ScintillaNotificationProtocol -- (void)notification: (Scintilla::SCNotification*)notification; +- (void) notification: (SCNotification *) notification; +@end + +/** + * SCIScrollView provides pre-macOS 10.14 tiling behavior. + */ +@interface SCIScrollView : NSScrollView; + @end /** * SCIMarginView draws line numbers and other margins next to the text view. */ -@interface SCIMarginView : NSRulerView -{ -@private - int marginWidth; - ScintillaView *owner; - NSMutableArray *currentCursors; -} - -@property (assign) int marginWidth; -@property (assign) ScintillaView *owner; - -- (id)initWithScrollView:(NSScrollView *)aScrollView; +@interface SCIMarginView : NSRulerView; @end @@ -71,89 +61,63 @@ extern NSString *const SCIUpdateUINotification; * provides a canvas for painting the output. */ @interface SCIContentView : NSView < - NSTextInputClient, - NSUserInterfaceValidations, - NSDraggingSource, - NSDraggingDestination> -{ -@private - ScintillaView* mOwner; - NSCursor* mCurrentCursor; - NSTrackingArea *trackingArea; + NSTextInputClient, + NSUserInterfaceValidations, + NSDraggingSource, + NSDraggingDestination, + NSAccessibilityStaticText>; - // Set when we are in composition mode and partial input is displayed. - NSRange mMarkedTextRange; -} - -@property (nonatomic, assign) ScintillaView* owner; - -- (void) setCursor: (int) cursor; - -- (BOOL) canUndo; -- (BOOL) canRedo; +- (void) setCursor: (int) cursor; // Needed by ScintillaCocoa @end -@interface ScintillaView : NSView -{ -@private - // The back end is kind of a controller and model in one. - // It uses the content view for display. - Scintilla::ScintillaCocoa* mBackend; +/** + * ScintillaView is the class instantiated by client code. + * It contains an NSScrollView which contains a SCIMarginView and a SCIContentView. + * It is responsible for providing an API and communicating to a delegate. + */ +@interface ScintillaView : NSView ; - // This is the actual content to which the backend renders itself. - SCIContentView* mContent; - - NSScrollView *scrollView; - SCIMarginView *marginView; - - CGFloat zoomDelta; - - // Area to display additional controls (e.g. zoom info, caret position, status info). - NSView * mInfoBar; - BOOL mInfoBarAtTop; - - id mDelegate; -} - -@property (nonatomic, readonly) Scintilla::ScintillaCocoa* backend; -@property (nonatomic, assign) id delegate; -@property (nonatomic, readonly) NSScrollView *scrollView; +@property(nonatomic, unsafe_unretained) id delegate; +@property(nonatomic, readonly) NSScrollView *scrollView; + (Class) contentViewClass; -- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location - value: (float) value; +- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location + value: (float) value; - (void) setCallback: (id ) callback; - (void) suspendDrawing: (BOOL) suspend; -- (void) notification: (Scintilla::SCNotification*) notification; +- (void) notification: (SCNotification *) notification; + +- (void) updateIndicatorIME; // Scroller handling - (void) setMarginWidth: (int) width; -- (SCIContentView*) content; +- (SCIContentView *) content; - (void) updateMarginCursors; // NSTextView compatibility layer. -- (NSString*) string; -- (void) setString: (NSString*) aString; +- (NSString *) string; +- (void) setString: (NSString *) aString; - (void) insertText: (id) aString; - (void) setEditable: (BOOL) editable; - (BOOL) isEditable; - (NSRange) selectedRange; +- (NSRange) selectedRangePositions; -- (NSString*) selectedString; +- (NSString *) selectedString; - (void) deleteRange: (NSRange) range; -- (void)setFontName: (NSString*) font - size: (int) size - bold: (BOOL) bold - italic: (BOOL) italic; +- (void) setFontName: (NSString *) font + size: (int) size + bold: (BOOL) bold + italic: (BOOL) italic; // Native call through to the backend. -+ (sptr_t) directCall: (ScintillaView*) sender message: (unsigned int) message wParam: (uptr_t) wParam - lParam: (sptr_t) lParam; ++ (sptr_t) directCall: (ScintillaView *) sender message: (unsigned int) message wParam: (uptr_t) wParam + lParam: (sptr_t) lParam; - (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam; - (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam; - (sptr_t) message: (unsigned int) message; @@ -165,40 +129,40 @@ extern NSString *const SCIUpdateUINotification; - (long) getGeneralProperty: (int) property; - (long) getGeneralProperty: (int) property parameter: (long) parameter; - (long) getGeneralProperty: (int) property parameter: (long) parameter extra: (long) extra; -- (long) getGeneralProperty: (int) property ref: (const void*) ref; -- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor*) value; -- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString*) fromHTML; -- (NSColor*) getColorProperty: (int) property parameter: (long) parameter; -- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void*) value; -- (const void*) getReferenceProperty: (int) property parameter: (long) parameter; -- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString*) value; -- (NSString*) getStringProperty: (int) property parameter: (long) parameter; -- (void) setLexerProperty: (NSString*) name value: (NSString*) value; -- (NSString*) getLexerProperty: (NSString*) name; +- (long) getGeneralProperty: (int) property ref: (const void *) ref; +- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor *) value; +- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString *) fromHTML; +- (NSColor *) getColorProperty: (int) property parameter: (long) parameter; +- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void *) value; +- (const void *) getReferenceProperty: (int) property parameter: (long) parameter; +- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString *) value; +- (NSString *) getStringProperty: (int) property parameter: (long) parameter; +- (void) setLexerProperty: (NSString *) name value: (NSString *) value; +- (NSString *) getLexerProperty: (NSString *) name; // The delegate property should be used instead of registerNotifyCallback which is deprecated. -- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback __attribute__((deprecated)); +- (void) registerNotifyCallback: (intptr_t) windowid value: (SciNotifyFunc) callback __attribute__ ( (deprecated)) ; -- (void) setInfoBar: (NSView *) aView top: (BOOL) top; -- (void) setStatusText: (NSString*) text; +- (void) setInfoBar: (NSView *) aView top: (BOOL) top; +- (void) setStatusText: (NSString *) text; -- (BOOL) findAndHighlightText: (NSString*) searchText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - scrollTo: (BOOL) scrollTo - wrap: (BOOL) wrap; +- (BOOL) findAndHighlightText: (NSString *) searchText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + scrollTo: (BOOL) scrollTo + wrap: (BOOL) wrap; -- (BOOL) findAndHighlightText: (NSString*) searchText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - scrollTo: (BOOL) scrollTo - wrap: (BOOL) wrap - backwards: (BOOL) backwards; +- (BOOL) findAndHighlightText: (NSString *) searchText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + scrollTo: (BOOL) scrollTo + wrap: (BOOL) wrap + backwards: (BOOL) backwards; -- (int) findAndReplaceText: (NSString*) searchText - byText: (NSString*) newText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - doAll: (BOOL) doAll; +- (int) findAndReplaceText: (NSString *) searchText + byText: (NSString *) newText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + doAll: (BOOL) doAll; @end diff --git a/scintilla/cocoa/ScintillaView.mm b/scintilla/cocoa/ScintillaView.mm index cb84066c..07fccc2b 100644 --- a/scintilla/cocoa/ScintillaView.mm +++ b/scintilla/cocoa/ScintillaView.mm @@ -9,167 +9,227 @@ * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). */ +#include +#include + #import "Platform.h" #import "ScintillaView.h" #import "ScintillaCocoa.h" using namespace Scintilla; +// Add backend property to ScintillaView as a private category. +// Specified here as backend accessed by SCIMarginView and SCIContentView. +@interface ScintillaView() +@property(nonatomic, readonly) Scintilla::ScintillaCocoa *backend; +@end + // Two additional cursors we need, which aren't provided by Cocoa. -static NSCursor* reverseArrowCursor; -static NSCursor* waitCursor; +static NSCursor *reverseArrowCursor; +static NSCursor *waitCursor; NSString *const SCIUpdateUINotification = @"SCIUpdateUI"; /** * Provide an NSCursor object that matches the Window::Cursor enumeration. */ -static NSCursor *cursorFromEnum(Window::Cursor cursor) -{ - switch (cursor) - { - case Window::cursorText: - return [NSCursor IBeamCursor]; - case Window::cursorArrow: - return [NSCursor arrowCursor]; - case Window::cursorWait: - return waitCursor; - case Window::cursorHoriz: - return [NSCursor resizeLeftRightCursor]; - case Window::cursorVert: - return [NSCursor resizeUpDownCursor]; - case Window::cursorReverseArrow: - return reverseArrowCursor; - case Window::cursorUp: - default: - return [NSCursor arrowCursor]; - } +static NSCursor *cursorFromEnum(Window::Cursor cursor) { + switch (cursor) { + case Window::cursorText: + return [NSCursor IBeamCursor]; + case Window::cursorArrow: + return [NSCursor arrowCursor]; + case Window::cursorWait: + return waitCursor; + case Window::cursorHoriz: + return [NSCursor resizeLeftRightCursor]; + case Window::cursorVert: + return [NSCursor resizeUpDownCursor]; + case Window::cursorReverseArrow: + return reverseArrowCursor; + case Window::cursorUp: + default: + return [NSCursor arrowCursor]; + } } +@implementation SCIScrollView +- (void) tile { + [super tile]; -@implementation SCIMarginView +#if defined(MAC_OS_X_VERSION_10_14) + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { + NSRect frame = self.contentView.frame; + frame.origin.x = self.verticalRulerView.requiredThickness; + frame.size.width -= frame.origin.x; + self.contentView.frame = frame; + } +#endif +} +@end + +// Add marginWidth and owner properties as a private category. +@interface SCIMarginView() +@property(assign) int marginWidth; +@property(nonatomic, weak) ScintillaView *owner; +@end + +@implementation SCIMarginView { + int marginWidth; + ScintillaView *__weak owner; + NSMutableArray *currentCursors; +} @synthesize marginWidth, owner; -- (id)initWithScrollView:(NSScrollView *)aScrollView -{ - self = [super initWithScrollView:aScrollView orientation:NSVerticalRuler]; - if (self != nil) - { - owner = nil; - marginWidth = 20; - currentCursors = [[NSMutableArray arrayWithCapacity:0] retain]; - for (size_t i=0; i<=SC_MAX_MARGIN; i++) - { - [currentCursors addObject: [reverseArrowCursor retain]]; - } - [self setClientView:[aScrollView documentView]]; - } - return self; +- (instancetype) initWithScrollView: (NSScrollView *) aScrollView { + self = [super initWithScrollView: aScrollView orientation: NSVerticalRuler]; + if (self != nil) { + owner = nil; + marginWidth = 20; + currentCursors = [NSMutableArray arrayWithCapacity: 0]; + for (size_t i=0; i<=SC_MAX_MARGIN; i++) { + [currentCursors addObject: reverseArrowCursor]; + } + self.clientView = aScrollView.documentView; + if ([self respondsToSelector: @selector(setAccessibilityLabel:)]) + self.accessibilityLabel = @"Scintilla Margin"; + } + return self; } -- (void) dealloc -{ - [currentCursors release]; - [super dealloc]; + +- (void) setFrame: (NSRect) frame { + super.frame = frame; + + [self.window invalidateCursorRectsForView: self]; } -- (void) setFrame: (NSRect) frame -{ - [super setFrame: frame]; - - [[self window] invalidateCursorRectsForView: self]; +- (CGFloat) requiredThickness { + return marginWidth; } -- (CGFloat)requiredThickness -{ - return marginWidth; +- (void) drawHashMarksAndLabelsInRect: (NSRect) aRect { + if (owner) { + NSRect contentRect = self.scrollView.contentView.bounds; + NSRect marginRect = self.bounds; + // Ensure paint to bottom of view to avoid glitches + if (marginRect.size.height > contentRect.size.height) { + // Legacy scroll bar mode leaves a poorly painted corner + aRect = marginRect; + } + owner.backend->PaintMargin(aRect); + } } -- (void)drawHashMarksAndLabelsInRect:(NSRect)aRect -{ - if (owner) { - NSRect contentRect = [[[self scrollView] contentView] bounds]; - NSRect marginRect = [self bounds]; - // Ensure paint to bottom of view to avoid glitches - if (marginRect.size.height > contentRect.size.height) { - // Legacy scroll bar mode leaves a poorly painted corner - aRect = marginRect; - } - owner.backend->PaintMargin(aRect); - } +/** + * Called by the framework if it wants to show a context menu for the margin. + */ +- (NSMenu *) menuForEvent: (NSEvent *) theEvent { + NSMenu *menu = [owner menuForEvent: theEvent]; + if (menu) { + return menu; + } else if (owner.backend->ShouldDisplayPopupOnMargin()) { + return owner.backend->CreateContextMenu(theEvent); + } else { + return nil; + } } -- (void) mouseDown: (NSEvent *) theEvent -{ - NSClipView *textView = [[self scrollView] contentView]; - [[textView window] makeFirstResponder:textView]; - owner.backend->MouseDown(theEvent); +- (void) mouseDown: (NSEvent *) theEvent { + NSClipView *textView = self.scrollView.contentView; + [textView.window makeFirstResponder: textView]; + owner.backend->MouseDown(theEvent); } -- (void) mouseDragged: (NSEvent *) theEvent -{ - owner.backend->MouseMove(theEvent); +- (void) rightMouseDown: (NSEvent *) theEvent { + [NSMenu popUpContextMenu: [self menuForEvent: theEvent] withEvent: theEvent forView: self]; + + owner.backend->RightMouseDown(theEvent); } -- (void) mouseMoved: (NSEvent *) theEvent -{ - owner.backend->MouseMove(theEvent); +- (void) mouseDragged: (NSEvent *) theEvent { + owner.backend->MouseMove(theEvent); } -- (void) mouseUp: (NSEvent *) theEvent -{ - owner.backend->MouseUp(theEvent); +- (void) mouseMoved: (NSEvent *) theEvent { + owner.backend->MouseMove(theEvent); +} + +- (void) mouseUp: (NSEvent *) theEvent { + owner.backend->MouseUp(theEvent); +} + +// Not a simple button so return failure +- (BOOL) accessibilityPerformPress { + return NO; } /** * This method is called to give us the opportunity to define our mouse sensitive rectangle. */ -- (void) resetCursorRects -{ - [super resetCursorRects]; +- (void) resetCursorRects { + [super resetCursorRects]; - int x = 0; - NSRect marginRect = [self bounds]; - size_t co = [currentCursors count]; - for (size_t i=0; iWndProc(SCI_GETMARGINCURSORN, i, 0); - long width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0); - NSCursor *cc = cursorFromEnum(static_cast(cursType)); - [currentCursors replaceObjectAtIndex:i withObject: cc]; - marginRect.origin.x = x; - marginRect.size.width = width; - [self addCursorRect: marginRect cursor: cc]; - [cc setOnMouseEntered: YES]; - x += width; - } + int x = 0; + NSRect marginRect = self.bounds; + size_t co = currentCursors.count; + for (size_t i=0; iWndProc(SCI_GETMARGINCURSORN, i, 0); + long width =owner.backend->WndProc(SCI_GETMARGINWIDTHN, i, 0); + NSCursor *cc = cursorFromEnum(static_cast(cursType)); + currentCursors[i] = cc; + marginRect.origin.x = x; + marginRect.size.width = width; + [self addCursorRect: marginRect cursor: cc]; + [cc setOnMouseEntered: YES]; + x += width; + } } @end -@implementation SCIContentView +// Add owner property as a private category. +@interface SCIContentView() +@property(nonatomic, weak) ScintillaView *owner; +@end + +@implementation SCIContentView { + ScintillaView *__weak mOwner; + NSCursor *mCurrentCursor; + NSTrackingArea *trackingArea; + + // Set when we are in composition mode and partial input is displayed. + NSRange mMarkedTextRange; +} @synthesize owner = mOwner; //-------------------------------------------------------------------------------------------------- -- (NSView*) initWithFrame: (NSRect) frame -{ - self = [super initWithFrame: frame]; +- (NSView *) initWithFrame: (NSRect) frame { + self = [super initWithFrame: frame]; - if (self != nil) - { - // Some initialization for our view. - mCurrentCursor = [[NSCursor arrowCursor] retain]; - trackingArea = nil; - mMarkedTextRange = NSMakeRange(NSNotFound, 0); + if (self != nil) { + // Some initialization for our view. + mCurrentCursor = [NSCursor arrowCursor]; + trackingArea = nil; + mMarkedTextRange = NSMakeRange(NSNotFound, 0); - [self registerForDraggedTypes: [NSArray arrayWithObjects: - NSStringPboardType, ScintillaRecPboardType, NSFilenamesPboardType, nil]]; - } + [self registerForDraggedTypes: @[NSStringPboardType, ScintillaRecPboardType, NSFilenamesPboardType]]; - return self; + // Set up accessibility in the text role + if ([self respondsToSelector: @selector(setAccessibilityElement:)]) { + self.accessibilityElement = TRUE; + self.accessibilityEnabled = TRUE; + self.accessibilityLabel = NSLocalizedString(@"Scintilla", nil); // No real localization + self.accessibilityRoleDescription = @"source code editor"; + self.accessibilityRole = NSAccessibilityTextAreaRole; + self.accessibilityIdentifier = @"Scintilla"; + } + } + + return self; } //-------------------------------------------------------------------------------------------------- @@ -177,18 +237,18 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * When the view is resized or scrolled we need to update our tracking area. */ -- (void) updateTrackingAreas -{ - if (trackingArea) - [self removeTrackingArea:trackingArea]; - - int opts = (NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved); - trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] - options:opts - owner:self - userInfo:nil]; - [self addTrackingArea: trackingArea]; - [super updateTrackingAreas]; +- (void) updateTrackingAreas { + if (trackingArea) { + [self removeTrackingArea: trackingArea]; + } + + int opts = (NSTrackingActiveAlways | NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved); + trackingArea = [[NSTrackingArea alloc] initWithRect: self.bounds + options: opts + owner: self + userInfo: nil]; + [self addTrackingArea: trackingArea]; + [super updateTrackingAreas]; } //-------------------------------------------------------------------------------------------------- @@ -196,11 +256,10 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * When the view is resized we need to let the backend know. */ -- (void) setFrame: (NSRect) frame -{ - [super setFrame: frame]; - - mOwner.backend->Resize(); +- (void) setFrame: (NSRect) frame { + super.frame = frame; + + mOwner.backend->Resize(); } //-------------------------------------------------------------------------------------------------- @@ -208,16 +267,13 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Called by the backend if a new cursor must be set for the view. */ -- (void) setCursor: (int) cursor -{ - Window::Cursor eCursor = (Window::Cursor)cursor; - [mCurrentCursor autorelease]; - mCurrentCursor = cursorFromEnum(eCursor); - [mCurrentCursor retain]; +- (void) setCursor: (int) cursor { + Window::Cursor eCursor = (Window::Cursor)cursor; + mCurrentCursor = cursorFromEnum(eCursor); - // Trigger recreation of the cursor rectangle(s). - [[self window] invalidateCursorRectsForView: self]; - [mOwner updateMarginCursors]; + // Trigger recreation of the cursor rectangle(s). + [self.window invalidateCursorRectsForView: self]; + [mOwner updateMarginCursors]; } //-------------------------------------------------------------------------------------------------- @@ -225,13 +281,13 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * This method is called to give us the opportunity to define our mouse sensitive rectangle. */ -- (void) resetCursorRects -{ - [super resetCursorRects]; +- (void) resetCursorRects { + [super resetCursorRects]; - // We only have one cursor rect: our bounds. - [self addCursorRect: [self bounds] cursor: mCurrentCursor]; - [mCurrentCursor setOnMouseEntered: YES]; + // We only have one cursor rect: our bounds. + const NSRect visibleBounds = mOwner.backend->GetBounds(); + [self addCursorRect: visibleBounds cursor: mCurrentCursor]; + [mCurrentCursor setOnMouseEntered: YES]; } //-------------------------------------------------------------------------------------------------- @@ -239,19 +295,23 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Called before repainting. */ -- (void) viewWillDraw -{ - const NSRect *rects; - NSInteger nRects = 0; - [self getRectsBeingDrawn:&rects count:&nRects]; - if (nRects > 0) { - NSRect rectUnion = rects[0]; - for (int i=0;iWillDraw(rectUnion); - } - [super viewWillDraw]; +- (void) viewWillDraw { + if (!mOwner) { + [super viewWillDraw]; + return; + } + + const NSRect *rects; + NSInteger nRects = 0; + [self getRectsBeingDrawn: &rects count: &nRects]; + if (nRects > 0) { + NSRect rectUnion = rects[0]; + for (int i=0; iWillDraw(rectUnion); + } + [super viewWillDraw]; } //-------------------------------------------------------------------------------------------------- @@ -259,11 +319,11 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Called before responsive scrolling overdraw. */ -- (void) prepareContentInRect: (NSRect) rect -{ - mOwner.backend->WillDraw(rect); +- (void) prepareContentInRect: (NSRect) rect { + if (mOwner) + mOwner.backend->WillDraw(rect); #if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 - [super prepareContentInRect: rect]; + [super prepareContentInRect: rect]; #endif } @@ -272,15 +332,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Gets called by the runtime when the view needs repainting. */ -- (void) drawRect: (NSRect) rect -{ - CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; +- (void) drawRect: (NSRect) rect { + CGContextRef context = (CGContextRef) [NSGraphicsContext currentContext].graphicsPort; - if (!mOwner.backend->Draw(rect, context)) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self setNeedsDisplay:YES]; - }); - } + if (!mOwner.backend->Draw(rect, context)) { + dispatch_async(dispatch_get_main_queue(), ^ { + [self setNeedsDisplay: YES]; + }); + } } //-------------------------------------------------------------------------------------------------- @@ -292,16 +351,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * Note that because of returning YES here most coordinates we use now (e.g. for painting, * invalidating rectangles etc.) are given with +Y pointing down! */ -- (BOOL) isFlipped -{ - return YES; +- (BOOL) isFlipped { + return YES; } //-------------------------------------------------------------------------------------------------- -- (BOOL) isOpaque -{ - return YES; +- (BOOL) isOpaque { + return YES; } //-------------------------------------------------------------------------------------------------- @@ -309,10 +366,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Implement the "click through" behavior by telling the caller we accept the first mouse event too. */ -- (BOOL) acceptsFirstMouse: (NSEvent *) theEvent -{ +- (BOOL) acceptsFirstMouse: (NSEvent *) theEvent { #pragma unused(theEvent) - return YES; + return YES; } //-------------------------------------------------------------------------------------------------- @@ -320,9 +376,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Make this view accepting events as first responder. */ -- (BOOL) acceptsFirstResponder -{ - return YES; +- (BOOL) acceptsFirstResponder { + return YES; } //-------------------------------------------------------------------------------------------------- @@ -330,100 +385,105 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * Called by the framework if it wants to show a context menu for the editor. */ -- (NSMenu*) menuForEvent: (NSEvent*) theEvent -{ - if (![mOwner respondsToSelector: @selector(menuForEvent:)]) - return mOwner.backend->CreateContextMenu(theEvent); - else - return [mOwner menuForEvent: theEvent]; +- (NSMenu *) menuForEvent: (NSEvent *) theEvent { + NSMenu *menu = [mOwner menuForEvent: theEvent]; + if (menu) { + return menu; + } else if (mOwner.backend->ShouldDisplayPopupOnText()) { + return mOwner.backend->CreateContextMenu(theEvent); + } else { + return nil; + } } //-------------------------------------------------------------------------------------------------- // Adoption of NSTextInputClient protocol. -- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange -{ - const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); - // The backend validated aRange and may have removed characters beyond the end of the document. - const NSRange charRange = mOwner.backend->CharactersFromPositions(posRange); - if (!NSEqualRanges(aRange, charRange)) - { - *actualRange = charRange; - } +- (NSAttributedString *) attributedSubstringForProposedRange: (NSRange) aRange actualRange: (NSRangePointer) actualRange { + const NSInteger lengthCharacters = self.accessibilityNumberOfCharacters; + if (aRange.location > lengthCharacters) { + return nil; + } + const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); + // The backend validated aRange and may have removed characters beyond the end of the document. + const NSRange charRange = mOwner.backend->CharactersFromPositions(posRange); + if (!NSEqualRanges(aRange, charRange)) { + *actualRange = charRange; + } - [mOwner message: SCI_SETTARGETRANGE wParam: posRange.location lParam: NSMaxRange(posRange)]; - std::string text([mOwner message: SCI_TARGETASUTF8] + 1, 0); - [mOwner message: SCI_TARGETASUTF8 wParam: 0 lParam: reinterpret_cast(&text[0])]; - NSString *result = [NSString stringWithUTF8String: text.c_str()]; - NSMutableAttributedString *asResult = [[[NSMutableAttributedString alloc] initWithString:result] autorelease]; + [mOwner message: SCI_SETTARGETRANGE wParam: posRange.location lParam: NSMaxRange(posRange)]; + std::string text([mOwner message: SCI_TARGETASUTF8] + 1, 0); + [mOwner message: SCI_TARGETASUTF8 wParam: 0 lParam: reinterpret_cast(&text[0])]; + text = FixInvalidUTF8(text); + NSString *result = @(text.c_str()); + NSMutableAttributedString *asResult = [[NSMutableAttributedString alloc] initWithString: result]; - const NSRange rangeAS = NSMakeRange(0, [asResult length]); - const long style = [mOwner message: SCI_GETSTYLEAT wParam:posRange.location]; - std::string fontName([mOwner message: SCI_STYLEGETFONT wParam:style lParam:0] + 1, 0); - [mOwner message: SCI_STYLEGETFONT wParam:style lParam:(sptr_t)&fontName[0]]; - const CGFloat fontSize = [mOwner message: SCI_STYLEGETSIZEFRACTIONAL wParam:style] / 100.0f; - NSString *sFontName = [NSString stringWithUTF8String: fontName.c_str()]; - NSFont *font = [NSFont fontWithName:sFontName size:fontSize]; - [asResult addAttribute:NSFontAttributeName value:font range:rangeAS]; + const NSRange rangeAS = NSMakeRange(0, asResult.length); + // SCI_GETSTYLEAT reports a signed byte but want an unsigned to index into styles + const char styleByte = static_cast([mOwner message: SCI_GETSTYLEAT wParam: posRange.location]); + const long style = static_cast(styleByte); + std::string fontName([mOwner message: SCI_STYLEGETFONT wParam: style lParam: 0] + 1, 0); + [mOwner message: SCI_STYLEGETFONT wParam: style lParam: (sptr_t)&fontName[0]]; + const CGFloat fontSize = [mOwner message: SCI_STYLEGETSIZEFRACTIONAL wParam: style] / 100.0f; + NSString *sFontName = @(fontName.c_str()); + NSFont *font = [NSFont fontWithName: sFontName size: fontSize]; + [asResult addAttribute: NSFontAttributeName value: font range: rangeAS]; - return asResult; + return asResult; } //-------------------------------------------------------------------------------------------------- -- (NSUInteger) characterIndexForPoint: (NSPoint) point -{ - const NSRect rectPoint = {point, NSZeroSize}; - const NSRect rectInWindow = [self.window convertRectFromScreen:rectPoint]; - const NSRect rectLocal = [[[self superview] superview] convertRect:rectInWindow fromView:nil]; +- (NSUInteger) characterIndexForPoint: (NSPoint) point { + const NSRect rectPoint = {point, NSZeroSize}; + const NSRect rectInWindow = [self.window convertRectFromScreen: rectPoint]; + const NSRect rectLocal = [self.superview.superview convertRect: rectInWindow fromView: nil]; - const long position = [mOwner message: SCI_CHARPOSITIONFROMPOINT - wParam: rectLocal.origin.x - lParam: rectLocal.origin.y]; - if (position == INVALID_POSITION) - { - return NSNotFound; - } - else - { - const NSRange index = mOwner.backend->CharactersFromPositions(NSMakeRange(position, 0)); - return index.location; - } + const long position = [mOwner message: SCI_CHARPOSITIONFROMPOINT + wParam: rectLocal.origin.x + lParam: rectLocal.origin.y]; + if (position == INVALID_POSITION) { + return NSNotFound; + } else { + const NSRange index = mOwner.backend->CharactersFromPositions(NSMakeRange(position, 0)); + return index.location; + } } //-------------------------------------------------------------------------------------------------- -- (void) doCommandBySelector: (SEL) selector -{ - if ([self respondsToSelector: @selector(selector)]) - [self performSelector: selector withObject: nil]; +- (void) doCommandBySelector: (SEL) selector { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + if ([self respondsToSelector: selector]) + [self performSelector: selector withObject: nil]; +#pragma clang diagnostic pop } //-------------------------------------------------------------------------------------------------- -- (NSRect) firstRectForCharacterRange: (NSRange) aRange actualRange: (NSRangePointer) actualRange -{ - const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); +- (NSRect) firstRectForCharacterRange: (NSRange) aRange actualRange: (NSRangePointer) actualRange { +#pragma unused(actualRange) + const NSRange posRange = mOwner.backend->PositionsFromCharacters(aRange); - NSRect rect; - rect.origin.x = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: posRange.location]; - rect.origin.y = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: posRange.location]; - const NSUInteger rangeEnd = NSMaxRange(posRange); - rect.size.width = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.x; - rect.size.height = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.y; - rect.size.height += [mOwner message: SCI_TEXTHEIGHT wParam: 0 lParam: 0]; - const NSRect rectInWindow = [[[self superview] superview] convertRect:rect toView:nil]; - const NSRect rectScreen = [self.window convertRectToScreen:rectInWindow]; + NSRect rect; + rect.origin.x = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: posRange.location]; + rect.origin.y = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: posRange.location]; + const NSUInteger rangeEnd = NSMaxRange(posRange); + rect.size.width = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.x; + rect.size.height = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: rangeEnd] - rect.origin.y; + rect.size.height += [mOwner message: SCI_TEXTHEIGHT wParam: 0 lParam: 0]; + const NSRect rectInWindow = [self.superview.superview convertRect: rect toView: nil]; + const NSRect rectScreen = [self.window convertRectToScreen: rectInWindow]; - return rectScreen; + return rectScreen; } //-------------------------------------------------------------------------------------------------- -- (BOOL) hasMarkedText -{ - return mMarkedTextRange.length > 0; +- (BOOL) hasMarkedText { + return mMarkedTextRange.length > 0; } //-------------------------------------------------------------------------------------------------- @@ -433,17 +493,14 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * selection if there is any. * First removes the replacementRange. */ -- (void) insertText: (id) aString replacementRange: (NSRange) replacementRange -{ - if ((mMarkedTextRange.location != NSNotFound) && (replacementRange.location != NSNotFound)) - { +- (void) insertText: (id) aString replacementRange: (NSRange) replacementRange { + if ((mMarkedTextRange.location != NSNotFound) && (replacementRange.location != NSNotFound)) { NSLog(@"Trying to insertText when there is both a marked range and a replacement range"); } // Remove any previously marked text first. mOwner.backend->CompositionUndo(); - if (mMarkedTextRange.location != NSNotFound) - { + if (mMarkedTextRange.location != NSNotFound) { const NSRange posRangeMark = mOwner.backend->PositionsFromCharacters(mMarkedTextRange); [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeMark.location]; } @@ -454,8 +511,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) // Its replacing a non-existent position so do nothing. return; - if (replacementRange.location != NSNotFound) - { + if (replacementRange.location != NSNotFound) { const NSRange posRangeReplacement = mOwner.backend->PositionsFromCharacters(replacementRange); [mOwner message: SCI_DELETERANGE wParam: posRangeReplacement.location @@ -463,30 +519,38 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeReplacement.location]; } - NSString* newText = @""; - if ([aString isKindOfClass:[NSString class]]) - newText = (NSString*) aString; - else if ([aString isKindOfClass:[NSAttributedString class]]) - newText = (NSString*) [aString string]; + NSString *newText = @""; + if ([aString isKindOfClass: [NSString class]]) + newText = (NSString *) aString; + else if ([aString isKindOfClass: [NSAttributedString class]]) + newText = (NSString *) [aString string]; mOwner.backend->InsertText(newText); } //-------------------------------------------------------------------------------------------------- -- (NSRange) markedRange -{ - return mMarkedTextRange; +- (NSRange) markedRange { + return mMarkedTextRange; } //-------------------------------------------------------------------------------------------------- -- (NSRange) selectedRange -{ - const long positionBegin = [mOwner message: SCI_GETSELECTIONSTART]; - const long positionEnd = [mOwner message: SCI_GETSELECTIONEND]; - NSRange posRangeSel = NSMakeRange(positionBegin, positionEnd-positionBegin); - return mOwner.backend->CharactersFromPositions(posRangeSel); +- (NSRange) selectedRange { + const NSRange posRangeSel = [mOwner selectedRangePositions]; + if (posRangeSel.length == 0) { + NSTextInputContext *tic = [NSTextInputContext currentInputContext]; + // Chinese input causes malloc crash when empty selection returned with actual + // position so return NSNotFound. + // If this is applied to European input, it stops the accented character + // chooser from appearing. + // May need to add more input source names. + if ([tic.selectedKeyboardInputSource + isEqualToString: @"com.apple.inputmethod.TCIM.Cangjie"]) { + return NSMakeRange(NSNotFound, 0); + } + } + return mOwner.backend->CharactersFromPositions(posRangeSel); } //-------------------------------------------------------------------------------------------------- @@ -500,113 +564,96 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * @param range The range of the new text to select (given relative to the insertion point of the new text). * @param replacementRange The range to remove before insertion. */ -- (void) setMarkedText: (id) aString selectedRange: (NSRange)range replacementRange: (NSRange)replacementRange -{ - NSString* newText = @""; - if ([aString isKindOfClass:[NSString class]]) - newText = (NSString*) aString; - else - if ([aString isKindOfClass:[NSAttributedString class]]) - newText = (NSString*) [aString string]; +- (void) setMarkedText: (id) aString selectedRange: (NSRange) range replacementRange: (NSRange) replacementRange { + NSString *newText = @""; + if ([aString isKindOfClass: [NSString class]]) + newText = (NSString *) aString; + else if ([aString isKindOfClass: [NSAttributedString class]]) + newText = (NSString *) [aString string]; - // Replace marked text if there is one. - if (mMarkedTextRange.length > 0) - { - mOwner.backend->CompositionUndo(); - if (replacementRange.location != NSNotFound) - { - // This situation makes no sense and has not occurred in practice. - NSLog(@"Can not handle a replacement range when there is also a marked range"); - } - else - { - replacementRange = mMarkedTextRange; - const NSRange posRangeMark = mOwner.backend->PositionsFromCharacters(mMarkedTextRange); - [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeMark.location]; - } - } - else - { - // Must perform deletion before entering composition mode or else - // both document and undo history will not contain the deleted text - // leading to an inaccurate and unusable undo history. - - // Convert selection virtual space into real space - mOwner.backend->ConvertSelectionVirtualSpace(); + // Replace marked text if there is one. + if (mMarkedTextRange.length > 0) { + mOwner.backend->CompositionUndo(); + if (replacementRange.location != NSNotFound) { + // This situation makes no sense and has not occurred in practice. + NSLog(@"Can not handle a replacement range when there is also a marked range"); + } else { + replacementRange = mMarkedTextRange; + const NSRange posRangeMark = mOwner.backend->PositionsFromCharacters(mMarkedTextRange); + [mOwner message: SCI_SETEMPTYSELECTION wParam: posRangeMark.location]; + } + } else { + // Must perform deletion before entering composition mode or else + // both document and undo history will not contain the deleted text + // leading to an inaccurate and unusable undo history. - if (replacementRange.location != NSNotFound) - { - const NSRange posRangeReplacement = mOwner.backend->PositionsFromCharacters(replacementRange); - [mOwner message: SCI_DELETERANGE - wParam: posRangeReplacement.location - lParam: posRangeReplacement.length]; - } - else // No marked or replacement range, so replace selection - { - if (!mOwner.backend->ScintillaCocoa::ClearAllSelections()) { - // Some of the selection is protected so can not perform composition here - return; - } - // Ensure only a single selection. - mOwner.backend->SelectOnlyMainSelection(); - replacementRange = [self selectedRange]; - } - } + // Convert selection virtual space into real space + mOwner.backend->ConvertSelectionVirtualSpace(); - // To support IME input to multiple selections, the following code would - // need to insert newText at each selection, mark each piece of new text and then - // select range relative to each insertion. + if (replacementRange.location != NSNotFound) { + const NSRange posRangeReplacement = mOwner.backend->PositionsFromCharacters(replacementRange); + [mOwner message: SCI_DELETERANGE + wParam: posRangeReplacement.location + lParam: posRangeReplacement.length]; + } else { // No marked or replacement range, so replace selection + if (!mOwner.backend->ScintillaCocoa::ClearAllSelections()) { + // Some of the selection is protected so can not perform composition here + return; + } + // Ensure only a single selection. + mOwner.backend->SelectOnlyMainSelection(); + const NSRange posRangeSel = [mOwner selectedRangePositions]; + replacementRange = mOwner.backend->CharactersFromPositions(posRangeSel); + } + } - if ([newText length]) - { - // Switching into composition. - mOwner.backend->CompositionStart(); - - NSRange posRangeCurrent = mOwner.backend->PositionsFromCharacters(NSMakeRange(replacementRange.location, 0)); - // Note: Scintilla internally works almost always with bytes instead chars, so we need to take - // this into account when determining selection ranges and such. - int lengthInserted = mOwner.backend->InsertText(newText); - posRangeCurrent.length = lengthInserted; - mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); - // Mark the just inserted text. Keep the marked range for later reset. - [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INDIC_IME]; - [mOwner setGeneralProperty: SCI_INDICATORFILLRANGE - parameter: posRangeCurrent.location - value: posRangeCurrent.length]; - } - else - { - mMarkedTextRange = NSMakeRange(NSNotFound, 0); - // Re-enable undo action collection if composition ended (indicated by an empty mark string). - mOwner.backend->CompositionCommit(); - } + // To support IME input to multiple selections, the following code would + // need to insert newText at each selection, mark each piece of new text and then + // select range relative to each insertion. - // Select the part which is indicated in the given range. It does not scroll the caret into view. - if (range.length > 0) - { - // range is in characters so convert to bytes for selection. - range.location += replacementRange.location; - NSRange posRangeSelect = mOwner.backend->PositionsFromCharacters(range); - [mOwner setGeneralProperty: SCI_SETSELECTION parameter: NSMaxRange(posRangeSelect) value: posRangeSelect.location]; - } + if (newText.length) { + // Switching into composition. + mOwner.backend->CompositionStart(); + + NSRange posRangeCurrent = mOwner.backend->PositionsFromCharacters(NSMakeRange(replacementRange.location, 0)); + // Note: Scintilla internally works almost always with bytes instead chars, so we need to take + // this into account when determining selection ranges and such. + ptrdiff_t lengthInserted = mOwner.backend->InsertText(newText); + posRangeCurrent.length = lengthInserted; + mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); + // Mark the just inserted text. Keep the marked range for later reset. + [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INDIC_IME]; + [mOwner setGeneralProperty: SCI_INDICATORFILLRANGE + parameter: posRangeCurrent.location + value: posRangeCurrent.length]; + } else { + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + // Re-enable undo action collection if composition ended (indicated by an empty mark string). + mOwner.backend->CompositionCommit(); + } + + // Select the part which is indicated in the given range. It does not scroll the caret into view. + if (range.length > 0) { + // range is in characters so convert to bytes for selection. + range.location += replacementRange.location; + NSRange posRangeSelect = mOwner.backend->PositionsFromCharacters(range); + [mOwner setGeneralProperty: SCI_SETSELECTION parameter: NSMaxRange(posRangeSelect) value: posRangeSelect.location]; + } } //-------------------------------------------------------------------------------------------------- -- (void) unmarkText -{ - if (mMarkedTextRange.length > 0) - { - mOwner.backend->CompositionCommit(); - mMarkedTextRange = NSMakeRange(NSNotFound, 0); - } +- (void) unmarkText { + if (mMarkedTextRange.length > 0) { + mOwner.backend->CompositionCommit(); + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + } } //-------------------------------------------------------------------------------------------------- -- (NSArray*) validAttributesForMarkedText -{ - return nil; +- (NSArray *) validAttributesForMarkedText { + return @[]; } // End of the NSTextInputClient protocol adoption. @@ -618,92 +665,95 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * handles shortcuts. The input is then forwarded to the Cocoa text input system, which in turn does * its own input handling (character composition via NSTextInputClient protocol): */ -- (void) keyDown: (NSEvent *) theEvent -{ - if (mMarkedTextRange.length == 0) - mOwner.backend->KeyboardInput(theEvent); - NSArray* events = [NSArray arrayWithObject: theEvent]; - [self interpretKeyEvents: events]; +- (void) keyDown: (NSEvent *) theEvent { + bool handled = false; + if (mMarkedTextRange.length == 0) + handled = mOwner.backend->KeyboardInput(theEvent); + if (!handled) { + NSArray *events = @[theEvent]; + [self interpretKeyEvents: events]; + } } //-------------------------------------------------------------------------------------------------- -- (void) mouseDown: (NSEvent *) theEvent -{ - mOwner.backend->MouseDown(theEvent); +- (void) mouseDown: (NSEvent *) theEvent { + mOwner.backend->MouseDown(theEvent); } //-------------------------------------------------------------------------------------------------- -- (void) mouseDragged: (NSEvent *) theEvent -{ - mOwner.backend->MouseMove(theEvent); +- (void) mouseDragged: (NSEvent *) theEvent { + mOwner.backend->MouseMove(theEvent); } //-------------------------------------------------------------------------------------------------- -- (void) mouseUp: (NSEvent *) theEvent -{ - mOwner.backend->MouseUp(theEvent); +- (void) mouseUp: (NSEvent *) theEvent { + mOwner.backend->MouseUp(theEvent); } //-------------------------------------------------------------------------------------------------- -- (void) mouseMoved: (NSEvent *) theEvent -{ - mOwner.backend->MouseMove(theEvent); +- (void) mouseMoved: (NSEvent *) theEvent { + mOwner.backend->MouseMove(theEvent); } //-------------------------------------------------------------------------------------------------- -- (void) mouseEntered: (NSEvent *) theEvent -{ - mOwner.backend->MouseEntered(theEvent); +- (void) mouseEntered: (NSEvent *) theEvent { + mOwner.backend->MouseEntered(theEvent); } //-------------------------------------------------------------------------------------------------- -- (void) mouseExited: (NSEvent *) theEvent -{ - mOwner.backend->MouseExited(theEvent); +- (void) mouseExited: (NSEvent *) theEvent { + mOwner.backend->MouseExited(theEvent); } //-------------------------------------------------------------------------------------------------- /** - * Mouse wheel with command key magnifies text. - * Enabling this code causes visual garbage to appear when scrolling - * horizontally on OS X 10.9 with a retina display. - * Pinch gestures and key commands can be used for magnification. + * Implementing scrollWheel makes scrolling work better even if just + * calling super. + * Mouse wheel with command key may magnify text if enabled. + * Pinch gestures and key commands can also be used for magnification. */ +- (void) scrollWheel: (NSEvent *) theEvent { #ifdef SCROLL_WHEEL_MAGNIFICATION -- (void) scrollWheel: (NSEvent *) theEvent -{ - if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) { - mOwner.backend->MouseWheel(theEvent); - } else { - [super scrollWheel:theEvent]; - } -} + if (([theEvent modifierFlags] & NSEventModifierFlagCommand) != 0) { + mOwner.backend->MouseWheel(theEvent); + return; + } #endif + [super scrollWheel: theEvent]; +} //-------------------------------------------------------------------------------------------------- /** * Ensure scrolling is aligned to whole lines instead of starting part-way through a line */ -- (NSRect)adjustScroll:(NSRect)proposedVisibleRect -{ - NSRect rc = proposedVisibleRect; - // Snap to lines - NSRect contentRect = [self bounds]; - if ((rc.origin.y > 0) && (NSMaxY(rc) < contentRect.size.height)) { - // Only snap for positions inside the document - allow outside - // for overshoot. - long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); - rc.origin.y = roundf(static_cast(rc.origin.y) / lineHeight) * lineHeight; - } - return rc; +- (NSRect) adjustScroll: (NSRect) proposedVisibleRect { + if (!mOwner) + return proposedVisibleRect; + NSRect rc = proposedVisibleRect; + // Snap to lines + NSRect contentRect = self.bounds; + if ((rc.origin.y > 0) && (NSMaxY(rc) < contentRect.size.height)) { + // Only snap for positions inside the document - allow outside + // for overshoot. + long lineHeight = mOwner.backend->WndProc(SCI_TEXTHEIGHT, 0, 0); + rc.origin.y = roundf(static_cast(rc.origin.y) / lineHeight) * lineHeight; + } + // Snap to whole points - on retina displays this avoids visual debris + // when scrolling horizontally. + if ((rc.origin.x > 0) && (NSMaxX(rc) < contentRect.size.width)) { + // Only snap for positions inside the document - allow outside + // for overshoot. + rc.origin.x = roundf(static_cast(rc.origin.x)); + } + return rc; } //-------------------------------------------------------------------------------------------------- @@ -711,10 +761,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * The editor is getting the foreground control (the one getting the input focus). */ -- (BOOL) becomeFirstResponder -{ - mOwner.backend->WndProc(SCI_SETFOCUS, 1, 0); - return YES; +- (BOOL) becomeFirstResponder { + mOwner.backend->WndProc(SCI_SETFOCUS, 1, 0); + return YES; } //-------------------------------------------------------------------------------------------------- @@ -722,10 +771,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) /** * The editor is losing the input focus. */ -- (BOOL) resignFirstResponder -{ - mOwner.backend->WndProc(SCI_SETFOCUS, 0, 0); - return YES; +- (BOOL) resignFirstResponder { + mOwner.backend->WndProc(SCI_SETFOCUS, 0, 0); + return YES; } //-------------------------------------------------------------------------------------------------- @@ -734,33 +782,31 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) * Implement NSDraggingSource. */ -- (NSDragOperation)draggingSession: (NSDraggingSession *) session -sourceOperationMaskForDraggingContext: (NSDraggingContext) context -{ - switch(context) - { - case NSDraggingContextOutsideApplication: - return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; - - case NSDraggingContextWithinApplication: - default: - return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; - } +- (NSDragOperation) draggingSession: (NSDraggingSession *) session + sourceOperationMaskForDraggingContext: (NSDraggingContext) context { +#pragma unused(session) + switch (context) { + case NSDraggingContextOutsideApplication: + return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; + + case NSDraggingContextWithinApplication: + default: + return NSDragOperationCopy | NSDragOperationMove | NSDragOperationDelete; + } } -- (void)draggingSession:(NSDraggingSession *)session - movedToPoint:(NSPoint)screenPoint -{ +- (void) draggingSession: (NSDraggingSession *) session + movedToPoint: (NSPoint) screenPoint { +#pragma unused(session, screenPoint) } -- (void)draggingSession:(NSDraggingSession *)session - endedAtPoint:(NSPoint)screenPoint - operation:(NSDragOperation)operation -{ - if (operation == NSDragOperationDelete) - { - mOwner.backend->WndProc(SCI_CLEAR, 0, 0); - } +- (void) draggingSession: (NSDraggingSession *) session + endedAtPoint: (NSPoint) screenPoint + operation: (NSDragOperation) operation { +#pragma unused(session, screenPoint) + if (operation == NSDragOperationDelete) { + mOwner.backend->WndProc(SCI_CLEAR, 0, 0); + } } /** @@ -772,9 +818,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Called when an external drag operation enters the view. */ -- (NSDragOperation) draggingEntered: (id ) sender -{ - return mOwner.backend->DraggingEntered(sender); +- (NSDragOperation) draggingEntered: (id ) sender { + return mOwner.backend->DraggingEntered(sender); } //-------------------------------------------------------------------------------------------------- @@ -782,9 +827,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Called frequently during an external drag operation if we are the target. */ -- (NSDragOperation) draggingUpdated: (id ) sender -{ - return mOwner.backend->DraggingUpdated(sender); +- (NSDragOperation) draggingUpdated: (id ) sender { + return mOwner.backend->DraggingUpdated(sender); } //-------------------------------------------------------------------------------------------------- @@ -792,24 +836,21 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Drag image left the view. Clean up if necessary. */ -- (void) draggingExited: (id ) sender -{ - mOwner.backend->DraggingExited(sender); +- (void) draggingExited: (id ) sender { + mOwner.backend->DraggingExited(sender); } //-------------------------------------------------------------------------------------------------- -- (BOOL) prepareForDragOperation: (id ) sender -{ +- (BOOL) prepareForDragOperation: (id ) sender { #pragma unused(sender) - return YES; + return YES; } //-------------------------------------------------------------------------------------------------- -- (BOOL) performDragOperation: (id ) sender -{ - return mOwner.backend->PerformDragOperation(sender); +- (BOOL) performDragOperation: (id ) sender { + return mOwner.backend->PerformDragOperation(sender); } //-------------------------------------------------------------------------------------------------- @@ -817,121 +858,332 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Drag operation is done. Notify editor. */ -- (void) concludeDragOperation: (id ) sender -{ - // Clean up is the same as if we are no longer the drag target. - mOwner.backend->DraggingExited(sender); +- (void) concludeDragOperation: (id ) sender { + // Clean up is the same as if we are no longer the drag target. + mOwner.backend->DraggingExited(sender); } //-------------------------------------------------------------------------------------------------- // NSResponder actions. -- (void) selectAll: (id) sender -{ +- (void) selectAll: (id) sender { #pragma unused(sender) - mOwner.backend->SelectAll(); + mOwner.backend->SelectAll(); } -- (void) deleteBackward: (id) sender -{ +- (void) deleteBackward: (id) sender { #pragma unused(sender) - mOwner.backend->DeleteBackward(); + mOwner.backend->DeleteBackward(); } -- (void) cut: (id) sender -{ +- (void) cut: (id) sender { #pragma unused(sender) - mOwner.backend->Cut(); + mOwner.backend->Cut(); } -- (void) copy: (id) sender -{ +- (void) copy: (id) sender { #pragma unused(sender) - mOwner.backend->Copy(); + mOwner.backend->Copy(); } -- (void) paste: (id) sender -{ +- (void) paste: (id) sender { #pragma unused(sender) - if (mMarkedTextRange.location != NSNotFound) - { - [[NSTextInputContext currentInputContext] discardMarkedText]; - mOwner.backend->CompositionCommit(); - mMarkedTextRange = NSMakeRange(NSNotFound, 0); - } - mOwner.backend->Paste(); + if (mMarkedTextRange.location != NSNotFound) { + [[NSTextInputContext currentInputContext] discardMarkedText]; + mOwner.backend->CompositionCommit(); + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + } + mOwner.backend->Paste(); } -- (void) undo: (id) sender -{ +- (void) undo: (id) sender { #pragma unused(sender) - if (mMarkedTextRange.location != NSNotFound) - { - [[NSTextInputContext currentInputContext] discardMarkedText]; - mOwner.backend->CompositionCommit(); - mMarkedTextRange = NSMakeRange(NSNotFound, 0); - } - mOwner.backend->Undo(); + if (mMarkedTextRange.location != NSNotFound) { + [[NSTextInputContext currentInputContext] discardMarkedText]; + mOwner.backend->CompositionCommit(); + mMarkedTextRange = NSMakeRange(NSNotFound, 0); + } + mOwner.backend->Undo(); } -- (void) redo: (id) sender -{ +- (void) redo: (id) sender { #pragma unused(sender) - mOwner.backend->Redo(); + mOwner.backend->Redo(); } -- (BOOL) canUndo -{ - return mOwner.backend->CanUndo() && (mMarkedTextRange.location == NSNotFound); +- (BOOL) canUndo { + return mOwner.backend->CanUndo() && (mMarkedTextRange.location == NSNotFound); } -- (BOOL) canRedo -{ - return mOwner.backend->CanRedo(); +- (BOOL) canRedo { + return mOwner.backend->CanRedo(); } -- (BOOL) validateUserInterfaceItem: (id ) anItem -{ - SEL action = [anItem action]; - if (action==@selector(undo:)) { - return [self canUndo]; - } - else if (action==@selector(redo:)) { - return [self canRedo]; - } - else if (action==@selector(cut:) || action==@selector(copy:) || action==@selector(clear:)) { - return mOwner.backend->HasSelection(); - } - else if (action==@selector(paste:)) { - return mOwner.backend->CanPaste(); - } - return YES; +- (BOOL) validateUserInterfaceItem: (id ) anItem { + SEL action = anItem.action; + if (action==@selector(undo:)) { + return [self canUndo]; + } else if (action==@selector(redo:)) { + return [self canRedo]; + } else if (action==@selector(cut:) || action==@selector(copy:) || action==@selector(clear:)) { + return mOwner.backend->HasSelection(); + } else if (action==@selector(paste:)) { + return mOwner.backend->CanPaste(); + } + return YES; } -- (void) clear: (id) sender -{ - [self deleteBackward:sender]; +- (void) clear: (id) sender { + [self deleteBackward: sender]; } -- (BOOL) isEditable -{ - return mOwner.backend->WndProc(SCI_GETREADONLY, 0, 0) == 0; +- (BOOL) isEditable { + return mOwner.backend->WndProc(SCI_GETREADONLY, 0, 0) == 0; +} + +#pragma mark - NSAccessibility + +//-------------------------------------------------------------------------------------------------- + +// Adoption of NSAccessibility protocol. +// NSAccessibility wants to pass ranges in UTF-16 code units, not bytes (like Scintilla) +// or characters. +// Needs more testing with non-ASCII and non-BMP text. +// Needs to take account of folding and wraping. + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Text of the whole document as a string. + */ +- (id) accessibilityValue { + const sptr_t length = [mOwner message: SCI_GETLENGTH]; + return mOwner.backend->RangeTextAsString(NSMakeRange(0, length)); } //-------------------------------------------------------------------------------------------------- -- (void) dealloc -{ - [mCurrentCursor release]; - [super dealloc]; +/** + * NSAccessibility : Line of the caret. + */ +- (NSInteger) accessibilityInsertionPointLineNumber { + const Sci::Position caret = [mOwner message: SCI_GETCURRENTPOS]; + const NSRange rangeCharactersCaret = mOwner.backend->CharactersFromPositions(NSMakeRange(caret, 0)); + return mOwner.backend->VisibleLineForIndex(rangeCharactersCaret.location); } +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Not implemented and not called by VoiceOver. + */ +- (NSRange) accessibilityRangeForPosition: (NSPoint) point { + return NSMakeRange(0, 0); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Number of characters in the whole document. + */ +- (NSInteger) accessibilityNumberOfCharacters { + sptr_t length = [mOwner message: SCI_GETLENGTH]; + const NSRange posRange = mOwner.backend->CharactersFromPositions(NSMakeRange(length, 0)); + return posRange.location; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : The selection text as a string. + */ +- (NSString *) accessibilitySelectedText { + const sptr_t positionBegin = [mOwner message: SCI_GETSELECTIONSTART]; + const sptr_t positionEnd = [mOwner message: SCI_GETSELECTIONEND]; + const NSRange posRangeSel = NSMakeRange(positionBegin, positionEnd-positionBegin); + return mOwner.backend->RangeTextAsString(posRangeSel); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : The character range of the main selection. + */ +- (NSRange) accessibilitySelectedTextRange { + const sptr_t positionBegin = [mOwner message: SCI_GETSELECTIONSTART]; + const sptr_t positionEnd = [mOwner message: SCI_GETSELECTIONEND]; + const NSRange posRangeSel = NSMakeRange(positionBegin, positionEnd-positionBegin); + return mOwner.backend->CharactersFromPositions(posRangeSel); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : The setter for accessibilitySelectedTextRange. + * This method is the only setter required for reasonable VoiceOver behaviour. + */ +- (void) setAccessibilitySelectedTextRange: (NSRange) range { + NSRange rangePositions = mOwner.backend->PositionsFromCharacters(range); + [mOwner message: SCI_SETSELECTION wParam: rangePositions.location lParam: NSMaxRange(rangePositions)]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Range of the glyph at a character index. + * Currently doesn't try to handle composite characters. + */ +- (NSRange) accessibilityRangeForIndex: (NSInteger) index { + sptr_t length = [mOwner message: SCI_GETLENGTH]; + const NSRange rangeLength = mOwner.backend->CharactersFromPositions(NSMakeRange(length, 0)); + NSRange rangePositions = NSMakeRange(length, 0); + if (index < rangeLength.location) { + rangePositions = mOwner.backend->PositionsFromCharacters(NSMakeRange(index, 1)); + } + return mOwner.backend->CharactersFromPositions(rangePositions); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : All the text ranges. + * Currently only returns the main selection. + */ +- (NSArray *) accessibilitySelectedTextRanges { + const sptr_t positionBegin = [mOwner message: SCI_GETSELECTIONSTART]; + const sptr_t positionEnd = [mOwner message: SCI_GETSELECTIONEND]; + const NSRange posRangeSel = NSMakeRange(positionBegin, positionEnd-positionBegin); + NSRange rangeCharacters = mOwner.backend->CharactersFromPositions(posRangeSel); + NSValue *valueRange = [NSValue valueWithRange: (NSRange)rangeCharacters]; + return @[valueRange]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Character range currently visible. + */ +- (NSRange) accessibilityVisibleCharacterRange { + const sptr_t lineTopVisible = [mOwner message: SCI_GETFIRSTVISIBLELINE]; + const sptr_t lineTop = [mOwner message: SCI_DOCLINEFROMVISIBLE wParam: lineTopVisible]; + const sptr_t lineEndVisible = lineTopVisible + [mOwner message: SCI_LINESONSCREEN] - 1; + const sptr_t lineEnd = [mOwner message: SCI_DOCLINEFROMVISIBLE wParam: lineEndVisible]; + const sptr_t posStartView = [mOwner message: SCI_POSITIONFROMLINE wParam: lineTop]; + const sptr_t posEndView = [mOwner message: SCI_GETLINEENDPOSITION wParam: lineEnd]; + const NSRange posRangeSel = NSMakeRange(posStartView, posEndView-posStartView); + return mOwner.backend->CharactersFromPositions(posRangeSel); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Character range of a line. + */ +- (NSRange) accessibilityRangeForLine: (NSInteger) line { + return mOwner.backend->RangeForVisibleLine(line); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Line number of a text position in characters. + */ +- (NSInteger) accessibilityLineForIndex: (NSInteger) index { + return mOwner.backend->VisibleLineForIndex(index); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : A rectangle that covers a range which will be shown as the + * VoiceOver cursor. + * Producing a nice rectangle is a little tricky particularly when including new + * lines. Needs to improve the case where parts of two lines are included. + */ +- (NSRect) accessibilityFrameForRange: (NSRange) range { + const NSRect rectInView = mOwner.backend->FrameForRange(range); + const NSRect rectInWindow = [self.superview.superview convertRect: rectInView toView: nil]; + return [self.window convertRectToScreen: rectInWindow]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : A range of text as a string. + */ +- (NSString *) accessibilityStringForRange: (NSRange) range { + const NSRange posRange = mOwner.backend->PositionsFromCharacters(range); + return mOwner.backend->RangeTextAsString(posRange); +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : A range of text as an attributed string. + * Currently no attributes are set. + */ +- (NSAttributedString *) accessibilityAttributedStringForRange: (NSRange) range { + const NSRange posRange = mOwner.backend->PositionsFromCharacters(range); + NSString *result = mOwner.backend->RangeTextAsString(posRange); + return [[NSMutableAttributedString alloc] initWithString: result]; +} + +//-------------------------------------------------------------------------------------------------- + +/** + * NSAccessibility : Show the context menu at the caret. + */ +- (BOOL) accessibilityPerformShowMenu { + const sptr_t caret = [mOwner message: SCI_GETCURRENTPOS]; + NSRect rect; + rect.origin.x = [mOwner message: SCI_POINTXFROMPOSITION wParam: 0 lParam: caret]; + rect.origin.y = [mOwner message: SCI_POINTYFROMPOSITION wParam: 0 lParam: caret]; + rect.origin.y += [mOwner message: SCI_TEXTHEIGHT wParam: 0 lParam: 0]; + rect.size.width = 1.0; + rect.size.height = 1.0; + NSRect rectInWindow = [self.superview.superview convertRect: rect toView: nil]; + NSPoint pt = rectInWindow.origin; + NSEvent *event = [NSEvent mouseEventWithType: NSEventTypeRightMouseDown + location: pt + modifierFlags: 0 + timestamp: 0 + windowNumber: self.window.windowNumber + context: nil + eventNumber: 0 + clickCount: 1 + pressure: 0.0]; + NSMenu *menu = mOwner.backend->CreateContextMenu(event); + [NSMenu popUpContextMenu: menu withEvent: event forView: self]; + return YES; +} + +//-------------------------------------------------------------------------------------------------- + + @end //-------------------------------------------------------------------------------------------------- -@implementation ScintillaView +@implementation ScintillaView { + // The back end is kind of a controller and model in one. + // It uses the content view for display. + Scintilla::ScintillaCocoa *mBackend; + + // This is the actual content to which the backend renders itself. + SCIContentView *mContent; + + NSScrollView *scrollView; + SCIMarginView *marginView; + + CGFloat zoomDelta; + + // Area to display additional controls (e.g. zoom info, caret position, status info). + NSView *mInfoBar; + BOOL mInfoBarAtTop; + + id __unsafe_unretained mDelegate; +} @synthesize backend = mBackend; @synthesize delegate = mDelegate; @@ -948,20 +1200,18 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Initialize custom cursor. */ -+ (void) initialize -{ - if (self == [ScintillaView class]) - { - NSBundle* bundle = [NSBundle bundleForClass: [ScintillaView class]]; ++ (void) initialize { + if (self == [ScintillaView class]) { + NSBundle *bundle = [NSBundle bundleForClass: [ScintillaView class]]; - NSString* path = [bundle pathForResource: @"mac_cursor_busy" ofType: @"tiff" inDirectory: nil]; - NSImage* image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; - waitCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(2, 2)]; + NSString *path = [bundle pathForResource: @"mac_cursor_busy" ofType: @"tiff" inDirectory: nil]; + NSImage *image = [[NSImage alloc] initWithContentsOfFile: path]; + waitCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(2, 2)]; - path = [bundle pathForResource: @"mac_cursor_flipped" ofType: @"tiff" inDirectory: nil]; - image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; - reverseArrowCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(12, 2)]; - } + path = [bundle pathForResource: @"mac_cursor_flipped" ofType: @"tiff" inDirectory: nil]; + image = [[NSImage alloc] initWithContentsOfFile: path]; + reverseArrowCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(15, 2)]; + } } //-------------------------------------------------------------------------------------------------- @@ -970,9 +1220,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Specify the SCIContentView class. Can be overridden in a subclass to provide an SCIContentView subclass. */ -+ (Class) contentViewClass -{ - return [SCIContentView class]; ++ (Class) contentViewClass { + return [SCIContentView class]; } //-------------------------------------------------------------------------------------------------- @@ -980,24 +1229,22 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Receives zoom messages, for example when a "pinch zoom" is performed on the trackpad. */ -- (void) magnifyWithEvent: (NSEvent *) event -{ +- (void) magnifyWithEvent: (NSEvent *) event { #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 - zoomDelta += event.magnification * 10.0; + zoomDelta += event.magnification * 10.0; - if (fabs(zoomDelta)>=1.0) { - long zoomFactor = static_cast([self getGeneralProperty: SCI_GETZOOM] + zoomDelta); - [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value:0]; - zoomDelta = 0.0; - } + if (fabs(zoomDelta)>=1.0) { + long zoomFactor = static_cast([self getGeneralProperty: SCI_GETZOOM] + zoomDelta); + [self setGeneralProperty: SCI_SETZOOM parameter: zoomFactor value: 0]; + zoomDelta = 0.0; + } #endif } -- (void) beginGestureWithEvent: (NSEvent *) event -{ +- (void) beginGestureWithEvent: (NSEvent *) event { // Scintilla is only interested in this event as the starft of a zoom #pragma unused(event) - zoomDelta = 0.0; + zoomDelta = 0.0; } //-------------------------------------------------------------------------------------------------- @@ -1005,10 +1252,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Sends a new notification of the given type to the default notification center. */ -- (void) sendNotification: (NSString*) notificationName -{ - NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; - [center postNotificationName: notificationName object: self]; +- (void) sendNotification: (NSString *) notificationName { + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center postNotificationName: notificationName object: self]; } //-------------------------------------------------------------------------------------------------- @@ -1021,31 +1267,27 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * @param location Carries the new location (e.g. caret) if the type is a caret change or similar type. * @param value Carries the new zoom value if the type is a zoom change. */ -- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location - value: (float) value -{ +- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location + value: (float) value { // These parameters are just to conform to the protocol #pragma unused(message) #pragma unused(location) - switch (type) - { - case IBNZoomChanged: - { - // Compute point increase/decrease based on default font size. - long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; - int zoom = (int) (fontSize * (value - 1)); - [self setGeneralProperty: SCI_SETZOOM value: zoom]; - break; - } - default: - break; - }; + switch (type) { + case IBNZoomChanged: { + // Compute point increase/decrease based on default font size. + long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; + int zoom = (int)(fontSize * (value - 1)); + [self setGeneralProperty: SCI_SETZOOM value: zoom]; + break; + } + default: + break; + }; } //-------------------------------------------------------------------------------------------------- -- (void) setCallback: (id ) callback -{ +- (void) setCallback: (id ) callback { // Not used. Only here to satisfy protocol. #pragma unused(callback) } @@ -1056,12 +1298,11 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Prevents drawing of the inner view to avoid flickering when doing many visual updates * (like clearing all marks and setting new ones etc.). */ -- (void) suspendDrawing: (BOOL) suspend -{ - if (suspend) - [[self window] disableFlushWindow]; - else - [[self window] enableFlushWindow]; +- (void) suspendDrawing: (BOOL) suspend { + if (suspend) + [self.window disableFlushWindow]; + else + [self.window enableFlushWindow]; } //-------------------------------------------------------------------------------------------------- @@ -1072,65 +1313,70 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * A delegate can be set to receive all notifications. If set no handling takes place here, except * for action pertaining to internal stuff (like the info bar). */ -- (void) notification: (Scintilla::SCNotification*)scn -{ - // Parent notification. Details are passed as SCNotification structure. +- (void) notification: (SCNotification *) scn { + // Parent notification. Details are passed as SCNotification structure. - if (mDelegate != nil) - { - [mDelegate notification: scn]; - if (scn->nmhdr.code != SCN_ZOOM && scn->nmhdr.code != SCN_UPDATEUI) - return; - } + if (mDelegate != nil) { + [mDelegate notification: scn]; + if (scn->nmhdr.code != SCN_ZOOM && scn->nmhdr.code != SCN_UPDATEUI) + return; + } - switch (scn->nmhdr.code) - { - case SCN_MARGINCLICK: - { - if (scn->margin == 2) - { - // Click on the folder margin. Toggle the current line if possible. - long line = [self getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; - [self setGeneralProperty: SCI_TOGGLEFOLD value: line]; - } - break; - }; - case SCN_MODIFIED: - { - // Decide depending on the modification type what to do. - // There can be more than one modification carried by one notification. - if (scn->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) - [self sendNotification: NSTextDidChangeNotification]; - break; - } - case SCN_ZOOM: - { - // A zoom change happened. Notify info bar if there is one. - float zoom = [self getGeneralProperty: SCI_GETZOOM parameter: 0]; - long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; - float factor = (zoom / fontSize) + 1; - [mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor]; - break; - } - case SCN_UPDATEUI: - { - // Triggered whenever changes in the UI state need to be reflected. - // These can be: caret changes, selection changes etc. - NSPoint caretPosition = mBackend->GetCaretPosition(); - [mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0]; - [self sendNotification: SCIUpdateUINotification]; - if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) - { - [self sendNotification: NSTextViewDidChangeSelectionNotification]; - } - break; - } - case SCN_FOCUSOUT: - [self sendNotification: NSTextDidEndEditingNotification]; - break; - case SCN_FOCUSIN: // Nothing to do for now. - break; - } + switch (scn->nmhdr.code) { + case SCN_MARGINCLICK: { + if (scn->margin == 2) { + // Click on the folder margin. Toggle the current line if possible. + long line = [self getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position]; + [self setGeneralProperty: SCI_TOGGLEFOLD value: line]; + } + break; + }; + case SCN_MODIFIED: { + // Decide depending on the modification type what to do. + // There can be more than one modification carried by one notification. + if (scn->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) + [self sendNotification: NSTextDidChangeNotification]; + break; + } + case SCN_ZOOM: { + // A zoom change happened. Notify info bar if there is one. + float zoom = [self getGeneralProperty: SCI_GETZOOM parameter: 0]; + long fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT]; + float factor = (zoom / fontSize) + 1; + [mInfoBar notify: IBNZoomChanged message: nil location: NSZeroPoint value: factor]; + break; + } + case SCN_UPDATEUI: { + // Triggered whenever changes in the UI state need to be reflected. + // These can be: caret changes, selection changes etc. + NSPoint caretPosition = mBackend->GetCaretPosition(); + [mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0]; + [self sendNotification: SCIUpdateUINotification]; + if (scn->updated & (SC_UPDATE_SELECTION | SC_UPDATE_CONTENT)) { + [self sendNotification: NSTextViewDidChangeSelectionNotification]; + } + break; + } + case SCN_FOCUSOUT: + [self sendNotification: NSTextDidEndEditingNotification]; + break; + case SCN_FOCUSIN: // Nothing to do for now. + break; + } +} + +//-------------------------------------------------------------------------------------------------- + +/** + * Setup a special indicator used in the editor to provide visual feedback for + * input composition, depending on language, keyboard etc. + */ +- (void) updateIndicatorIME { + [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; + const bool drawInBackground = [self message: SCI_GETPHASESDRAW] != 0; + [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: drawInBackground]; + [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; + [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; } //-------------------------------------------------------------------------------------------------- @@ -1138,103 +1384,117 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Initialization of the view. Used to setup a few other things we need. */ -- (id) initWithFrame: (NSRect) frame -{ - self = [super initWithFrame:frame]; - if (self) - { - mContent = [[[[[self class] contentViewClass] alloc] initWithFrame:NSZeroRect] autorelease]; - mContent.owner = self; +- (instancetype) initWithFrame: (NSRect) frame { + self = [super initWithFrame: frame]; + if (self) { + mContent = [[[[self class] contentViewClass] alloc] initWithFrame: NSZeroRect]; + mContent.owner = self; - // Initialize the scrollers but don't show them yet. - // Pick an arbitrary size, just to make NSScroller selecting the proper scroller direction - // (horizontal or vertical). - NSRect scrollerRect = NSMakeRect(0, 0, 100, 10); - scrollView = [[[NSScrollView alloc] initWithFrame: scrollerRect] autorelease]; - [scrollView setDocumentView: mContent]; - [scrollView setHasVerticalScroller:YES]; - [scrollView setHasHorizontalScroller:YES]; - [scrollView setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; - //[scrollView setScrollerStyle:NSScrollerStyleLegacy]; - //[scrollView setScrollerKnobStyle:NSScrollerKnobStyleDark]; - //[scrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; - [self addSubview: scrollView]; + // Initialize the scrollers but don't show them yet. + // Pick an arbitrary size, just to make NSScroller selecting the proper scroller direction + // (horizontal or vertical). + NSRect scrollerRect = NSMakeRect(0, 0, 100, 10); + scrollView = (NSScrollView *)[[SCIScrollView alloc] initWithFrame: scrollerRect]; +#if defined(MAC_OS_X_VERSION_10_14) + // Let SCIScrollView account for other subviews such as vertical ruler by turning off + // automaticallyAdjustsContentInsets. + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) { + scrollView.contentView.automaticallyAdjustsContentInsets = NO; + scrollView.contentView.contentInsets = NSEdgeInsetsMake(0., 0., 0., 0.); + } +#endif + scrollView.documentView = mContent; + [scrollView setHasVerticalScroller: YES]; + [scrollView setHasHorizontalScroller: YES]; + scrollView.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable; + //[scrollView setScrollerStyle:NSScrollerStyleLegacy]; + //[scrollView setScrollerKnobStyle:NSScrollerKnobStyleDark]; + //[scrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; + [self addSubview: scrollView]; - marginView = [[SCIMarginView alloc] initWithScrollView:scrollView]; - marginView.owner = self; - [marginView setRuleThickness:[marginView requiredThickness]]; - [scrollView setVerticalRulerView:marginView]; - [scrollView setHasHorizontalRuler:NO]; - [scrollView setHasVerticalRuler:YES]; - [scrollView setRulersVisible:YES]; + marginView = [[SCIMarginView alloc] initWithScrollView: scrollView]; + marginView.owner = self; + marginView.ruleThickness = marginView.requiredThickness; + scrollView.verticalRulerView = marginView; + [scrollView setHasHorizontalRuler: NO]; + [scrollView setHasVerticalRuler: YES]; + [scrollView setRulersVisible: YES]; - mBackend = new ScintillaCocoa(mContent, marginView); + mBackend = new ScintillaCocoa(self, mContent, marginView); - // Establish a connection from the back end to this container so we can handle situations - // which require our attention. - mBackend->SetDelegate(self); + // Establish a connection from the back end to this container so we can handle situations + // which require our attention. + mBackend->SetDelegate(self); - // Setup a special indicator used in the editor to provide visual feedback for - // input composition, depending on language, keyboard etc. - [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; - [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: 1]; - [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; - [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; + [self updateIndicatorIME]; - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - [center addObserver:self - selector:@selector(applicationDidResignActive:) - name:NSApplicationDidResignActiveNotification - object:nil]; + NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + [center addObserver: self + selector: @selector(applicationDidResignActive:) + name: NSApplicationDidResignActiveNotification + object: nil]; - [center addObserver:self - selector:@selector(applicationDidBecomeActive:) - name:NSApplicationDidBecomeActiveNotification - object:nil]; + [center addObserver: self + selector: @selector(applicationDidBecomeActive:) + name: NSApplicationDidBecomeActiveNotification + object: nil]; - [[scrollView contentView] setPostsBoundsChangedNotifications:YES]; - [center addObserver:self - selector:@selector(scrollerAction:) - name:NSViewBoundsDidChangeNotification - object:[scrollView contentView]]; - } - return self; + [center addObserver: self + selector: @selector(windowWillMove:) + name: NSWindowWillMoveNotification + object: self.window]; + + [scrollView.contentView setPostsBoundsChangedNotifications: YES]; + [center addObserver: self + selector: @selector(scrollerAction:) + name: NSViewBoundsDidChangeNotification + object: scrollView.contentView]; + } + return self; } //-------------------------------------------------------------------------------------------------- -- (void) dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - delete mBackend; - [marginView release]; - [super dealloc]; +- (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver: self]; + mBackend->Finalise(); + delete mBackend; + mBackend = NULL; + mContent.owner = nil; + [marginView setClientView: nil]; + [scrollView removeFromSuperview]; } //-------------------------------------------------------------------------------------------------- -- (void) applicationDidResignActive: (NSNotification *)note { +- (void) applicationDidResignActive: (NSNotification *) note { #pragma unused(note) - mBackend->ActiveStateChanged(false); + mBackend->ActiveStateChanged(false); } //-------------------------------------------------------------------------------------------------- -- (void) applicationDidBecomeActive: (NSNotification *)note { +- (void) applicationDidBecomeActive: (NSNotification *) note { #pragma unused(note) - mBackend->ActiveStateChanged(true); + mBackend->ActiveStateChanged(true); } //-------------------------------------------------------------------------------------------------- -- (void) viewDidMoveToWindow -{ - [super viewDidMoveToWindow]; +- (void) windowWillMove: (NSNotification *) note { +#pragma unused(note) + mBackend->WindowWillMove(); +} - [self positionSubViews]; +//-------------------------------------------------------------------------------------------------- - // Enable also mouse move events for our window (and so this view). - [[self window] setAcceptsMouseMovedEvents: YES]; +- (void) viewDidMoveToWindow { + [super viewDidMoveToWindow]; + + [self positionSubViews]; + + // Enable also mouse move events for our window (and so this view). + [self.window setAcceptsMouseMovedEvents: YES]; } //-------------------------------------------------------------------------------------------------- @@ -1242,38 +1502,35 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Used to position and size the parts of the editor (content, scrollers, info bar). */ -- (void) positionSubViews -{ - CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize:NSRegularControlSize - scrollerStyle:NSScrollerStyleLegacy]; +- (void) positionSubViews { + CGFloat scrollerWidth = [NSScroller scrollerWidthForControlSize: NSControlSizeRegular + scrollerStyle: NSScrollerStyleLegacy]; - NSSize size = [self frame].size; - NSRect barFrame = {{0, size.height - scrollerWidth}, {size.width, scrollerWidth}}; - BOOL infoBarVisible = mInfoBar != nil && ![mInfoBar isHidden]; + NSSize size = self.frame.size; + NSRect barFrame = {{0, size.height - scrollerWidth}, {size.width, scrollerWidth}}; + BOOL infoBarVisible = mInfoBar != nil && !mInfoBar.hidden; - // Horizontal offset of the content. Almost always 0 unless the vertical scroller - // is on the left side. - CGFloat contentX = 0; - NSRect scrollRect = {{contentX, 0}, {size.width, size.height}}; + // Horizontal offset of the content. Almost always 0 unless the vertical scroller + // is on the left side. + CGFloat contentX = 0; + NSRect scrollRect = {{contentX, 0}, {size.width, size.height}}; - // Info bar frame. - if (infoBarVisible) - { - scrollRect.size.height -= scrollerWidth; - // Initial value already is as if the bar is at top. - if (!mInfoBarAtTop) - { - scrollRect.origin.y += scrollerWidth; - barFrame.origin.y = 0; - } - } + // Info bar frame. + if (infoBarVisible) { + scrollRect.size.height -= scrollerWidth; + // Initial value already is as if the bar is at top. + if (!mInfoBarAtTop) { + scrollRect.origin.y += scrollerWidth; + barFrame.origin.y = 0; + } + } - if (!NSEqualRects([scrollView frame], scrollRect)) { - [scrollView setFrame: scrollRect]; - } + if (!NSEqualRects(scrollView.frame, scrollRect)) { + scrollView.frame = scrollRect; + } - if (infoBarVisible) - [mInfoBar setFrame: barFrame]; + if (infoBarVisible) + mInfoBar.frame = barFrame; } //-------------------------------------------------------------------------------------------------- @@ -1281,13 +1538,11 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Set the width of the margin. */ -- (void) setMarginWidth: (int) width -{ - if (marginView.ruleThickness != width) - { - marginView.marginWidth = width; - [marginView setRuleThickness:[marginView requiredThickness]]; - } +- (void) setMarginWidth: (int) width { + if (marginView.ruleThickness != width) { + marginView.marginWidth = width; + marginView.ruleThickness = marginView.requiredThickness; + } } //-------------------------------------------------------------------------------------------------- @@ -1296,9 +1551,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Triggered by one of the scrollers when it gets manipulated by the user. Notify the backend * about the change. */ -- (void) scrollerAction: (id) sender -{ - mBackend->UpdateForScroll(); +- (void) scrollerAction: (id) sender { +#pragma unused(sender) + mBackend->UpdateForScroll(); } //-------------------------------------------------------------------------------------------------- @@ -1306,14 +1561,13 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Used to reposition our content depending on the size of the view. */ -- (void) setFrame: (NSRect) newFrame -{ - NSRect previousFrame = [self frame]; - [super setFrame: newFrame]; - [self positionSubViews]; - if (!NSEqualRects(previousFrame, newFrame)) { - mBackend->Resize(); - } +- (void) setFrame: (NSRect) newFrame { + NSRect previousFrame = self.frame; + super.frame = newFrame; + [self positionSubViews]; + if (!NSEqualRects(previousFrame, newFrame)) { + mBackend->Resize(); + } } //-------------------------------------------------------------------------------------------------- @@ -1322,26 +1576,21 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Getter for the currently selected text in raw form (no formatting information included). * If there is no text available an empty string is returned. */ -- (NSString*) selectedString -{ - NSString *result = @""; +- (NSString *) selectedString { + NSString *result = @""; - const long length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0); - if (length > 0) - { - std::string buffer(length + 1, '\0'); - try - { - mBackend->WndProc(SCI_GETSELTEXT, length + 1, (sptr_t) &buffer[0]); + const long length = mBackend->WndProc(SCI_GETSELTEXT, 0, 0); + if (length > 0) { + std::string buffer(length + 1, '\0'); + try { + mBackend->WndProc(SCI_GETSELTEXT, length + 1, (sptr_t) &buffer[0]); - result = [NSString stringWithUTF8String: buffer.c_str()]; - } - catch (...) - { - } - } + result = @(buffer.c_str()); + } catch (...) { + } + } - return result; + return result; } //-------------------------------------------------------------------------------------------------- @@ -1349,13 +1598,11 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Delete a range from the document. */ -- (void) deleteRange: (NSRange) aRange -{ - if (aRange.length > 0) - { - NSRange posRange = mBackend->PositionsFromCharacters(aRange); - [self message: SCI_DELETERANGE wParam: posRange.location lParam: posRange.length]; - } +- (void) deleteRange: (NSRange) aRange { + if (aRange.length > 0) { + NSRange posRange = mBackend->PositionsFromCharacters(aRange); + [self message: SCI_DELETERANGE wParam: posRange.location lParam: posRange.length]; + } } //-------------------------------------------------------------------------------------------------- @@ -1364,26 +1611,21 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Getter for the current text in raw form (no formatting information included). * If there is no text available an empty string is returned. */ -- (NSString*) string -{ - NSString *result = @""; +- (NSString *) string { + NSString *result = @""; - const long length = mBackend->WndProc(SCI_GETLENGTH, 0, 0); - if (length > 0) - { - std::string buffer(length + 1, '\0'); - try - { - mBackend->WndProc(SCI_GETTEXT, length + 1, (sptr_t) &buffer[0]); + const long length = mBackend->WndProc(SCI_GETLENGTH, 0, 0); + if (length > 0) { + std::string buffer(length + 1, '\0'); + try { + mBackend->WndProc(SCI_GETTEXT, length + 1, (sptr_t) &buffer[0]); - result = [NSString stringWithUTF8String: buffer.c_str()]; - } - catch (...) - { - } - } + result = @(buffer.c_str()); + } catch (...) { + } + } - return result; + return result; } //-------------------------------------------------------------------------------------------------- @@ -1391,45 +1633,40 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Setter for the current text (no formatting included). */ -- (void) setString: (NSString*) aString -{ - const char* text = [aString UTF8String]; - mBackend->WndProc(SCI_SETTEXT, 0, (long) text); +- (void) setString: (NSString *) aString { + const char *text = aString.UTF8String; + mBackend->WndProc(SCI_SETTEXT, 0, (long) text); } //-------------------------------------------------------------------------------------------------- -- (void) insertString: (NSString*) aString atOffset: (int)offset -{ - const char* text = [aString UTF8String]; - mBackend->WndProc(SCI_ADDTEXT, offset, (long) text); +- (void) insertString: (NSString *) aString atOffset: (int) offset { + const char *text = aString.UTF8String; + mBackend->WndProc(SCI_ADDTEXT, offset, (long) text); } //-------------------------------------------------------------------------------------------------- -- (void) setEditable: (BOOL) editable -{ - mBackend->WndProc(SCI_SETREADONLY, editable ? 0 : 1, 0); +- (void) setEditable: (BOOL) editable { + mBackend->WndProc(SCI_SETREADONLY, editable ? 0 : 1, 0); } //-------------------------------------------------------------------------------------------------- -- (BOOL) isEditable -{ - return mBackend->WndProc(SCI_GETREADONLY, 0, 0) == 0; +- (BOOL) isEditable { + return mBackend->WndProc(SCI_GETREADONLY, 0, 0) == 0; } //-------------------------------------------------------------------------------------------------- -- (SCIContentView*) content -{ - return mContent; +- (SCIContentView *) content { + return mContent; } //-------------------------------------------------------------------------------------------------- - (void) updateMarginCursors { - [[self window] invalidateCursorRectsForView: marginView]; + [self.window invalidateCursorRectsForView: marginView]; } //-------------------------------------------------------------------------------------------------- @@ -1439,26 +1676,22 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * the result heavily depend on the message that is used for the call. Refer to the Scintilla * documentation to learn what can be used here. */ -+ (sptr_t) directCall: (ScintillaView*) sender message: (unsigned int) message wParam: (uptr_t) wParam - lParam: (sptr_t) lParam -{ - return ScintillaCocoa::DirectFunction( - reinterpret_cast(sender->mBackend), message, wParam, lParam); ++ (sptr_t) directCall: (ScintillaView *) sender message: (unsigned int) message wParam: (uptr_t) wParam + lParam: (sptr_t) lParam { + return ScintillaCocoa::DirectFunction( + reinterpret_cast(sender->mBackend), message, wParam, lParam); } -- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam -{ - return mBackend->WndProc(message, wParam, lParam); +- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam { + return mBackend->WndProc(message, wParam, lParam); } -- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam -{ - return mBackend->WndProc(message, wParam, 0); +- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam { + return mBackend->WndProc(message, wParam, 0); } -- (sptr_t) message: (unsigned int) message -{ - return mBackend->WndProc(message, 0, 0); +- (sptr_t) message: (unsigned int) message { + return mBackend->WndProc(message, 0, 0); } //-------------------------------------------------------------------------------------------------- @@ -1470,9 +1703,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * @param parameter Additional info for this property like a parameter or index. * @param value The actual value. It depends on the property what this parameter means. */ -- (void) setGeneralProperty: (int) property parameter: (long) parameter value: (long) value -{ - mBackend->WndProc(property, parameter, value); +- (void) setGeneralProperty: (int) property parameter: (long) parameter value: (long) value { + mBackend->WndProc(property, parameter, value); } //-------------------------------------------------------------------------------------------------- @@ -1483,9 +1715,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * @param property Main property like SCI_STYLESETFORE for which a value is to be set. * @param value The actual value. It depends on the property what this parameter means. */ -- (void) setGeneralProperty: (int) property value: (long) value -{ - mBackend->WndProc(property, value, 0); +- (void) setGeneralProperty: (int) property value: (long) value { + mBackend->WndProc(property, value, 0); } //-------------------------------------------------------------------------------------------------- @@ -1498,9 +1729,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * @param extra Yet another parameter if needed. * @result A generic value which must be interpreted depending on the property queried. */ -- (long) getGeneralProperty: (int) property parameter: (long) parameter extra: (long) extra -{ - return mBackend->WndProc(property, parameter, extra); +- (long) getGeneralProperty: (int) property parameter: (long) parameter extra: (long) extra { + return mBackend->WndProc(property, parameter, extra); } //-------------------------------------------------------------------------------------------------- @@ -1508,9 +1738,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Convenience function to avoid unneeded extra parameter. */ -- (long) getGeneralProperty: (int) property parameter: (long) parameter -{ - return mBackend->WndProc(property, parameter, 0); +- (long) getGeneralProperty: (int) property parameter: (long) parameter { + return mBackend->WndProc(property, parameter, 0); } //-------------------------------------------------------------------------------------------------- @@ -1518,9 +1747,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Convenience function to avoid unneeded parameters. */ -- (long) getGeneralProperty: (int) property -{ - return mBackend->WndProc(property, 0, 0); +- (long) getGeneralProperty: (int) property { + return mBackend->WndProc(property, 0, 0); } //-------------------------------------------------------------------------------------------------- @@ -1528,9 +1756,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Use this variant if you have to pass in a reference to something (e.g. a text range). */ -- (long) getGeneralProperty: (int) property ref: (const void*) ref -{ - return mBackend->WndProc(property, 0, (sptr_t) ref); +- (long) getGeneralProperty: (int) property ref: (const void *) ref { + return mBackend->WndProc(property, 0, (sptr_t) ref); } //-------------------------------------------------------------------------------------------------- @@ -1538,16 +1765,15 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property setter for colors. */ -- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor*) value -{ - if ([value colorSpaceName] != NSDeviceRGBColorSpace) - value = [value colorUsingColorSpaceName: NSDeviceRGBColorSpace]; - long red = static_cast([value redComponent] * 255); - long green = static_cast([value greenComponent] * 255); - long blue = static_cast([value blueComponent] * 255); +- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor *) value { + if (value.colorSpaceName != NSDeviceRGBColorSpace) + value = [value colorUsingColorSpaceName: NSDeviceRGBColorSpace]; + long red = static_cast(value.redComponent * 255); + long green = static_cast(value.greenComponent * 255); + long blue = static_cast(value.blueComponent * 255); - long color = (blue << 16) + (green << 8) + red; - mBackend->WndProc(property, parameter, color); + long color = (blue << 16) + (green << 8) + red; + mBackend->WndProc(property, parameter, color); } //-------------------------------------------------------------------------------------------------- @@ -1556,44 +1782,42 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Another color property setting, which allows to specify the color as string like in HTML * documents (i.e. with leading # and either 3 hex digits or 6). */ -- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString*) fromHTML -{ - if ([fromHTML length] > 3 && [fromHTML characterAtIndex: 0] == '#') - { - bool longVersion = [fromHTML length] > 6; - int index = 1; +- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString *) fromHTML { + if (fromHTML.length > 3 && [fromHTML characterAtIndex: 0] == '#') { + bool longVersion = fromHTML.length > 6; + int index = 1; - char value[3] = {0, 0, 0}; - value[0] = static_cast([fromHTML characterAtIndex: index++]); - if (longVersion) - value[1] = static_cast([fromHTML characterAtIndex: index++]); - else - value[1] = value[0]; + char value[3] = {0, 0, 0}; + value[0] = static_cast([fromHTML characterAtIndex: index++]); + if (longVersion) + value[1] = static_cast([fromHTML characterAtIndex: index++]); + else + value[1] = value[0]; - unsigned rawRed; - [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawRed]; + unsigned rawRed; + [[NSScanner scannerWithString: @(value)] scanHexInt: &rawRed]; - value[0] = static_cast([fromHTML characterAtIndex: index++]); - if (longVersion) - value[1] = static_cast([fromHTML characterAtIndex: index++]); - else - value[1] = value[0]; + value[0] = static_cast([fromHTML characterAtIndex: index++]); + if (longVersion) + value[1] = static_cast([fromHTML characterAtIndex: index++]); + else + value[1] = value[0]; - unsigned rawGreen; - [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawGreen]; + unsigned rawGreen; + [[NSScanner scannerWithString: @(value)] scanHexInt: &rawGreen]; - value[0] = static_cast([fromHTML characterAtIndex: index++]); - if (longVersion) - value[1] = static_cast([fromHTML characterAtIndex: index++]); - else - value[1] = value[0]; + value[0] = static_cast([fromHTML characterAtIndex: index++]); + if (longVersion) + value[1] = static_cast([fromHTML characterAtIndex: index++]); + else + value[1] = value[0]; - unsigned rawBlue; - [[NSScanner scannerWithString: [NSString stringWithUTF8String: value]] scanHexInt: &rawBlue]; + unsigned rawBlue; + [[NSScanner scannerWithString: @(value)] scanHexInt: &rawBlue]; - long color = (rawBlue << 16) + (rawGreen << 8) + rawRed; - mBackend->WndProc(property, parameter, color); - } + long color = (rawBlue << 16) + (rawGreen << 8) + rawRed; + mBackend->WndProc(property, parameter, color); + } } //-------------------------------------------------------------------------------------------------- @@ -1601,14 +1825,13 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property getter for colors. */ -- (NSColor*) getColorProperty: (int) property parameter: (long) parameter -{ - long color = mBackend->WndProc(property, parameter, 0); - CGFloat red = (color & 0xFF) / 255.0; - CGFloat green = ((color >> 8) & 0xFF) / 255.0; - CGFloat blue = ((color >> 16) & 0xFF) / 255.0; - NSColor* result = [NSColor colorWithDeviceRed: red green: green blue: blue alpha: 1]; - return result; +- (NSColor *) getColorProperty: (int) property parameter: (long) parameter { + long color = mBackend->WndProc(property, parameter, 0); + CGFloat red = (color & 0xFF) / 255.0; + CGFloat green = ((color >> 8) & 0xFF) / 255.0; + CGFloat blue = ((color >> 16) & 0xFF) / 255.0; + NSColor *result = [NSColor colorWithDeviceRed: red green: green blue: blue alpha: 1]; + return result; } //-------------------------------------------------------------------------------------------------- @@ -1616,9 +1839,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property setter for references (pointers, addresses). */ -- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void*) value -{ - mBackend->WndProc(property, parameter, (sptr_t) value); +- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void *) value { + mBackend->WndProc(property, parameter, (sptr_t) value); } //-------------------------------------------------------------------------------------------------- @@ -1626,9 +1848,8 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property getter for references (pointers, addresses). */ -- (const void*) getReferenceProperty: (int) property parameter: (long) parameter -{ - return (const void*) mBackend->WndProc(property, parameter, 0); +- (const void *) getReferenceProperty: (int) property parameter: (long) parameter { + return (const void *) mBackend->WndProc(property, parameter, 0); } //-------------------------------------------------------------------------------------------------- @@ -1636,10 +1857,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property setter for string values. */ -- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString*) value -{ - const char* rawValue = [value UTF8String]; - mBackend->WndProc(property, parameter, (sptr_t) rawValue); +- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString *) value { + const char *rawValue = value.UTF8String; + mBackend->WndProc(property, parameter, (sptr_t) rawValue); } @@ -1648,10 +1868,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property getter for string values. */ -- (NSString*) getStringProperty: (int) property parameter: (long) parameter -{ - const char* rawValue = (const char*) mBackend->WndProc(property, parameter, 0); - return [NSString stringWithUTF8String: rawValue]; +- (NSString *) getStringProperty: (int) property parameter: (long) parameter { + const char *rawValue = (const char *) mBackend->WndProc(property, parameter, 0); + return @(rawValue); } //-------------------------------------------------------------------------------------------------- @@ -1659,11 +1878,10 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property setter for lexer properties, which are commonly passed as strings. */ -- (void) setLexerProperty: (NSString*) name value: (NSString*) value -{ - const char* rawName = [name UTF8String]; - const char* rawValue = [value UTF8String]; - mBackend->WndProc(SCI_SETPROPERTY, (sptr_t) rawName, (sptr_t) rawValue); +- (void) setLexerProperty: (NSString *) name value: (NSString *) value { + const char *rawName = name.UTF8String; + const char *rawValue = value.UTF8String; + mBackend->WndProc(SCI_SETPROPERTY, (sptr_t) rawName, (sptr_t) rawValue); } //-------------------------------------------------------------------------------------------------- @@ -1671,11 +1889,10 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Specialized property getter for references (pointers, addresses). */ -- (NSString*) getLexerProperty: (NSString*) name -{ - const char* rawName = [name UTF8String]; - const char* result = (const char*) mBackend->WndProc(SCI_SETPROPERTY, (sptr_t) rawName, 0); - return [NSString stringWithUTF8String: result]; +- (NSString *) getLexerProperty: (NSString *) name { + const char *rawName = name.UTF8String; + const char *result = (const char *) mBackend->WndProc(SCI_SETPROPERTY, (sptr_t) rawName, 0); + return @(result); } //-------------------------------------------------------------------------------------------------- @@ -1683,8 +1900,7 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Sets the notification callback */ -- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback -{ +- (void) registerNotifyCallback: (intptr_t) windowid value: (SciNotifyFunc) callback { mBackend->RegisterNotifyCallback(windowid, callback); } @@ -1696,22 +1912,19 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * Set newBar to nil if you want to hide the bar again. * The info bar's height is set to the height of the scrollbar. */ -- (void) setInfoBar: (NSView *) newBar top: (BOOL) top -{ - if (mInfoBar != newBar) - { - [mInfoBar removeFromSuperview]; +- (void) setInfoBar: (NSView *) newBar top: (BOOL) top { + if (mInfoBar != newBar) { + [mInfoBar removeFromSuperview]; - mInfoBar = newBar; - mInfoBarAtTop = top; - if (mInfoBar != nil) - { - [self addSubview: mInfoBar]; - [mInfoBar setCallback: self]; - } + mInfoBar = newBar; + mInfoBarAtTop = top; + if (mInfoBar != nil) { + [self addSubview: mInfoBar]; + [mInfoBar setCallback: self]; + } - [self positionSubViews]; - } + [self positionSubViews]; + } } //-------------------------------------------------------------------------------------------------- @@ -1719,27 +1932,38 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * Sets the edit's info bar status message. This call only has an effect if there is an info bar. */ -- (void) setStatusText: (NSString*) text -{ - if (mInfoBar != nil) - [mInfoBar notify: IBNStatusChanged message: text location: NSZeroPoint value: 0]; +- (void) setStatusText: (NSString *) text { + if (mInfoBar != nil) + [mInfoBar notify: IBNStatusChanged message: text location: NSZeroPoint value: 0]; } //-------------------------------------------------------------------------------------------------- -- (NSRange) selectedRange -{ - return [mContent selectedRange]; +- (NSRange) selectedRange { + return [mContent selectedRange]; } //-------------------------------------------------------------------------------------------------- -- (void)insertText: (id) aString -{ - if ([aString isKindOfClass:[NSString class]]) - mBackend->InsertText(aString); - else if ([aString isKindOfClass:[NSAttributedString class]]) - mBackend->InsertText([aString string]); +/** + * Return the main selection as an NSRange of positions (not characters). + * Unlike selectedRange, this can return empty ranges inside the document. + */ + +- (NSRange) selectedRangePositions { + const sptr_t positionBegin = [self message: SCI_GETSELECTIONSTART]; + const sptr_t positionEnd = [self message: SCI_GETSELECTIONEND]; + return NSMakeRange(positionBegin, positionEnd-positionBegin); +} + + +//-------------------------------------------------------------------------------------------------- + +- (void) insertText: (id) aString { + if ([aString isKindOfClass: [NSString class]]) + mBackend->InsertText(aString); + else if ([aString isKindOfClass: [NSAttributedString class]]) + mBackend->InsertText([aString string]); } //-------------------------------------------------------------------------------------------------- @@ -1747,18 +1971,17 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context /** * For backwards compatibility. */ -- (BOOL) findAndHighlightText: (NSString*) searchText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - scrollTo: (BOOL) scrollTo - wrap: (BOOL) wrap -{ - return [self findAndHighlightText: searchText - matchCase: matchCase - wholeWord: wholeWord - scrollTo: scrollTo - wrap: wrap - backwards: NO]; +- (BOOL) findAndHighlightText: (NSString *) searchText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + scrollTo: (BOOL) scrollTo + wrap: (BOOL) wrap { + return [self findAndHighlightText: searchText + matchCase: matchCase + wholeWord: wholeWord + scrollTo: scrollTo + wrap: wrap + backwards: NO]; } //-------------------------------------------------------------------------------------------------- @@ -1768,82 +1991,73 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * * @result YES if something was found, NO otherwise. */ -- (BOOL) findAndHighlightText: (NSString*) searchText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - scrollTo: (BOOL) scrollTo - wrap: (BOOL) wrap - backwards: (BOOL) backwards -{ - int searchFlags= 0; - if (matchCase) - searchFlags |= SCFIND_MATCHCASE; - if (wholeWord) - searchFlags |= SCFIND_WHOLEWORD; +- (BOOL) findAndHighlightText: (NSString *) searchText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + scrollTo: (BOOL) scrollTo + wrap: (BOOL) wrap + backwards: (BOOL) backwards { + int searchFlags= 0; + if (matchCase) + searchFlags |= SCFIND_MATCHCASE; + if (wholeWord) + searchFlags |= SCFIND_WHOLEWORD; - long selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; - long selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; + long selectionStart = [self getGeneralProperty: SCI_GETSELECTIONSTART parameter: 0]; + long selectionEnd = [self getGeneralProperty: SCI_GETSELECTIONEND parameter: 0]; - // Sets the start point for the coming search to the beginning of the current selection. - // For forward searches we have therefore to set the selection start to the current selection end - // for proper incremental search. This does not harm as we either get a new selection if something - // is found or the previous selection is restored. - if (!backwards) - [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: selectionEnd]; - [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; - sptr_t result; - const char* textToSearch = [searchText UTF8String]; + // Sets the start point for the coming search to the beginning of the current selection. + // For forward searches we have therefore to set the selection start to the current selection end + // for proper incremental search. This does not harm as we either get a new selection if something + // is found or the previous selection is restored. + if (!backwards) + [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: selectionEnd]; + [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; + sptr_t result; + const char *textToSearch = searchText.UTF8String; - // The following call will also set the selection if something was found. - if (backwards) - { - result = [ScintillaView directCall: self - message: SCI_SEARCHPREV - wParam: searchFlags - lParam: (sptr_t) textToSearch]; - if (result < 0 && wrap) - { - // Try again from the end of the document if nothing could be found so far and - // wrapped search is set. - [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0]]; - [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; - result = [ScintillaView directCall: self - message: SCI_SEARCHNEXT - wParam: searchFlags - lParam: (sptr_t) textToSearch]; - } - } - else - { - result = [ScintillaView directCall: self - message: SCI_SEARCHNEXT - wParam: searchFlags - lParam: (sptr_t) textToSearch]; - if (result < 0 && wrap) - { - // Try again from the start of the document if nothing could be found so far and - // wrapped search is set. - [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: 0]; - [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; - result = [ScintillaView directCall: self - message: SCI_SEARCHNEXT - wParam: searchFlags - lParam: (sptr_t) textToSearch]; - } - } + // The following call will also set the selection if something was found. + if (backwards) { + result = [ScintillaView directCall: self + message: SCI_SEARCHPREV + wParam: searchFlags + lParam: (sptr_t) textToSearch]; + if (result < 0 && wrap) { + // Try again from the end of the document if nothing could be found so far and + // wrapped search is set. + [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: [self getGeneralProperty: SCI_GETTEXTLENGTH parameter: 0]]; + [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; + result = [ScintillaView directCall: self + message: SCI_SEARCHNEXT + wParam: searchFlags + lParam: (sptr_t) textToSearch]; + } + } else { + result = [ScintillaView directCall: self + message: SCI_SEARCHNEXT + wParam: searchFlags + lParam: (sptr_t) textToSearch]; + if (result < 0 && wrap) { + // Try again from the start of the document if nothing could be found so far and + // wrapped search is set. + [self getGeneralProperty: SCI_SETSELECTIONSTART parameter: 0]; + [self setGeneralProperty: SCI_SEARCHANCHOR value: 0]; + result = [ScintillaView directCall: self + message: SCI_SEARCHNEXT + wParam: searchFlags + lParam: (sptr_t) textToSearch]; + } + } - if (result >= 0) - { - if (scrollTo) - [self setGeneralProperty: SCI_SCROLLCARET value: 0]; - } - else - { - // Restore the former selection if we did not find anything. - [self setGeneralProperty: SCI_SETSELECTIONSTART value: selectionStart]; - [self setGeneralProperty: SCI_SETSELECTIONEND value: selectionEnd]; - } - return (result >= 0) ? YES : NO; + if (result >= 0) { + if (scrollTo) + [self setGeneralProperty: SCI_SCROLLCARET value: 0]; + } else { + // Restore the former selection if we did not find anything. + [self setGeneralProperty: SCI_SETSELECTIONSTART value: selectionStart]; + [self setGeneralProperty: SCI_SETSELECTIONEND value: selectionEnd]; + } + return (result >= 0) ? YES : NO; } //-------------------------------------------------------------------------------------------------- @@ -1853,108 +2067,100 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context * * @result Number of entries replaced, 0 if none. */ -- (int) findAndReplaceText: (NSString*) searchText - byText: (NSString*) newText - matchCase: (BOOL) matchCase - wholeWord: (BOOL) wholeWord - doAll: (BOOL) doAll -{ - // The current position is where we start searching for single occurrences. Otherwise we start at - // the beginning of the document. - long startPosition; - if (doAll) - startPosition = 0; // Start at the beginning of the text if we replace all occurrences. - else - // For a single replacement we start at the current caret position. - startPosition = [self getGeneralProperty: SCI_GETCURRENTPOS]; - long endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH]; +- (int) findAndReplaceText: (NSString *) searchText + byText: (NSString *) newText + matchCase: (BOOL) matchCase + wholeWord: (BOOL) wholeWord + doAll: (BOOL) doAll { + // The current position is where we start searching for single occurrences. Otherwise we start at + // the beginning of the document. + long startPosition; + if (doAll) + startPosition = 0; // Start at the beginning of the text if we replace all occurrences. + else + // For a single replacement we start at the current caret position. + startPosition = [self getGeneralProperty: SCI_GETCURRENTPOS]; + long endPosition = [self getGeneralProperty: SCI_GETTEXTLENGTH]; - int searchFlags= 0; - if (matchCase) - searchFlags |= SCFIND_MATCHCASE; - if (wholeWord) - searchFlags |= SCFIND_WHOLEWORD; - [self setGeneralProperty: SCI_SETSEARCHFLAGS value: searchFlags]; - [self setGeneralProperty: SCI_SETTARGETSTART value: startPosition]; - [self setGeneralProperty: SCI_SETTARGETEND value: endPosition]; + int searchFlags= 0; + if (matchCase) + searchFlags |= SCFIND_MATCHCASE; + if (wholeWord) + searchFlags |= SCFIND_WHOLEWORD; + [self setGeneralProperty: SCI_SETSEARCHFLAGS value: searchFlags]; + [self setGeneralProperty: SCI_SETTARGETSTART value: startPosition]; + [self setGeneralProperty: SCI_SETTARGETEND value: endPosition]; - const char* textToSearch = [searchText UTF8String]; - long sourceLength = strlen(textToSearch); // Length in bytes. - const char* replacement = [newText UTF8String]; - long targetLength = strlen(replacement); // Length in bytes. - sptr_t result; + const char *textToSearch = searchText.UTF8String; + long sourceLength = strlen(textToSearch); // Length in bytes. + const char *replacement = newText.UTF8String; + long targetLength = strlen(replacement); // Length in bytes. + sptr_t result; - int replaceCount = 0; - if (doAll) - { - while (true) - { - result = [ScintillaView directCall: self - message: SCI_SEARCHINTARGET - wParam: sourceLength - lParam: (sptr_t) textToSearch]; - if (result < 0) - break; + int replaceCount = 0; + if (doAll) { + while (true) { + result = [ScintillaView directCall: self + message: SCI_SEARCHINTARGET + wParam: sourceLength + lParam: (sptr_t) textToSearch]; + if (result < 0) + break; - replaceCount++; - [ScintillaView directCall: self - message: SCI_REPLACETARGET - wParam: targetLength - lParam: (sptr_t) replacement]; + replaceCount++; + [ScintillaView directCall: self + message: SCI_REPLACETARGET + wParam: targetLength + lParam: (sptr_t) replacement]; - // The replacement changes the target range to the replaced text. Continue after that till the end. - // The text length might be changed by the replacement so make sure the target end is the actual - // text end. - [self setGeneralProperty: SCI_SETTARGETSTART value: [self getGeneralProperty: SCI_GETTARGETEND]]; - [self setGeneralProperty: SCI_SETTARGETEND value: [self getGeneralProperty: SCI_GETTEXTLENGTH]]; - } - } - else - { - result = [ScintillaView directCall: self - message: SCI_SEARCHINTARGET - wParam: sourceLength - lParam: (sptr_t) textToSearch]; - replaceCount = (result < 0) ? 0 : 1; + // The replacement changes the target range to the replaced text. Continue after that till the end. + // The text length might be changed by the replacement so make sure the target end is the actual + // text end. + [self setGeneralProperty: SCI_SETTARGETSTART value: [self getGeneralProperty: SCI_GETTARGETEND]]; + [self setGeneralProperty: SCI_SETTARGETEND value: [self getGeneralProperty: SCI_GETTEXTLENGTH]]; + } + } else { + result = [ScintillaView directCall: self + message: SCI_SEARCHINTARGET + wParam: sourceLength + lParam: (sptr_t) textToSearch]; + replaceCount = (result < 0) ? 0 : 1; - if (replaceCount > 0) - { - [ScintillaView directCall: self - message: SCI_REPLACETARGET - wParam: targetLength - lParam: (sptr_t) replacement]; + if (replaceCount > 0) { + [ScintillaView directCall: self + message: SCI_REPLACETARGET + wParam: targetLength + lParam: (sptr_t) replacement]; - // For a single replace we set the new selection to the replaced text. - [self setGeneralProperty: SCI_SETSELECTIONSTART value: [self getGeneralProperty: SCI_GETTARGETSTART]]; - [self setGeneralProperty: SCI_SETSELECTIONEND value: [self getGeneralProperty: SCI_GETTARGETEND]]; - } - } + // For a single replace we set the new selection to the replaced text. + [self setGeneralProperty: SCI_SETSELECTIONSTART value: [self getGeneralProperty: SCI_GETTARGETSTART]]; + [self setGeneralProperty: SCI_SETSELECTIONEND value: [self getGeneralProperty: SCI_GETTARGETEND]]; + } + } - return replaceCount; + return replaceCount; } //-------------------------------------------------------------------------------------------------- -- (void) setFontName: (NSString*) font - size: (int) size - bold: (BOOL) bold - italic: (BOOL) italic -{ - for (int i = 0; i < 128; i++) - { - [self setGeneralProperty: SCI_STYLESETFONT - parameter: i - value: (sptr_t)[font UTF8String]]; - [self setGeneralProperty: SCI_STYLESETSIZE - parameter: i - value: size]; - [self setGeneralProperty: SCI_STYLESETBOLD - parameter: i - value: bold]; - [self setGeneralProperty: SCI_STYLESETITALIC - parameter: i - value: italic]; - } +- (void) setFontName: (NSString *) font + size: (int) size + bold: (BOOL) bold + italic: (BOOL) italic { + for (int i = 0; i < 128; i++) { + [self setGeneralProperty: SCI_STYLESETFONT + parameter: i + value: (sptr_t)font.UTF8String]; + [self setGeneralProperty: SCI_STYLESETSIZE + parameter: i + value: size]; + [self setGeneralProperty: SCI_STYLESETBOLD + parameter: i + value: bold]; + [self setGeneralProperty: SCI_STYLESETITALIC + parameter: i + value: italic]; + } } //-------------------------------------------------------------------------------------------------- diff --git a/scintilla/cocoa/checkbuildosx.sh b/scintilla/cocoa/checkbuildosx.sh index 45f7ae43..bdc6054f 100644 --- a/scintilla/cocoa/checkbuildosx.sh +++ b/scintilla/cocoa/checkbuildosx.sh @@ -14,7 +14,7 @@ make test cd ../../.. # ************************************************************ -# Target 2: build framework and test app with Xcode targetting OS X 10.n with n from 9 to 5 +# Target 2: build framework and test app with Xcode targeting OS X 10.n with n from 9 to 5 # Only SDK versions that are installed will be built # Clean both then build both -- if perform clean in ScintillaTest, also cleans ScintillaFramework # which can cause double build diff --git a/scintilla/cocoa/res/info_bar_bg.png b/scintilla/cocoa/res/info_bar_bg.png index 79010fa7..d2be6c4d 100644 Binary files a/scintilla/cocoa/res/info_bar_bg.png and b/scintilla/cocoa/res/info_bar_bg.png differ diff --git a/scintilla/cocoa/res/info_bar_bg@2x.png b/scintilla/cocoa/res/info_bar_bg@2x.png index 486646a8..ff74c803 100644 Binary files a/scintilla/cocoa/res/info_bar_bg@2x.png and b/scintilla/cocoa/res/info_bar_bg@2x.png differ diff --git a/scintilla/delbin.bat b/scintilla/delbin.bat index 3636b987..7f9f9ca9 100644 --- a/scintilla/delbin.bat +++ b/scintilla/delbin.bat @@ -1 +1 @@ -del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL: +@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL: diff --git a/scintilla/delcvs.bat b/scintilla/delcvs.bat deleted file mode 100644 index d3ed21ce..00000000 --- a/scintilla/delcvs.bat +++ /dev/null @@ -1 +0,0 @@ -del /S /Q .cvsignore diff --git a/scintilla/doc/Design.html b/scintilla/doc/Design.html index d426cb36..7c408e87 100644 --- a/scintilla/doc/Design.html +++ b/scintilla/doc/Design.html @@ -6,6 +6,7 @@ + Scintilla and SciTE @@ -48,14 +49,14 @@ library and with limited use of templates.

- The currently supported platforms, Windows, GTK+/Linux and wxWindows are fairly similar in + The currently supported platforms, Windows, GTK+/Linux, Cocoa and wxWidgets are fairly similar in many ways. Each has windows, menus and bitmaps. These features generally work in similar ways so each has a way to move a window or draw a red line. Sometimes one platform requires a sequence of calls rather than a single call. At other times, the differences are more profound. Reading the Windows clipboard occurs synchronously but reading the GTK+ clipboard requires a request call that will be asynchronously answered with a message containing the clipboard data. - The wxWindows platform is available from the wxWindows site + The wxWidgets platform is available from the wxWidgets site


@@ -86,25 +87,21 @@ the name of a macro on Windows.

- Colour, ColourPair, Palette + ColourDesired

- Colour holds a platform specific colour identifier - COLORREF for Windows and GdkColor for - GTK+. The red, green and blue components that make up the colour are limited to the 8 bits of - precision available on Windows. ColourPairs are used because not all possible colours are - always available. Using an 8 bit colour mode, which is a common setting for both Windows and - GTK+, only 256 colours are possible on the display. Thus when an application asks for a dull - red, say #400000, it may only be allocated an already available colour such as #800000 or - #330000. With 16 or 2 colour modes even less choice is available and the application will - have to use the limited set of already available colours. + This is a simple class holding an expected colour. It is internally represented as a single + 32 bit integer in BGR format with 8 bits per colour, but also provides a convenient API to fetch + each component separately. + As a platform might not be able to represent the exact desired colour if it doesn't have 24 bit + depth available, it might not actually represent the exact desired colour but select a best fit + that it can actually render.

- A Palette object holds a set of colour pairs and can make the appropriate calls to ask to - allocate these colours and to see what the platform has decided will be allowed.

Font

- Font holds a platform specific font identifier - HFONT for Windows, GdkFont* for GTK+. It + Font holds a platform specific font identifier - HFONT for Windows, PangoFontDescription* for GTK+. It does not own the identifier and so will not delete the platform font object in its destructor. Client code should call Destroy at appropriate times.

@@ -115,8 +112,8 @@ Surface is an abstraction over each platform's concept of somewhere that graphical drawing operations can be done. It may wrap an already created drawing place such as a window or be used to create a bitmap that can be drawn into and later copied onto another surface. On - Windows it wraps a HDC and possibly a HBITMAP. On GTK+ it wraps a GdkDrawable* and possibly a - GdkPixmap*. Other platform specific objects are created (and correctly destroyed) whenever + Windows it wraps a HDC and possibly a HBITMAP. On GTK+ it wraps a cairo_surface_t*. + Other platform specific objects are created (and correctly destroyed) whenever required to perform drawing actions.

@@ -146,7 +143,7 @@

Menu is a small helper class for constructing popup menus. It contains the platform specific - menu identifier - HMENU for Windows, GtkItemFactory* for GTK+. Most of the work in + menu identifier - HMENU for Windows, GtkMenu* for GTK+. Most of the work in constructing menus requires access to platform events and so is done in the Platform Events and API layer.

@@ -163,7 +160,7 @@

The bulk of Scintilla's code is platform independent. This is made up of the CellBuffer, - ContractionState, Document, Editor, Indicator, LineMarker, Style, ViewStyle, KeyMap, + ContractionState, Document, Editor, Indicator, LineMarker, Style, ViewStyle, KeyMap, ScintillaBase, CallTip, and AutoComplete primary classes.

@@ -203,14 +200,14 @@

The Editor object is central to Scintilla. It is responsible for displaying a document and - responding to user actions and requests from the container. It uses ContractionState, Indicator, - LineMarker, Style, and ViewStyle objects to display the document and a KeyMap class to - map key presses to functions. - The visibility of each line is kept in the ContractionState which is also responsible for mapping + responding to user actions and requests from the container. It uses ContractionState, Indicator, + LineMarker, Style, and ViewStyle objects to display the document and a KeyMap class to + map key presses to functions. + The visibility of each line is kept in the ContractionState which is also responsible for mapping from display lines to documents lines and vice versa.

- There may be multiple Editor objects attached to one Document object. Changes to a + There may be multiple Editor objects attached to one Document object. Changes to a document are broadcast to the editors through the DocWatcher mechanism.

diff --git a/scintilla/doc/Icons.html b/scintilla/doc/Icons.html index 0d8b8bf5..e8aae1cc 100644 --- a/scintilla/doc/Icons.html +++ b/scintilla/doc/Icons.html @@ -6,6 +6,7 @@ + Scintilla icons @@ -26,10 +27,10 @@ Icons

- These images may be used under the same license as Scintilla. + These images may be used under the same license as Scintilla.

- Drawn by Iago Rubio, Philippe Lhoste, and Neil Hodgson. + Drawn by Iago Rubio, Philippe Lhoste, and Neil Hodgson.

zip format (70K) diff --git a/scintilla/doc/Indicators.png b/scintilla/doc/Indicators.png index 33e31f87..541e3de6 100644 Binary files a/scintilla/doc/Indicators.png and b/scintilla/doc/Indicators.png differ diff --git a/scintilla/doc/Lexer.txt b/scintilla/doc/Lexer.txt index a9b75a2b..5c20d364 100644 --- a/scintilla/doc/Lexer.txt +++ b/scintilla/doc/Lexer.txt @@ -47,7 +47,7 @@ The task of a lexer can be summarized briefly: for each range r of characters that are to be colored the same, the lexer should call styler.ColourTo(i, state) - + where i is the position of the last character of the range r. The lexer should set the state variable to the coloring state of the character at position i and continue until the entire text has been colored. @@ -139,8 +139,8 @@ characters in ASCII for operators, comment markers, etc. Special case: Folding -Folding may be performed in the lexer function. It is better to use a -separate folder function as that avoids some troublesome interaction +Folding may be performed in the lexer function. It is better to use a +separate folder function as that avoids some troublesome interaction between styling and folding. The folder function will be run after the lexer function if folding is enabled. The rest of this section explains how to perform folding within the lexer function. @@ -148,15 +148,15 @@ how to perform folding within the lexer function. During initialization, lexers that support folding set bool fold = styler.GetPropertyInt("fold"); - + If folding is enabled in the editor, fold will be TRUE and the lexer should call: styler.SetLevel(line, level); - + at the end of each line and just before exiting. -The line parameter is simply the count of the number of newlines seen. +The line parameter is simply the count of the number of newlines seen. It's initial value is styler.GetLine(startPos) and it is incremented (after calling styler.SetLevel) whenever a newline is seen. @@ -169,7 +169,7 @@ comments, of course). The following flag bits, defined in Scintilla.h, may be set or cleared in the flags parameter. The SC_FOLDLEVELWHITEFLAG flag is set if the lexer considers that the line contains nothing but whitespace. The -SC_FOLDLEVELHEADERFLAG flag indicates that the line is a fold point. +SC_FOLDLEVELHEADERFLAG flag indicates that the line is a fold point. This normally means that the next line has a greater level than present line. However, the lexer may have some other basis for determining a fold point. For example, a lexer might create a header line for the @@ -193,7 +193,7 @@ seen: if ((levelCurrent > levelPrev) && (visChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev); - + // reinitialize the folding vars describing the present line. lineCurrent++; visChars = 0; // Number of non-whitespace characters on the line. @@ -210,7 +210,7 @@ The following code appears in the C++ lexer just before exit: flagsNext &= ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } - + Don't worry about performance diff --git a/scintilla/doc/Markers.png b/scintilla/doc/Markers.png index 6eee926e..2ad37b10 100644 Binary files a/scintilla/doc/Markers.png and b/scintilla/doc/Markers.png differ diff --git a/scintilla/doc/Privacy.html b/scintilla/doc/Privacy.html new file mode 100644 index 00000000..85cb801c --- /dev/null +++ b/scintilla/doc/Privacy.html @@ -0,0 +1,70 @@ + + + + + + + + + Privacy Policy + + + + + + + + +
+ Scintilla icon + + Scintilla + and SciTE +
+

+ Privacy Policy for scintilla.org +

+

+ Information Collected +

+

+ Logs are collected to allow analysis of which pages are viewed. + The advertisements collect viewing information through Google Analytics which is + used by Google and advertisers. + No personally identifiable information is collected by scintilla.org. +

+

+ External Links +

+

+ Other web sites are linked to from this site. + These web sites have their own privacy policies which may differ significantly to those of scintilla.org. +

+

+ Cookies +

+

+ A cookie is a text file placed on the hard drive of a computer by some web pages which is used to remember + when a particular user returns to that site. + The advertisements shown on the main pages may use cookies. +

+

+ Contact +

+

+ This web site is the responsibility of Neil Hodgson. + Most queries about the site contents should go to one of the mailing lists mentioned on the main pages. + Queries about the privacy policy may be sent to neilh @ scintilla.org. +

+

+ Changes to this Policy +

+

+ This policy may change. If it does then this page will be updated and the date at the bottom will change. +

+

+ This policy was last updated 2 June 2015. +

+ + diff --git a/scintilla/doc/SciCoding.html b/scintilla/doc/SciCoding.html index 1d45f0a7..4a21a841 100644 --- a/scintilla/doc/SciCoding.html +++ b/scintilla/doc/SciCoding.html @@ -5,6 +5,7 @@ + Scintilla and SciTE Code Style Preferences @@ -123,6 +124,8 @@ compilers on diverse platforms with high performance and low resource usage. Scintilla has stricter portability requirements to SciTE as it may be ported to low capability platforms. + Scintilla code must build with C++17 which can be checked with "g++ --std=c++17". + SciTE can use C++17 features that are widely available from g++ 7.1, MSVC 2017.6 and Clang 5.0 compilers.

To achieve portability, only a subset of C++ features are used. @@ -130,22 +133,28 @@ C++, exceptions may not be thrown out of Scintilla and all exceptions should be caught before returning from Scintilla. Run-time type information adds to memory use so is turned off. - A 'Scintilla' name spaces is optionally used based on the SCI_NAMESPACE - definition. This helps with name clashes on OS X. + A 'Scintilla' name space is used. This helps with name clashes on OS X.

The goto statement is not used because of bad memories from my first job maintaining FORTRAN programs. The union feature is not used as it can lead to non-type-safe value access.

+

+ The SCI_METHOD preprocessor definition should be used when implementing + interfaces which include it like ILexer and only there. +

+

+ Headers should always be included in the same order as given by the + scripts/HeaderOrder.txt file. +

Casting

Do not use old C style casts like (char *)s. Instead use the most strict form of C++ cast possible like const_cast<char *>(s). Use static_cast and const_cast - where possible rather than reinterpret_cast. Because the code is compiled with - run-time type information turned off, dynamic_cast will not work. + where possible rather than reinterpret_cast.

The benefit to using the new style casts is that they explicitly detail what evil is @@ -255,5 +264,31 @@

Ensure there are no warnings under the compiler you use. Warnings from other compilers will be noted on the feature request.

sc.ch is an int: do not pass this around as a char.

+

The ctype functions like isalnum and isdigit only work on ASCII (0..127) and may cause + undefined behaviour including crashes if used on other values. Check with IsASCII before calling is*.

+

Functions, structs and classes in lexers should be in an unnamed namespace (see LexCPP) + or be marked "static" so they will not leak into other lexers.

+

If you copy from an existing lexer, remove any code that is not needed since it makes it + more difficult to maintain and review.

+

When modifying an existing lexer, try to maintain as much compatibility as possible. + Do not renumber lexical styles as current client code may be built against the earlier values.

+

+ Properties +

+

+ Properties provided by a new lexer should follow the naming conventions + and should include a comment suitable for showing to end users. + The convention is for properties that control styling to be named + lexer.<lexername>.* and those that control folding to be named + fold.<lexername>.*. + Examples are "lexer.python.literals.binary" and "fold.haskell.imports". +

+

+ The properties "fold" and "fold.comment" are generic and can be used by + any lexer. +

+

+ See LexPython for examples of properties in an object lexer and LexHTML for a functional lexer. +

diff --git a/scintilla/doc/SciTEIco.png b/scintilla/doc/SciTEIco.png index d0cc869b..90ab9ff7 100644 Binary files a/scintilla/doc/SciTEIco.png and b/scintilla/doc/SciTEIco.png differ diff --git a/scintilla/doc/ScintillaDoc.html b/scintilla/doc/ScintillaDoc.html index 31d45e96..36a1af69 100644 --- a/scintilla/doc/ScintillaDoc.html +++ b/scintilla/doc/ScintillaDoc.html @@ -14,22 +14,53 @@ @@ -82,17 +119,17 @@

Scintilla Documentation

-

Last edited 22 February 2015 NH

+

Last edited 6 June 2018 NH

There is an overview of the internal design of Scintilla.
Some notes on using Scintilla.
How to use the Scintilla Edit Control on Windows.
- A simple sample using Scintilla from + A simple sample using Scintilla from C++ on Windows.
- A simple sample using Scintilla from + A simple sample using Scintilla from Visual Basic.
- Bait is a tiny sample using Scintilla + Bait is a tiny sample using Scintilla on GTK+.
A detailed description of how to write a lexer, including a discussion of folding.
@@ -120,9 +157,10 @@

Scintilla also builds with Cocoa on OS X and with Qt, and follows the conventions of those platforms.

-

Scintilla does not properly support right-to-left languages like Arabic and Hebrew. - While text in these languages may appear correct, it is not possible to interact with this text - as is normal with other editing components.

+

Scintilla provides only limited experimental support on Windows for right-to-left languages + like Arabic and Hebrew. + While text in these languages may appear correct, interaction with this text may not work + correctly as occurs with other editors.

This documentation describes the individual messages and notifications used by Scintilla. It does not describe how to link them together to form a useful editor. For now, the best way to @@ -140,23 +178,24 @@ enhancement of messages without the risk of breaking existing code. Common argument types are:

- +
- + - + - + - + - + - + - + - + @@ -207,153 +246,165 @@

Contents

-
boolbool Arguments expect the values 0 for false and 1 for true.
intintArguments are 32-bit signed integers.Arguments are 32-bit or 64-bit signed integers depending on the platform. + Equivalent to intptr_t.
const char *const char * Arguments point at text that is being passed to Scintilla but not modified. The text may be zero terminated or another argument may specify the character count, the @@ -164,7 +203,7 @@
char *char * Arguments point at text buffers that Scintilla will fill with text. In some cases, another argument will tell Scintilla the buffer size. In others, you must make sure that @@ -175,7 +214,7 @@
colourcolour Colours are set using the RGB format (Red, Green, Blue). The intensity of each colour is set in the range 0 to 255. If you have three such intensities, they are combined as: @@ -186,7 +225,7 @@
alphaalpha Translucency is set using an alpha value. Alpha ranges from 0 (SC_ALPHA_TRANSPARENT) which is completely transparent to @@ -197,7 +236,7 @@
<unused><unused> This is an unused argument. Setting it to 0 will ensure compatibility with future enhancements.
+
- - + - + - + - + - + - + - + - scrolling - + + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - - + + + + + @@ -389,38 +440,36 @@ largest font in any current style. This restriction is for performance; if lines differed in height then calculations involving positioning of text would require the text to be styled first.

- SCI_GETTEXT(int length, char *text)
+ SCI_GETTEXT(int length, char *text) → int
SCI_SETTEXT(<unused>, const char *text)
SCI_SETSAVEPOINT
- SCI_GETLINE(int line, char *text)
+ SCI_GETLINE(int line, char *text) → int
SCI_REPLACESEL(<unused>, const char *text)
SCI_SETREADONLY(bool readOnly)
- SCI_GETREADONLY
- SCI_GETTEXTRANGE(<unused>, Sci_TextRange - *tr)
- SCI_ALLOCATE(int bytes, <unused>)
- SCI_ADDTEXT(int length, const char *s)
- SCI_ADDSTYLEDTEXT(int length, cell *s)
- SCI_APPENDTEXT(int length, const char *s)
+ SCI_GETREADONLY → bool
+ SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr) → int
+ SCI_ALLOCATE(int bytes)
+ SCI_ADDTEXT(int length, const char *text)
+ SCI_ADDSTYLEDTEXT(int length, cell *c)
+ SCI_APPENDTEXT(int length, const char *text)
SCI_INSERTTEXT(int pos, const char *text)
SCI_CHANGEINSERTION(int length, const char *text)
SCI_CLEARALL
- SCI_DELETERANGE(int pos, int deleteLength)
+ SCI_DELETERANGE(int start, int lengthDelete)
SCI_CLEARDOCUMENTSTYLE
- SCI_GETCHARAT(int position)
- SCI_GETSTYLEAT(int position)
- SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange - *tr)
+ SCI_GETCHARAT(int pos) → int
+ SCI_GETSTYLEAT(int pos) → int
+ SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr) → int
SCI_RELEASEALLEXTENDEDSTYLES
- SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
- SCI_TARGETASUTF8(<unused>, char *s)
- SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)
+ SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles) → int
+ SCI_TARGETASUTF8(<unused>, char *s) → int
+ SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded) → int
SCI_SETLENGTHFORENCODE(int bytes)
-

SCI_GETTEXT(int length, char *text NUL-terminated)
- This returns length-1 characters of text from the start of the document plus one +

SCI_GETTEXT(int length, char *text NUL-terminated) → int
+ This returns length-1 characters of text from the start of the document plus one terminating 0 character. To collect all the text in a document, use SCI_GETLENGTH to get the number of characters in the document (nLen), allocate a character buffer of length nLen+1 bytes, then call SCI_GETTEXT(nLen+1, char @@ -429,11 +478,11 @@ If you then save the text, you should use SCI_SETSAVEPOINT to mark the text as unmodified.

-

See also: SCI_GETSELTEXT, SCI_GETCURLINE, SCI_GETLINE, SCI_GETSTYLEDTEXT, SCI_GETTEXTRANGE

+

See also: SCI_GETSELTEXT, + SCI_GETCURLINE, + SCI_GETLINE, + SCI_GETSTYLEDTEXT, + SCI_GETTEXTRANGE

SCI_SETTEXT(<unused>, const char *text)
This replaces all the text in the document with the zero terminated text string you pass @@ -452,7 +501,7 @@

See also: SCI_EMPTYUNDOBUFFER, SCI_GETMODIFY

-

SCI_GETLINE(int line, char *text)
+

SCI_GETLINE(int line, char *text) → int
This fills the buffer defined by text with the contents of the nominated line (lines start at 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer is long enough for the text, use -

See also: SCI_GETCURLINE, SCI_GETSELTEXT, SCI_GETTEXTRANGE, SCI_GETSTYLEDTEXT, SCI_GETTEXT

+

See also: SCI_GETCURLINE, + SCI_GETSELTEXT, + SCI_GETTEXTRANGE, + SCI_GETSTYLEDTEXT, + SCI_GETTEXT

SCI_REPLACESEL(<unused>, const char *text)
The currently selected text between the anchor @@ -475,13 +524,12 @@ positioned after the inserted text and the caret is scrolled into view.

SCI_SETREADONLY(bool readOnly)
- SCI_GETREADONLY
+ SCI_GETREADONLY → bool
These messages set and get the read-only flag for the document. If you mark a document as read only, attempts to modify the text cause the
SCN_MODIFYATTEMPTRO notification.

-

SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr)
+

SCI_GETTEXTRANGE(<unused>, Sci_TextRange *tr) → int
This collects the text between the positions cpMin and cpMax and copies it to lpstrText (see struct Sci_TextRange in Scintilla.h). If cpMax is -1, text is returned to the end of the @@ -489,14 +537,13 @@ longer than the number of characters you wish to read. The return value is the length of the returned text not including the terminating 0.

-

See also: SCI_GETSELTEXT, SCI_GETLINE, SCI_GETCURLINE, SCI_GETSTYLEDTEXT, SCI_GETTEXT

+

See also: SCI_GETSELTEXT, + SCI_GETLINE, + SCI_GETCURLINE, + SCI_GETSTYLEDTEXT, + SCI_GETTEXT

-

SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr)
+

SCI_GETSTYLEDTEXT(<unused>, Sci_TextRange *tr) → int
This collects styled text into a buffer using two bytes for each cell, with the character at the lower address of each pair and the style byte at the upper address. Characters between the positions cpMin and cpMax are copied to lpstrText (see @@ -506,34 +553,36 @@ cpMin or cpMax. Positions outside the document return character codes and style bytes of 0.

-

See also: SCI_GETSELTEXT, SCI_GETLINE, SCI_GETCURLINE, SCI_GETTEXTRANGE, SCI_GETTEXT

+

See also: SCI_GETSELTEXT, + SCI_GETLINE, + SCI_GETCURLINE, + SCI_GETTEXTRANGE, + SCI_GETTEXT

-

SCI_ALLOCATE(int bytes, <unused>)
+

SCI_ALLOCATE(int bytes)
Allocate a document buffer large enough to store a given number of bytes. The document will not be made smaller than its current contents.

-

SCI_ADDTEXT(int length, const char *s)
- This inserts the first length characters from the string s +

SCI_ADDTEXT(int length, const char *text)
+ This inserts the first length characters from the string + text at the current position. This will include any 0's in the string that you might have expected to stop the insert operation. The current position is set at the end of the inserted text, but it is not scrolled into view.

-

SCI_ADDSTYLEDTEXT(int length, cell *s)
+

SCI_ADDSTYLEDTEXT(int length, cell *c)
This behaves just like SCI_ADDTEXT, but inserts styled text.

-

SCI_APPENDTEXT(int length, const char *s)
- This adds the first length characters from the string s to the end +

SCI_APPENDTEXT(int length, const char *text)
+ This adds the first length characters from the string + text to the end of the document. This will include any 0's in the string that you might have expected to stop the operation. The current selection is not changed and the new text is not scrolled into view.

SCI_INSERTTEXT(int pos, const char *text)
- This inserts the zero terminated text string at position pos or at - the current position if pos is -1. If the current position is after the insertion point + This inserts the zero terminated text string at position pos or at + the current position if pos is -1. If the current position is after the insertion point then it is moved along with its surrounding text but no scrolling is performed.

SCI_CHANGEINSERTION(int length, const char *text)
@@ -543,7 +592,7 @@

SCI_CLEARALL
Unless the document is read-only, this deletes all the text.

-

SCI_DELETERANGE(int pos, int deleteLength)
+

SCI_DELETERANGE(int start, int lengthDelete)
Deletes a range of text in the document.

SCI_CLEARDOCUMENTSTYLE
@@ -551,16 +600,16 @@ SCI_CLEARDOCUMENTSTYLE can be used to clear all styling information and reset the folding state.

-

SCI_GETCHARAT(int pos)
- This returns the character at pos in the document or 0 if pos is +

SCI_GETCHARAT(int pos) → int
+ This returns the character at pos in the document or 0 if pos is negative or past the end of the document.

-

SCI_GETSTYLEAT(int pos)
- This returns the style at pos in the document, or 0 if pos is +

SCI_GETSTYLEAT(int pos) → int
+ This returns the style at pos in the document, or 0 if pos is negative or past the end of the document.

SCI_RELEASEALLEXTENDEDSTYLES
- SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles)
+ SCI_ALLOCATEEXTENDEDSTYLES(int numberStyles) → int
Extended styles are used for features like textual margins and annotations as well as internally by Scintilla. They are outside the range 0..255 used for the styles bytes associated with document bytes. These functions manage the use of extended styles to ensures that components cooperate in defining styles. @@ -568,17 +617,21 @@ SCI_ALLOCATEEXTENDEDSTYLES allocates a range of style numbers after the byte style values and returns the number of the first allocated style. Ranges for margin and annotation styles should be allocated before calling - SCI_MARGINSETSTYLEOFFSET or - SCI_ANNOTATIONSETSTYLEOFFSET.

+ SCI_MARGINSETSTYLEOFFSET or + SCI_ANNOTATIONSETSTYLEOFFSET.

Sci_TextRange and Sci_CharacterRange
These structures are defined to be exactly the same shape as the Win32 TEXTRANGE and CHARRANGE, so that older code that treats Scintilla as a RichEdit will work.

+

In a future release the type Sci_PositionCR will be redefined to be 64-bits when Scintilla is + built for 64-bits on all platforms.

+typedef long Sci_PositionCR;
+
 struct Sci_CharacterRange {
-    long cpMin;
-    long cpMax;
+    Sci_PositionCR cpMin;
+    Sci_PositionCR cpMax;
 };
 
 struct Sci_TextRange {
@@ -589,7 +642,7 @@ struct Sci_TextRange {
 
     

Specific to GTK+, Cocoa and Windows only: Access to encoded text

-

SCI_TARGETASUTF8(<unused>, char *s)
+

SCI_TARGETASUTF8(<unused>, char *s) → int
This method retrieves the value of the target encoded as UTF-8 which is the default encoding of GTK+ so is useful for retrieving text for use in other parts of the user interface, such as find and replace dialogs. The length of the encoded text in bytes is returned. @@ -597,7 +650,7 @@ struct Sci_TextRange { more complex work of transcoding from the various encodings supported.

-

SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded)
+

SCI_ENCODEDFROMUTF8(const char *utf8, char *encoded) → int
SCI_SETLENGTHFORENCODE(int bytes)
SCI_ENCODEDFROMUTF8 converts a UTF-8 string into the document's encoding which is useful for taking the results of a find dialog, for example, and receiving @@ -612,19 +665,20 @@ struct Sci_TextRange {

There are methods to search for text and for regular expressions. Most applications should use - SCI_SEARCHINTARGET + SCI_SEARCHINTARGET as the basis for their search implementations. Other calls augment this or were implemented before SCI_SEARCHINTARGET.

The base regular expression support is limited and should only be used for simple cases and initial development. - When using a C++11 compliant compiler and runtime, it may be possible to use the - runtime's implementation of <regex> by compiling Scintilla with CXX11_REGEX defined. + The C++ runtime <regex> library may be used by setting the SCFIND_CXX11REGEX search flag. + The C++11 <regex> support may be disabled by + compiling Scintilla with NO_CXX11_REGEX defined. A different regular expression library can be integrated into Scintilla or can be called from the container using direct access to the buffer contents through - SCI_GETCHARACTERPOINTER. + SCI_GETCHARACTERPOINTER.

Search and replace using the target

@@ -635,29 +689,26 @@ struct Sci_TextRange { SCI_SEARCHINTARGET such as SCFIND_MATCHCASE, SCFIND_WHOLEWORD, SCFIND_WORDSTART, and SCFIND_REGEXP can be set with SCI_SETSEARCHFLAGS.

- SCI_SETTARGETSTART(int pos)
- SCI_GETTARGETSTART
- SCI_SETTARGETEND(int pos)
- SCI_GETTARGETEND
+ SCI_SETTARGETSTART(int start)
+ SCI_GETTARGETSTART → position
+ SCI_SETTARGETEND(int end)
+ SCI_GETTARGETEND → position
SCI_SETTARGETRANGE(int start, int end)
SCI_TARGETFROMSELECTION
+ SCI_TARGETWHOLEDOCUMENT
SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS
- SCI_SEARCHINTARGET(int length, const char - *text)
- SCI_GETTARGETTEXT(<unused>, - char *text)
- SCI_REPLACETARGET(int length, const char - *text)
- SCI_REPLACETARGETRE(int length, const char - *text)
- SCI_GETTAG(int tagNumber, char *tagValue)
+ SCI_GETSEARCHFLAGS → int
+ SCI_SEARCHINTARGET(int length, const char *text) → int
+ SCI_GETTARGETTEXT(<unused>, char *text) → int
+ SCI_REPLACETARGET(int length, const char *text) → int
+ SCI_REPLACETARGETRE(int length, const char *text) → int
+ SCI_GETTAG(int tagNumber, char *tagValue) → int
-

SCI_SETTARGETSTART(int pos)
- SCI_GETTARGETSTART
- SCI_SETTARGETEND(int pos)
- SCI_GETTARGETEND
+

SCI_SETTARGETSTART(int start)
+ SCI_GETTARGETSTART → position
+ SCI_SETTARGETEND(int end)
+ SCI_GETTARGETEND → position
SCI_SETTARGETRANGE(int start, int end)
These functions set and return the start and end of the target. When searching you can set start greater than end to find the last matching text in the @@ -667,52 +718,55 @@ struct Sci_TextRange {

SCI_TARGETFROMSELECTION
Set the target start and end to the start and end positions of the selection.

+

SCI_TARGETWHOLEDOCUMENT
+ Set the target start to the start of the document and target end to the end of the document.

+

SCI_SETSEARCHFLAGS(int searchFlags)
- SCI_GETSEARCHFLAGS
- These get and set the searchFlags used by + SCI_GETSEARCHFLAGS → int
+ These get and set the searchFlags used by SCI_SEARCHINTARGET. There are several option flags including a simple regular expression search.

-

SCI_SEARCHINTARGET(int length, const char *text)
+

SCI_SEARCHINTARGET(int length, const char *text) → int
This searches for the first occurrence of a text string in the target defined by SCI_SETTARGETSTART and SCI_SETTARGETEND. The text string is not zero - terminated; the size is set by length. The search is modified by the search flags + terminated; the size is set by length. The search is modified by the search flags set by SCI_SETSEARCHFLAGS. If the search succeeds, the target is set to the found text and the return value is the position of the start of the matching text. If the search fails, the result is -1.

-

SCI_GETTARGETTEXT(<unused>, char *text)
+

SCI_GETTARGETTEXT(<unused>, char *text) → int
Retrieve the value in the target.

-

SCI_REPLACETARGET(int length, const char *text)
- If length is -1, text is a zero terminated string, otherwise - length sets the number of character to replace the target with. +

SCI_REPLACETARGET(int length, const char *text) → int
+ If length is -1, text is a zero terminated string, otherwise + length sets the number of character to replace the target with. After replacement, the target range refers to the replacement text. The return value is the length of the replacement string.
Note that the recommended way to delete text in the document is to set the target to the text to be removed, and to perform a replace target with an empty string.

-

SCI_REPLACETARGETRE(int length, const char *text)
- This replaces the target using regular expressions. If length is -1, - text is a zero terminated string, otherwise length is the number of +

SCI_REPLACETARGETRE(int length, const char *text) → int
+ This replaces the target using regular expressions. If length is -1, + text is a zero terminated string, otherwise length is the number of characters to use. The replacement string is formed from the text string with any sequences of \1 through \9 replaced by tagged matches from the most recent regular expression search. \0 is replaced with all the matched text from the most recent search. After replacement, the target range refers to the replacement text. The return value is the length of the replacement string.

-

SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated)
+

SCI_GETTAG(int tagNumber, char *tagValue NUL-terminated) → int
Discover what text was matched by tagged expressions in a regular expression search. This is useful if the application wants to interpret the replacement string itself.

See also: SCI_FINDTEXT

-

searchFlags
+

searchFlags
Several of the search routines use flag options, which include a simple regular expression search. Combine the flag options by adding them:

-
o Text retrieval and + Text retrieval and modificationo Searching and replacingSearching and replacingo OvertypeOvertype
o Cut, copy and pasteCut, copy and pasteo Error handlingError handlingo Undo and RedoUndo and Redo
o Selection and informationSelection and informationo Multiple Selection and Virtual SpaceBy character or UTF-16 code unito Scrolling and automatic + Multiple Selection and Virtual Space
o White spaceScrolling and automatic - o CursorWhite spaceo Mouse captureCursor
o Line endingsMouse captureo StylingLine endingso Style definitionWords
o Caret, selection, and hotspot stylesStylingo Character representationsStyle definitiono MarginsCaret, selection, and hotspot styles
o AnnotationsCharacter representationso Other settingsMarginso Brace highlightingAnnotations
o Tabs and Indentation + Other settingsBrace highlightingTabs and Indentation Guideso Markers
o Indicators
MarkersIndicatorsAutocompletion
o AutocompletionUser listso User listsCall tipso Call tipsKeyboard commands
o Keyboard commandsKey bindingso Key bindingsPopup edit menuo Popup edit menuMacro recording
o Macro recordingPrintingo PrintingDirect accesso Direct accessMultiple views
o Multiple viewsBackground loading and savingo Background loading and savingFoldingo FoldingLine wrapping
o Line wrappingZoomingo ZoomingLong lineso Long linesAccessibility
o LexerLexero Lexer objectsLexer objectso NotificationsNotifications
o ImagesImageso GTK+GTK+o Provisional messagesProvisional messages
o Deprecated messagesDeprecated messageso Edit messages never + Edit messages never supported by Scintillao Building ScintillaRemoved features
Building Scintilla
+
@@ -723,43 +777,48 @@ struct Sci_TextRange { - + - + - + + by interpreting bare ( and ) for tagged sections rather than \( and \). + Has no effect when SCFIND_CXX11REGEX is set. - + - +
SCFIND_MATCHCASE
SCFIND_WHOLEWORDA match only occurs if the characters before and after are not word characters.A match only occurs if the characters before and after are not word characters as defined + by SCI_SETWORDCHARS.
SCFIND_WORDSTARTA match only occurs if the character before is not a word character.A match only occurs if the character before is not a word character as defined + by SCI_SETWORDCHARS.
SCFIND_REGEXPThe search string should be interpreted as a regular expression.The search string should be interpreted as a regular expression. + Uses Scintilla's base implementation unless combined with SCFIND_CXX11REGEX.
SCFIND_POSIX Treat regular expression in a more POSIX compatible manner - by interpreting bare ( and ) for tagged sections rather than \( and \).
SCFIND_CXX11REGEXWhen compiled with CXX11_REGEX this flag - may be set to use <regex> instead of Scintilla's basic regular expressions. - If the regular expression is invalid then -1 is returned and status is set to - SC_STATUS_WARN_REGEX. - The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant - behaviour. For MSVC, where wchar_t is 16-bits, the reular expression ".." will match a single - astral-plane character. There may be other differences between compilers.This flag may be set to use C++11 <regex> instead of Scintilla's basic regular expressions. + If the regular expression is invalid then -1 is returned and status is set to + SC_STATUS_WARN_REGEX. + The ECMAScript flag is set on the regex object and UTF-8 documents will exhibit Unicode-compliant + behaviour. For MSVC, where wchar_t is 16-bits, the reular expression ".." will match a single + astral-plane character. There may be other differences between compilers. + Must also have SCFIND_REGEXP set.
-

In a regular expression, special characters interpreted are:

+

In a regular expression, using Scintilla's base implementation, + special characters interpreted are:

- +
@@ -852,19 +911,19 @@ struct Sci_TextRange {

Regular expressions will only match ranges within a single line, never matching over multiple lines.

- SCI_FINDTEXT(int flags, Sci_TextToFind - *ttf)
+

When using SCFIND_CXX11REGEX more features are available, + generally similar to regular expression support in JavaScript. + See the documentation of your C++ runtime for details on what is supported.

+ + SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) → position
SCI_SEARCHANCHOR
- SCI_SEARCHNEXT(int searchFlags, const char - *text)
- SCI_SEARCHPREV(int searchFlags, const char - *text)
+ SCI_SEARCHNEXT(int searchFlags, const char *text) → int
+ SCI_SEARCHPREV(int searchFlags, const char *text) → int
-

SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ttf)
+

SCI_FINDTEXT(int searchFlags, Sci_TextToFind *ft) → position
This message searches for text in the document. It does not use or move the current selection. - The searchFlags argument controls the + The searchFlags argument controls the search type, which includes regular expression searches.

You can @@ -898,8 +957,8 @@ struct Sci_TextToFind {

SCI_SEARCHANCHOR
- SCI_SEARCHNEXT(int searchFlags, const char *text)
- SCI_SEARCHPREV(int searchFlags, const char *text)
+ SCI_SEARCHNEXT(int searchFlags, const char *text) → int
+ SCI_SEARCHPREV(int searchFlags, const char *text) → int
These messages provide relocatable search support. This allows multiple incremental interactive searches to be macro recorded while still setting the selection to found text so the find/select operation is self-contained. These three messages send SCI_SEARCHNEXT and SCI_SEARCHPREV search for the next and previous occurrence of the zero terminated search string pointed at by text. The search is modified by - the searchFlags.

+ the searchFlags.

The return value is -1 if nothing is found, otherwise the return value is the start position of the matching text. The selection is updated to show the matched text, but is not scrolled @@ -925,12 +984,16 @@ struct Sci_TextToFind {

Overtype

+ SCI_SETOVERTYPE(bool overType)
+ SCI_GETOVERTYPE → bool
+
+

SCI_SETOVERTYPE(bool overType)
- SCI_GETOVERTYPE
+ SCI_GETOVERTYPE → bool
When overtype is enabled, each typed character replaces the character to the right of the text caret. When overtype is disabled, characters are inserted at the caret. - SCI_GETOVERTYPE returns TRUE (1) if overtyping is active, otherwise - FALSE (0) will be returned. Use SCI_SETOVERTYPE to set the overtype + SCI_GETOVERTYPE returns true (1) if overtyping is active, otherwise + false (0) will be returned. Use SCI_SETOVERTYPE to set the overtype mode.

Cut, copy and paste

@@ -939,20 +1002,19 @@ struct Sci_TextToFind { SCI_COPY
SCI_PASTE
SCI_CLEAR
- SCI_CANPASTE
+ SCI_CANPASTE → bool
SCI_COPYRANGE(int start, int end)
- SCI_COPYTEXT(int length, - const char *text)
+ SCI_COPYTEXT(int length, const char *text)
SCI_COPYALLOWLINE
SCI_SETPASTECONVERTENDINGS(bool convert)
- SCI_GETPASTECONVERTENDINGS
+ SCI_GETPASTECONVERTENDINGS → bool

SCI_CUT
SCI_COPY
SCI_PASTE
SCI_CLEAR
- SCI_CANPASTE
+ SCI_CANPASTE → bool
SCI_COPYALLOWLINE
These commands perform the standard tasks of cutting and copying data to the clipboard, pasting from the clipboard into the document, and clearing the document. @@ -961,7 +1023,7 @@ struct Sci_TextToFind { SCI_GETSELECTIONEMPTY(), which will be zero if there are any non-empty selection ranges implying that a copy or cut to the clipboard should work.

-

GTK+ does not really support SCI_CANPASTE and always returns TRUE +

GTK+ does not really support SCI_CANPASTE and always returns true unless the document is read-only.

On X, the clipboard is asynchronous and may require several messages between @@ -980,16 +1042,20 @@ struct Sci_TextToFind { text to the system clipboard.

SCI_SETPASTECONVERTENDINGS(bool convert)
- SCI_GETPASTECONVERTENDINGS
+ SCI_GETPASTECONVERTENDINGS → bool
If this property is set then when text is pasted any line ends are converted to match the document's end of line mode as set with - SCI_SETEOLMODE. + SCI_SETEOLMODE. Defaults to true.

Error handling

+ SCI_SETSTATUS(int status)
+ SCI_GETSTATUS → int
+
+

SCI_SETSTATUS(int status)
- SCI_GETSTATUS
+ SCI_GETSTATUS → int
If an error occurs, Scintilla may set an internal error number that can be retrieved with SCI_GETSTATUS. To clear the error status call SCI_SETSTATUS(0). @@ -998,28 +1064,28 @@ struct Sci_TextToFind { The currently defined statuses are:

-
.
+
- + - + - - + + - + @@ -1038,20 +1104,19 @@ struct Sci_TextToFind { SCI_ENDUNDOACTION messages. These transactions can be nested and only the top-level sequences are undone as units.

SCI_UNDO
- SCI_CANUNDO
+ SCI_CANUNDO → bool
SCI_EMPTYUNDOBUFFER
SCI_REDO
- SCI_CANREDO
- SCI_SETUNDOCOLLECTION(bool - collectUndo)
- SCI_GETUNDOCOLLECTION
+ SCI_CANREDO → bool
+ SCI_SETUNDOCOLLECTION(bool collectUndo)
+ SCI_GETUNDOCOLLECTION → bool
SCI_BEGINUNDOACTION
SCI_ENDUNDOACTION
SCI_ADDUNDOACTION(int token, int flags)

SCI_UNDO
- SCI_CANUNDO
+ SCI_CANUNDO → bool
SCI_UNDO undoes one action, or if the undo buffer has reached a SCI_ENDUNDOACTION point, all the actions back to the corresponding SCI_BEGINUNDOACTION.

@@ -1060,7 +1125,7 @@ struct Sci_TextToFind { typically use the result of this message to enable/disable the Edit menu Undo command.

SCI_REDO
- SCI_CANREDO
+ SCI_CANREDO → bool
SCI_REDO undoes the effect of the last SCI_UNDO operation.

SCI_CANREDO returns 0 if there is no action to redo and 1 if there are undo @@ -1077,7 +1142,7 @@ struct Sci_TextToFind {

See also: SCI_SETSAVEPOINT

SCI_SETUNDOCOLLECTION(bool collectUndo)
- SCI_GETUNDOCOLLECTION
+ SCI_GETUNDOCOLLECTION → bool
You can control whether Scintilla collects undo information with SCI_SETUNDOCOLLECTION. Pass in true (1) to collect information and false (0) to stop collecting. If you stop collection, you should also use @@ -1126,89 +1191,72 @@ struct Sci_TextToFind { (after the last character). If you use messages, there is nothing to stop you setting a position that is in the middle of a CRLF pair, or in the middle of a 2 byte character. However, keyboard commands will not move the caret into such positions.

- SCI_GETTEXTLENGTH
- SCI_GETLENGTH
- SCI_GETLINECOUNT
- SCI_SETFIRSTVISIBLELINE(int lineDisplay)
- SCI_GETFIRSTVISIBLELINE
- SCI_LINESONSCREEN
- SCI_GETMODIFY
- SCI_SETSEL(int anchorPos, int currentPos)
- SCI_GOTOPOS(int position)
+ SCI_GETTEXTLENGTH → int
+ SCI_GETLENGTH → int
+ SCI_GETLINECOUNT → int
+ SCI_LINESONSCREEN → int
+ SCI_GETMODIFY → bool
+ SCI_SETSEL(int anchor, int caret)
+ SCI_GOTOPOS(int caret)
SCI_GOTOLINE(int line)
- SCI_SETCURRENTPOS(int position)
- SCI_GETCURRENTPOS
- SCI_SETANCHOR(int position)
- SCI_GETANCHOR
- SCI_SETSELECTIONSTART(int position)
- SCI_GETSELECTIONSTART
- SCI_SETSELECTIONEND(int position)
- SCI_GETSELECTIONEND
- SCI_SETEMPTYSELECTION(int pos)
+ SCI_SETCURRENTPOS(int caret)
+ SCI_GETCURRENTPOS → position
+ SCI_SETANCHOR(int anchor)
+ SCI_GETANCHOR → position
+ SCI_SETSELECTIONSTART(int anchor)
+ SCI_GETSELECTIONSTART → position
+ SCI_SETSELECTIONEND(int caret)
+ SCI_GETSELECTIONEND → position
+ SCI_SETEMPTYSELECTION(int caret)
SCI_SELECTALL
- SCI_LINEFROMPOSITION(int position)
- SCI_POSITIONFROMLINE(int line)
- SCI_GETLINEENDPOSITION(int line)
- SCI_LINELENGTH(int line)
- SCI_GETCOLUMN(int position)
- SCI_FINDCOLUMN(int line, int column)
- SCI_POSITIONFROMPOINT(int x, int y)
- SCI_POSITIONFROMPOINTCLOSE(int x, int - y)
- SCI_CHARPOSITIONFROMPOINT(int x, int y)
- SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int - y)
- SCI_POINTXFROMPOSITION(<unused>, int - position)
- SCI_POINTYFROMPOSITION(<unused>, int - position)
+ SCI_LINEFROMPOSITION(int pos) → int
+ SCI_POSITIONFROMLINE(int line) → position
+ SCI_GETLINEENDPOSITION(int line) → position
+ SCI_LINELENGTH(int line) → int
+ SCI_GETCOLUMN(int pos) → int
+ SCI_FINDCOLUMN(int line, int column) → int
+ SCI_POSITIONFROMPOINT(int x, int y) → position
+ SCI_POSITIONFROMPOINTCLOSE(int x, int y) → position
+ SCI_CHARPOSITIONFROMPOINT(int x, int y) → position
+ SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y) → position
+ SCI_POINTXFROMPOSITION(<unused>, int pos) → int
+ SCI_POINTYFROMPOSITION(<unused>, int pos) → int
SCI_HIDESELECTION(bool hide)
- SCI_GETSELTEXT(<unused>, char *text)
- SCI_GETCURLINE(int textLen, char *text)
- SCI_SELECTIONISRECTANGLE
- SCI_SETSELECTIONMODE(int mode)
- SCI_GETSELECTIONMODE
- SCI_GETLINESELSTARTPOSITION(int line)
- SCI_GETLINESELENDPOSITION(int line)
+ SCI_GETSELTEXT(<unused>, char *text) → int
+ SCI_GETCURLINE(int length, char *text) → int
+ SCI_SELECTIONISRECTANGLE → bool
+ SCI_SETSELECTIONMODE(int selectionMode)
+ SCI_GETSELECTIONMODE → int
+ SCI_GETMOVEEXTENDSSELECTION → bool
+ SCI_GETLINESELSTARTPOSITION(int line) → position
+ SCI_GETLINESELENDPOSITION(int line) → position
SCI_MOVECARETINSIDEVIEW
- SCI_WORDENDPOSITION(int position, bool - onlyWordCharacters)
- SCI_WORDSTARTPOSITION(int position, bool - onlyWordCharacters)
- SCI_POSITIONBEFORE(int position)
- SCI_POSITIONAFTER(int position)
- SCI_POSITIONRELATIVE(int position, int relative)
- SCI_COUNTCHARACTERS(int startPos, int endPos)
- SCI_TEXTWIDTH(int styleNumber, const char *text)
- SCI_TEXTHEIGHT(int line)
+ SCI_POSITIONBEFORE(int pos) → position
+ SCI_POSITIONAFTER(int pos) → position
+ SCI_TEXTWIDTH(int style, const char *text) → int
+ SCI_TEXTHEIGHT(int line) → int
SCI_CHOOSECARETX
SCI_MOVESELECTEDLINESUP
SCI_MOVESELECTEDLINESDOWN
- SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool - mouseSelectionRectangularSwitch)
- SCI_GETMOUSESELECTIONRECTANGULARSWITCH
+ SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool mouseSelectionRectangularSwitch)
+ SCI_GETMOUSESELECTIONRECTANGULARSWITCH → bool
-

SCI_GETTEXTLENGTH
- SCI_GETLENGTH
+

SCI_GETTEXTLENGTH → int
+ SCI_GETLENGTH → int
Both these messages return the length of the document in bytes.

-

SCI_GETLINECOUNT
+

SCI_GETLINECOUNT → int
This returns the number of lines in the document. An empty document contains 1 line. A document holding only an end of line sequence has 2 lines.

-

SCI_SETFIRSTVISIBLELINE(int lineDisplay)
- SCI_GETFIRSTVISIBLELINE
- These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line - in the document is numbered 0. The value is a visible line rather than a document line.

- -

SCI_LINESONSCREEN
+

SCI_LINESONSCREEN → int
This returns the number of complete lines visible on the screen. With a constant line height, this is the vertical space available divided by the line separation. Unless you arrange to size your window to an integral number of lines, there may be a partial line visible at the bottom of the view.

-

SCI_GETMODIFY
+

SCI_GETMODIFY → bool
This returns non-zero if the document is modified and 0 if it is unmodified. The modified status of a document is determined by the undo position relative to the save point. The save point is set by SCI_SETSAVEPOINT, @@ -1220,57 +1268,58 @@ struct Sci_TextToFind { href="#SCN_SAVEPOINTLEFT">SCN_SAVEPOINTLEFT notification messages.

-

SCI_SETSEL(int anchorPos, int currentPos)
- This message sets both the anchor and the current position. If currentPos is - negative, it means the end of the document. If anchorPos is negative, it means - remove any selection (i.e. set the anchor to the same position as currentPos). The +

SCI_SETSEL(int anchor, int caret)
+ This message sets both the anchor and the current position. If caret is + negative, it means the end of the document. If anchor is negative, it means + remove any selection (i.e. set the anchor to the same position as caret). The caret is scrolled into view after this operation.

-

SCI_GOTOPOS(int pos)
- This removes any selection, sets the caret at pos and scrolls the view to make +

SCI_GOTOPOS(int caret)
+ This removes any selection, sets the caret at caret and scrolls the view to make the caret visible, if necessary. It is equivalent to - SCI_SETSEL(pos, pos). The anchor position is set the same as the current + SCI_SETSEL(caret, caret). The anchor position is set the same as the current position.

SCI_GOTOLINE(int line)
- This removes any selection and sets the caret at the start of line number line + This removes any selection and sets the caret at the start of line number line and scrolls the view (if needed) to make it visible. The anchor position is set the same as the - current position. If line is outside the lines in the document (first line is 0), + current position. If line is outside the lines in the document (first line is 0), the line set is the first or last.

-

SCI_SETCURRENTPOS(int pos)
+

SCI_SETCURRENTPOS(int caret)
This sets the current position and creates a selection between the anchor and the current position. The caret is not scrolled into view.

See also: SCI_SCROLLCARET

-

SCI_GETCURRENTPOS
+

SCI_GETCURRENTPOS → position
This returns the current position.

-

SCI_SETANCHOR(int pos)
+

SCI_SETANCHOR(int anchor)
This sets the anchor position and creates a selection between the anchor position and the current position. The caret is not scrolled into view.

See also: SCI_SCROLLCARET

-

SCI_GETANCHOR
+

SCI_GETANCHOR → position
This returns the current anchor position.

-

SCI_SETSELECTIONSTART(int pos)
- SCI_SETSELECTIONEND(int pos)
+

SCI_SETSELECTIONSTART(int anchor)
+ SCI_SETSELECTIONEND(int caret)
These set the selection based on the assumption that the anchor position is less than the current position. They do not make the caret visible. The table shows the positions of the anchor and the current position after using these messages.

-
SC_STATUS_OKSC_STATUS_OK 0 No failures
SC_STATUS_FAILURESC_STATUS_FAILURE 1 Generic failure
SC_STATUS_BADALLOC
SC_STATUS_BADALLOC 2 Memory is exhausted
SC_STATUS_WARN_REGEXSC_STATUS_WARN_REGEX 1001 Regular expression is invalid
+
- + @@ -1278,96 +1327,96 @@ struct Sci_TextToFind { - + - + - + - +
+ New value for anchorcurrentcaret
SCI_SETSELECTIONSTARTposanchorMax(pos, current)Max(anchor, current)
SCI_SETSELECTIONENDMin(anchor, pos)Min(anchor, caret)poscaret

See also: SCI_SCROLLCARET

-

SCI_GETSELECTIONSTART
- SCI_GETSELECTIONEND
+

SCI_GETSELECTIONSTART → position
+ SCI_GETSELECTIONEND → position
These return the start and end of the selection without regard to which end is the current position and which is the anchor. SCI_GETSELECTIONSTART returns the smaller of the current position or the anchor position. SCI_GETSELECTIONEND returns the larger of the two values.

-

SCI_SETEMPTYSELECTION(int pos)
- This removes any selection and sets the caret at pos. The caret is not scrolled into view.

+

SCI_SETEMPTYSELECTION(int caret)
+ This removes any selection and sets the caret at caret. The caret is not scrolled into view.

SCI_SELECTALL
This selects all the text in the document. The current position is not scrolled into view.

-

SCI_LINEFROMPOSITION(int pos)
- This message returns the line that contains the position pos in the document. The - return value is 0 if pos <= 0. The return value is the last line if - pos is beyond the end of the document.

+

SCI_LINEFROMPOSITION(int pos) → int
+ This message returns the line that contains the position pos in the document. The + return value is 0 if pos <= 0. The return value is the last line if + pos is beyond the end of the document.

-

SCI_POSITIONFROMLINE(int line)
+

SCI_POSITIONFROMLINE(int line) → position
This returns the document position that corresponds with the start of the line. If - line is negative, the position of the line holding the start of the selection is - returned. If line is greater than the lines in the document, the return value is - -1. If line is equal to the number of lines in the document (i.e. 1 line past the + line is negative, the position of the line holding the start of the selection is + returned. If line is greater than the lines in the document, the return value is + -1. If line is equal to the number of lines in the document (i.e. 1 line past the last line), the return value is the end of the document.

-

SCI_GETLINEENDPOSITION(int line)
- This returns the position at the end of the line, before any line end characters. If line +

SCI_GETLINEENDPOSITION(int line) → position
+ This returns the position at the end of the line, before any line end characters. If line is the last line in the document (which does not have any end of line characters) or greater, the result is the size of the document. - If line is negative the result is undefined.

+ If line is negative the result is undefined.

-

SCI_LINELENGTH(int line)
- This returns the length of the line, including any line end characters. If line +

SCI_LINELENGTH(int line) → int
+ This returns the length of the line, including any line end characters. If line is negative or beyond the last line in the document, the result is 0. If you want the length of the line not including any end of line characters, use SCI_GETLINEENDPOSITION(line) - SCI_POSITIONFROMLINE(line).

-

SCI_GETSELTEXT(<unused>, char *text NUL-terminated)
- This copies the currently selected text and a terminating 0 byte to the text - buffer. The buffer size should be determined by calling with a NULL pointer for the text argument +

SCI_GETSELTEXT(<unused>, char *text NUL-terminated) → int
+ This copies the currently selected text and a terminating 0 byte to the text + buffer. The buffer size should be determined by calling with a NULL pointer for the text argument SCI_GETSELTEXT(0,0). This allows for rectangular and discontiguous selections as well as simple selections. See Multiple Selection for information on how multiple and rectangular selections and virtual space are copied.

-

See also: SCI_GETCURLINE, - SCI_GETLINE, - SCI_GETTEXT, - SCI_GETSTYLEDTEXT, - SCI_GETTEXTRANGE +

See also: SCI_GETCURLINE, + SCI_GETLINE, + SCI_GETTEXT, + SCI_GETSTYLEDTEXT, + SCI_GETTEXTRANGE

-

SCI_GETCURLINE(int textLen, char *text NUL-terminated)
+

SCI_GETCURLINE(int length, char *text NUL-terminated) → int
This retrieves the text of the line containing the caret and returns the position within the line of the caret. Pass in char* text pointing at a buffer large enough to hold the text you wish to retrieve and a terminating 0 character. - Set textLen to the + Set length to the length of the buffer which must be at least 1 to hold the terminating 0 character. If the text argument is 0 then the length that should be allocated to store the entire current line is returned.

-

See also: SCI_GETSELTEXT, SCI_GETLINE, SCI_GETTEXT, SCI_GETSTYLEDTEXT, See also: SCI_GETSELTEXT, SCI_GETLINE, SCI_GETTEXT, SCI_GETSTYLEDTEXT, SCI_GETTEXTRANGE

-

SCI_SELECTIONISRECTANGLE
+

SCI_SELECTIONISRECTANGLE → bool
This returns 1 if the current selection is in rectangle mode, 0 if not.

-

SCI_SETSELECTIONMODE(int mode)
- SCI_GETSELECTIONMODE
+

SCI_SETSELECTIONMODE(int selectionMode)
+ SCI_GETSELECTIONMODE → int
The two functions set and get the selection mode, which can be stream (SC_SEL_STREAM=0) or rectangular (SC_SEL_RECTANGLE=1) or @@ -1380,8 +1429,12 @@ struct Sci_TextToFind { SC_SEL_THIN is the mode after a rectangular selection has been typed into and ensures that no characters are selected.

-

SCI_GETLINESELSTARTPOSITION(int line)
- SCI_GETLINESELENDPOSITION(int line)
+

SCI_GETMOVEEXTENDSSELECTION → bool
+ This returns 1 if regular caret moves will extend or reduce the selection, 0 if not. + SCI_SETSELECTIONMODE toggles this setting between on and off.

+ +

SCI_GETLINESELSTARTPOSITION(int line) → position
+ SCI_GETLINESELENDPOSITION(int line) → position
Retrieve the position of the start and end of the selection at the given line with INVALID_POSITION returned if no selection on this line.

@@ -1389,146 +1442,52 @@ struct Sci_TextToFind { If the caret is off the top or bottom of the view, it is moved to the nearest line that is visible to its current position. Any selection is lost.

-

SCI_WORDENDPOSITION(int position, bool - onlyWordCharacters)
- SCI_WORDSTARTPOSITION(int position, bool - onlyWordCharacters)
- These messages return the start and end of words using the same definition of words as used - internally within Scintilla. You can set your own list of characters that count as words with - SCI_SETWORDCHARS. The position - sets the start or the search, which is forwards when searching for the end and backwards when - searching for the start.

- -

Set onlyWordCharacters to true (1) to stop searching at the first - non-word character in the search direction. If onlyWordCharacters is - false (0), the first character in the search direction sets the type of the search - as word or non-word and the search stops at the first non-matching character. Searches are also - terminated by the start or end of the document.

- -

If "w" represents word characters and "." represents non-word characters and "|" represents - the position and true or false is the state of - onlyWordCharacters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Initial stateend, trueend, falsestart, truestart, false
..ww..|..ww....ww..|..ww....ww....|ww....ww..|..ww....ww|....ww..
....ww|ww........wwww|........wwww|........|wwww........|wwww....
..ww|....ww....ww|....ww....ww....|ww....|ww....ww....|ww....ww..
..ww....|ww....ww....ww|....ww....ww|....ww....|ww....ww|....ww..
- -

SCI_POSITIONBEFORE(int position)
- SCI_POSITIONAFTER(int position)
+

SCI_POSITIONBEFORE(int pos) → position
+ SCI_POSITIONAFTER(int pos) → position
These messages return the position before and after another position in the document taking into account the current code page. The minimum position returned is 0 and the maximum is the last position in the document. If called with a position within a multi byte character will return the position of the start/end of that character.

-

SCI_POSITIONRELATIVE(int position, int relative)
- Count a number of whole characters before or after the argument position and return that position. - The minimum position returned is 0 and the maximum is the last position in the document. -

- -

SCI_COUNTCHARACTERS(int startPos, int endPos)
- Returns the number of whole characters between two positions..

- -

SCI_TEXTWIDTH(int styleNumber, const char *text)
- This returns the pixel width of a string drawn in the given styleNumber which can +

SCI_TEXTWIDTH(int style, const char *text) → int
+ This returns the pixel width of a string drawn in the given style which can be used, for example, to decide how wide to make the line number margin in order to display a given number of numerals.

-

SCI_TEXTHEIGHT(int line)
+

SCI_TEXTHEIGHT(int line) → int
This returns the height in pixels of a particular line. Currently all lines are the same height.

-

SCI_GETCOLUMN(int pos)
- This message returns the column number of a position pos within the document +

SCI_GETCOLUMN(int pos) → int
+ This message returns the column number of a position pos within the document taking the width of tabs into account. This returns the column number of the last tab on the - line before pos, plus the number of characters between the last tab and - pos. If there are no tab characters on the line, the return value is the number of + line before pos, plus the number of characters between the last tab and + pos. If there are no tab characters on the line, the return value is the number of characters up to the position on the line. In both cases, double byte characters count as a single character. This is probably only useful with monospaced fonts.

-

SCI_FINDCOLUMN(int line, int column)
- This message returns the position of a column on a line +

SCI_FINDCOLUMN(int line, int column) → int
+ This message returns the position of a column on a line taking the width of tabs into account. It treats a multi-byte character as a single column. Column numbers, like lines start at 0.

-

SCI_POSITIONFROMPOINT(int x, int y)
- SCI_POSITIONFROMPOINTCLOSE(int x, int y)
+

SCI_POSITIONFROMPOINT(int x, int y) → position
+ SCI_POSITIONFROMPOINTCLOSE(int x, int y) → position
SCI_POSITIONFROMPOINT finds the closest character position to a point and SCI_POSITIONFROMPOINTCLOSE is similar but returns -1 if the point is outside the window or not close to any characters.

-

SCI_CHARPOSITIONFROMPOINT(int x, int y)
- SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)
+

SCI_CHARPOSITIONFROMPOINT(int x, int y) → position
+ SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y) → position
SCI_CHARPOSITIONFROMPOINT finds the closest character to a point and SCI_CHARPOSITIONFROMPOINTCLOSE is similar but returns -1 if the point is outside the window or not close to any characters. This is similar to the previous methods but finds characters rather than inter-character positions.

-

SCI_POINTXFROMPOSITION(<unused>, int pos)
- SCI_POINTYFROMPOSITION(<unused>, int pos)
- These messages return the x and y display pixel location of text at position pos +

SCI_POINTXFROMPOSITION(<unused>, int pos) → int
+ SCI_POINTYFROMPOSITION(<unused>, int pos) → int
+ These messages return the x and y display pixel location of text at position pos in the document.

SCI_HIDESELECTION(bool hide)
@@ -1554,76 +1513,133 @@ struct Sci_TextToFind {

SCI_SETMOUSESELECTIONRECTANGULARSWITCH(bool mouseSelectionRectangularSwitch)
- SCI_GETMOUSESELECTIONRECTANGULARSWITCH
+ SCI_GETMOUSESELECTIONRECTANGULARSWITCH → bool
Enable or disable the ability to switch to rectangular selection mode while making a selection with the mouse. When this option is turned on, mouse selections in stream mode can be switched to rectangular mode by pressing the corresponding modifier key. They then stick to rectangular mode even when the modifier key is released again. When this option is turned off, mouse selections will always stick to the mode the selection was started in. It is off by default.

+

By character or UTF-16 code unit

+ +

Most Scintilla APIs use byte positions but some applications want to use positions based on counting + (UTF-32) characters or (UTF-16) code units + or need to communicate with other code written in terms of characters or code units. + With only byte positions, this may require examining many bytes to count characters or code units in the document + but this may be sped up in some cases by indexing the line starts by character or code unit.

+ + + SCI_POSITIONRELATIVE(int pos, int relative) → position
+ SCI_POSITIONRELATIVECODEUNITS(int pos, int relative) → position
+ SCI_COUNTCHARACTERS(int start, int end) → int
+ SCI_COUNTCODEUNITS(int start, int end) → int
+ SCI_GETLINECHARACTERINDEX → int
+ SCI_ALLOCATELINECHARACTERINDEX(int lineCharacterIndex)
+ SCI_RELEASELINECHARACTERINDEX(int lineCharacterIndex)
+ SCI_LINEFROMINDEXPOSITION(int pos, int lineCharacterIndex) → int
+ SCI_INDEXPOSITIONFROMLINE(int line, int lineCharacterIndex) → position
+
+ +

SCI_POSITIONRELATIVE(int pos, int relative) → position
+ Count a number of whole characters before or after the argument position and return that position. + The minimum position returned is 0 and the maximum is the last position in the document. + If the position goes past the document end then 0 is returned. +

+ +

SCI_COUNTCHARACTERS(int start, int end) → int
+ Returns the number of whole characters between two positions.

+ +

SCI_POSITIONRELATIVECODEUNITS(int pos, int relative) → position
+ SCI_COUNTCODEUNITS(int start, int end) → int
+ These are the UTF-16 versions of SCI_POSITIONRELATIVE and SCI_COUNTCHARACTERS + working in terms of UTF-16 code units.

+ +

SCI_GETLINECHARACTERINDEX → int
+ Returns which if any indexes are active. It may be SC_LINECHARACTERINDEX_NONE(0) or one or more + of SC_LINECHARACTERINDEX_UTF32(1) if whole characters are indexed or + SC_LINECHARACTERINDEX_UTF16(2) if UTF-16 code units are indexed. + Character indexes are currently only supported for UTF-8 documents.

+ +

SCI_ALLOCATELINECHARACTERINDEX(int lineCharacterIndex)
+ SCI_RELEASELINECHARACTERINDEX(int lineCharacterIndex)
+ Allocate or release one or more indexes using same enumeration as SCI_GETLINECHARACTERINDEX. + Different aspects of an application may need indexes for different periods and should allocate for those periods. + Indexes use additional memory so releasing them can help minimize memory but they also take time to recalculate. + Scintilla may also allocate indexes to support features like accessibility or input method editors. + Only one index of each type is created for a document at a time.

+ +

SCI_LINEFROMINDEXPOSITION(int pos, int lineCharacterIndex) → int
+ SCI_INDEXPOSITIONFROMLINE(int line, int lineCharacterIndex) → position
+ The document line of a particular character or code unit may be found by calling SCI_LINEFROMINDEXPOSITION with one of + SC_LINECHARACTERINDEX_UTF32(1) or SC_LINECHARACTERINDEX_UTF16(2). + The inverse action, finds the starting position of a document line either in characters or code units from the document start by calling + SCI_INDEXPOSITIONFROMLINE with the same lineCharacterIndex argument.

+

Multiple Selection and Virtual Space

SCI_SETMULTIPLESELECTION(bool multipleSelection)
- SCI_GETMULTIPLESELECTION
+ SCI_GETMULTIPLESELECTION → bool
SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
- SCI_GETADDITIONALSELECTIONTYPING
+ SCI_GETADDITIONALSELECTIONTYPING → bool
SCI_SETMULTIPASTE(int multiPaste)
- SCI_GETMULTIPASTE
+ SCI_GETMULTIPASTE → int
SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
- SCI_GETVIRTUALSPACEOPTIONS
+ SCI_GETVIRTUALSPACEOPTIONS → int
SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
- SCI_GETRECTANGULARSELECTIONMODIFIER
+ SCI_GETRECTANGULARSELECTIONMODIFIER → int

- SCI_GETSELECTIONS
- SCI_GETSELECTIONEMPTY
+ SCI_GETSELECTIONS → int
+ SCI_GETSELECTIONEMPTY → bool
SCI_CLEARSELECTIONS
SCI_SETSELECTION(int caret, int anchor)
SCI_ADDSELECTION(int caret, int anchor)
SCI_DROPSELECTIONN(int selection)
SCI_SETMAINSELECTION(int selection)
- SCI_GETMAINSELECTION
+ SCI_GETMAINSELECTION → int

- SCI_SETSELECTIONNCARET(int selection, int pos)
- SCI_GETSELECTIONNCARET(int selection)
+ SCI_SETSELECTIONNCARET(int selection, int caret)
+ SCI_GETSELECTIONNCARET(int selection) → position
SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)
- SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)
- SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)
- SCI_GETSELECTIONNANCHOR(int selection)
+ SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection) → int
+ SCI_SETSELECTIONNANCHOR(int selection, int anchor)
+ SCI_GETSELECTIONNANCHOR(int selection) → position
SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)
- SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)
- SCI_SETSELECTIONNSTART(int selection, int pos)
- SCI_GETSELECTIONNSTART(int selection)
- SCI_SETSELECTIONNEND(int selection, int pos)
- SCI_GETSELECTIONNEND(int selection)
+ SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → int
+ SCI_SETSELECTIONNSTART(int selection, int anchor)
+ SCI_GETSELECTIONNSTART(int selection) → position
+ SCI_SETSELECTIONNEND(int selection, int caret)
+ SCI_GETSELECTIONNEND(int selection) → position

- SCI_SETRECTANGULARSELECTIONCARET(int pos)
- SCI_GETRECTANGULARSELECTIONCARET
+ SCI_SETRECTANGULARSELECTIONCARET(int caret)
+ SCI_GETRECTANGULARSELECTIONCARET → position
SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)
- SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE
- SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)
- SCI_GETRECTANGULARSELECTIONANCHOR
+ SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE → int
+ SCI_SETRECTANGULARSELECTIONANCHOR(int anchor)
+ SCI_GETRECTANGULARSELECTIONANCHOR → position
SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)
- SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE
+ SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE → int

- SCI_SETADDITIONALSELALPHA(int alpha)
- SCI_GETADDITIONALSELALPHA
- SCI_SETADDITIONALSELFORE(int colour)
- SCI_SETADDITIONALSELBACK(int colour)
- SCI_SETADDITIONALCARETFORE(int colour)
- SCI_GETADDITIONALCARETFORE
+ SCI_SETADDITIONALSELALPHA(alpha alpha)
+ SCI_GETADDITIONALSELALPHA → int
+ SCI_SETADDITIONALSELFORE(colour fore)
+ SCI_SETADDITIONALSELBACK(colour back)
+ SCI_SETADDITIONALCARETFORE(colour fore)
+ SCI_GETADDITIONALCARETFORE → colour
SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
- SCI_GETADDITIONALCARETSBLINK
+ SCI_GETADDITIONALCARETSBLINK → bool
SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
- SCI_GETADDITIONALCARETSVISIBLE
+ SCI_GETADDITIONALCARETSVISIBLE → bool

SCI_SWAPMAINANCHORCARET
SCI_ROTATESELECTION
+ SCI_MULTIPLESELECTADDNEXT
+ SCI_MULTIPLESELECTADDEACH

@@ -1633,6 +1649,9 @@ struct Sci_TextToFind { Any selection apart from the main selection is called an additional selection. The calls in the previous section operate on the main selection. There is always at least one selection. + The selection can be simplified down to just the main selection by + SCI_CANCEL + which is normally mapped to the Esc key.

@@ -1653,44 +1672,51 @@ struct Sci_TextToFind {

SCI_SETMULTIPLESELECTION(bool multipleSelection)
- SCI_GETMULTIPLESELECTION
+ SCI_GETMULTIPLESELECTION → bool
Enable or disable multiple selection. When multiple selection is disabled, it is not possible to select multiple ranges by holding down the Ctrl key while dragging with the mouse.

SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)
- SCI_GETADDITIONALSELECTIONTYPING
- Whether typing, backspace, or delete works with multiple selections simultaneously.

+ SCI_GETADDITIONALSELECTIONTYPING → bool
+ Whether typing, new line, cursor left/right/up/down, backspace, delete, home, and end work + with multiple selections simultaneously. + Also allows selection and word and line deletion commands.

SCI_SETMULTIPASTE(int multiPaste)
- SCI_GETMULTIPASTE
+ SCI_GETMULTIPASTE → int
When pasting into multiple selections, the pasted text can go into just the main selection with SC_MULTIPASTE_ONCE=0 or into each selection with SC_MULTIPASTE_EACH=1. SC_MULTIPASTE_ONCE is the default.

- SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)
- SCI_GETVIRTUALSPACEOPTIONS
+ SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)
+ SCI_GETVIRTUALSPACEOPTIONS → int
Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. - There are two bit flags SCVS_RECTANGULARSELECTION=1 and - SCVS_USERACCESSIBLE=2 which can be set independently. + There are three bit flags SCVS_RECTANGULARSELECTION=1, + SCVS_USERACCESSIBLE=2, and + SCVS_NOWRAPLINESTART=4 which can be set independently. SCVS_NONE=0, the default, disables all use of virtual space.

+

SCVS_NOWRAPLINESTART prevents left arrow movement and selection + from wrapping to the previous line. + This is most commonly desired in conjunction with virtual space but is an independent + setting so works without virtual space.

SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)
- SCI_GETRECTANGULARSELECTIONMODIFIER
- On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set. - The three possible values are SCMOD_CTRL=2 (default), SCMOD_ALT=4 or SCMOD_SUPER=8. - Since SCMOD_ALT is often already used by a window manager, the window manager may need configuring to allow this choice. + SCI_GETRECTANGULARSELECTIONMODIFIER → int
+ On GTK+ and Qt, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set. + The three possible values are SCMOD_CTRL=2, SCMOD_ALT=4 (default) or SCMOD_SUPER=8. + Since SCMOD_ALT may already be used by a window manager, the window manager may need configuring to allow this choice. SCMOD_SUPER is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the Command key on a Mac.

- SCI_GETSELECTIONS
- Return the number of selections currently active.

+ SCI_GETSELECTIONS → int
+ Return the number of selections currently active. There is always at least one selection.

- SCI_GETSELECTIONEMPTY
+ SCI_GETSELECTIONEMPTY → bool
Return 1 if every selected range is empty else 0.

@@ -1699,11 +1725,11 @@ struct Sci_TextToFind {

SCI_SETSELECTION(int caret, int anchor)
- Set a single selection from anchor to caret as the only selection.

+ Set a single selection from anchor to caret as the only selection.

SCI_ADDSELECTION(int caret, int anchor)
- Add a new selection from anchor to caret as the main selection retaining all other + Add a new selection from anchor to caret as the main selection retaining all other selections as additional selections. Since there is always at least one selection, to set a list of selections, the first selection should be added with SCI_SETSELECTION and later selections added with SCI_ADDSELECTION

@@ -1712,51 +1738,51 @@ struct Sci_TextToFind { SCI_DROPSELECTIONN(int selection)
If there are multiple selections, remove the indicated selection. If this was the main selection then make the previous selection the main and if it was the first then the last selection becomes main. - If there is only one selection, or there is no selection selection, then there is no effect.

+ If there is only one selection, or there is no selection selection, then there is no effect.

SCI_SETMAINSELECTION(int selection)
- SCI_GETMAINSELECTION
+ SCI_GETMAINSELECTION → int
One of the selections is the main selection which is used to determine what range of text is automatically visible. The main selection may be displayed in different colours or with a differently styled caret. Only an already existing selection can be made main.

- SCI_SETSELECTIONNCARET(int selection, int pos)
- SCI_GETSELECTIONNCARET(int selection)
+ SCI_SETSELECTIONNCARET(int selection, int caret)
+ SCI_GETSELECTIONNCARET(int selection) → position
SCI_SETSELECTIONNCARETVIRTUALSPACE(int selection, int space)
- SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection)
- SCI_SETSELECTIONNANCHOR(int selection, int posAnchor)
- SCI_GETSELECTIONNANCHOR(int selection)
+ SCI_GETSELECTIONNCARETVIRTUALSPACE(int selection) → int
+ SCI_SETSELECTIONNANCHOR(int selection, int anchor)
+ SCI_GETSELECTIONNANCHOR(int selection) → position
SCI_SETSELECTIONNANCHORVIRTUALSPACE(int selection, int space)
- SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection)
+ SCI_GETSELECTIONNANCHORVIRTUALSPACE(int selection) → int
Set or query the position and amount of virtual space for the caret and anchor of each already existing selection.

- SCI_SETSELECTIONNSTART(int selection, int pos)
- SCI_GETSELECTIONNSTART(int selection)
- SCI_SETSELECTIONNEND(int selection, int pos)
- SCI_GETSELECTIONNEND(int selection)
+ SCI_SETSELECTIONNSTART(int selection, int anchor)
+ SCI_GETSELECTIONNSTART(int selection) → position
+ SCI_SETSELECTIONNEND(int selection, int caret)
+ SCI_GETSELECTIONNEND(int selection) → position
Set or query the start and end position of each already existing selection. - Mostly of use to query each range for its text.

+ Mostly of use to query each range for its text. The selection parameter is zero-based.

- SCI_SETRECTANGULARSELECTIONCARET(int pos)
- SCI_GETRECTANGULARSELECTIONCARET
+ SCI_SETRECTANGULARSELECTIONCARET(int caret)
+ SCI_GETRECTANGULARSELECTIONCARET → position
SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE(int space)
- SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE
- SCI_SETRECTANGULARSELECTIONANCHOR(int posAnchor)
- SCI_GETRECTANGULARSELECTIONANCHOR
+ SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE → int
+ SCI_SETRECTANGULARSELECTIONANCHOR(int anchor)
+ SCI_GETRECTANGULARSELECTIONANCHOR → position
SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE(int space)
- SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE
+ SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE → int
Set or query the position and amount of virtual space for the caret and anchor of the rectangular selection. After setting the rectangular selection, this is broken down into multiple selections, one for each line.

- SCI_SETADDITIONALSELALPHA(int alpha)
- SCI_GETADDITIONALSELALPHA
- SCI_SETADDITIONALSELFORE(int colour)
- SCI_SETADDITIONALSELBACK(int colour)
+ SCI_SETADDITIONALSELALPHA(alpha alpha)
+ SCI_GETADDITIONALSELALPHA → int
+ SCI_SETADDITIONALSELFORE(colour fore)
+ SCI_SETADDITIONALSELBACK(colour back)
Modify the appearance of additional selections so that they can be differentiated from the main selection which has its appearance set with SCI_SETSELALPHA, SCI_GETSELALPHA, @@ -1771,10 +1797,10 @@ struct Sci_TextToFind { and SCI_SETSELBACK will overwrite the values set by SCI_SETADDITIONALSEL* functions.

- SCI_SETADDITIONALCARETFORE(int colour)
- SCI_GETADDITIONALCARETFORE
+ SCI_SETADDITIONALCARETFORE(colour fore)
+ SCI_GETADDITIONALCARETFORE → colour
SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)
- SCI_GETADDITIONALCARETSBLINK
+ SCI_GETADDITIONALCARETSBLINK → bool
Modify the appearance of additional carets so that they can be differentiated from the main caret which has its appearance set with SCI_SETCARETFORE, SCI_GETCARETFORE, @@ -1783,43 +1809,65 @@ struct Sci_TextToFind {

SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)
- SCI_GETADDITIONALCARETSVISIBLE
+ SCI_GETADDITIONALCARETSVISIBLE → bool
Determine whether to show additional carets (defaults to true).

SCI_SWAPMAINANCHORCARET
SCI_ROTATESELECTION
+ SCI_MULTIPLESELECTADDNEXT
+ SCI_MULTIPLESELECTADDEACH
These commands may be assigned to keys to make it possible to manipulate multiple selections. SCI_SWAPMAINANCHORCARET moves the caret to the opposite end of the main selection. - SCI_ROTATESELECTION makes the next selection be the main selection. + SCI_ROTATESELECTION makes the next selection be the main selection.
+ SCI_MULTIPLESELECTADDNEXT adds the next occurrence of the main selection + within the target to the set of selections as main. If the current selection is empty then select word around caret. + The current searchFlags + are used so the application may choose case sensitivity and word search options.
+ SCI_MULTIPLESELECTADDEACH is similar to + SCI_MULTIPLESELECTADDNEXT but adds multiple occurrences instead of just one.

Scrolling and automatic scrolling

- SCI_LINESCROLL(int column, int line)
+ + SCI_SETFIRSTVISIBLELINE(int displayLine)
+ SCI_GETFIRSTVISIBLELINE → int
+ SCI_SETXOFFSET(int xOffset)
+ SCI_GETXOFFSET → int
+ SCI_LINESCROLL(int columns, int lines)
SCI_SCROLLCARET
SCI_SCROLLRANGE(int secondary, int primary)
SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)
SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)
- SCI_SETVISIBLEPOLICY(int caretPolicy, int - caretSlop)
+ SCI_SETVISIBLEPOLICY(int visiblePolicy, int + visibleSlop)
SCI_SETHSCROLLBAR(bool visible)
- SCI_GETHSCROLLBAR
+ SCI_GETHSCROLLBAR → bool
SCI_SETVSCROLLBAR(bool visible)
- SCI_GETVSCROLLBAR
- SCI_GETXOFFSET
- SCI_SETXOFFSET(int xOffset)
+ SCI_GETVSCROLLBAR → bool
SCI_SETSCROLLWIDTH(int pixelWidth)
- SCI_GETSCROLLWIDTH
+ SCI_GETSCROLLWIDTH → int
SCI_SETSCROLLWIDTHTRACKING(bool tracking)
- SCI_GETSCROLLWIDTHTRACKING
+ SCI_GETSCROLLWIDTHTRACKING → bool
SCI_SETENDATLASTLINE(bool endAtLastLine)
- SCI_GETENDATLASTLINE
+ SCI_GETENDATLASTLINE → bool
-

SCI_LINESCROLL(int column, int line)
+

SCI_SETFIRSTVISIBLELINE(int displayLine)
+ SCI_GETFIRSTVISIBLELINE → int
+ These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line + in the document is numbered 0. The value is a visible line rather than a document line.

+ +

SCI_SETXOFFSET(int xOffset)
+ SCI_GETXOFFSET → int
+ The xOffset is the horizontal scroll position in pixels of the start of the text + view. A value of 0 is the normal position with the first text column visible at the left of the + view.

+ +

SCI_LINESCROLL(int columns, int lines)
This will attempt to scroll the display by the number of columns and lines that you specify. Positive line values increase the line number at the top of the screen (i.e. they move the text upwards as far as the user is concerned), Negative line values do the reverse.

@@ -1844,16 +1892,16 @@ struct Sci_TextToFind {

SCI_SETXCARETPOLICY(int caretPolicy, int caretSlop)
SCI_SETYCARETPOLICY(int caretPolicy, int caretSlop)
- These set the caret policy. The value of caretPolicy is a combination of + These set the caret policy. The value of caretPolicy is a combination of CARET_SLOP, CARET_STRICT, CARET_JUMPS and CARET_EVEN.

- +
- + is centred on the display if caretSlop is not set, and cannot go in the UZ + if caretSlop is set. @@ -1888,8 +1936,9 @@ struct Sci_TextToFind {
CARET_SLOPIf set, we can define a slop value: caretSlop. This value defines an + If set, we can define a slop value: caretSlop. This value defines an unwanted zone (UZ) where the caret is... unwanted. This zone is defined as a number of pixels near the vertical margins, and as a number of lines near the horizontal margins. By keeping the caret away from the edges, it is seen within its context. This makes it @@ -1866,8 +1914,8 @@ struct Sci_TextToFind { CARET_STRICT If set, the policy set by CARET_SLOP is enforced... strictly. The caret - is centred on the display if caretSlop is not set, and cannot go in the UZ - if caretSlop is set.
+
- +
@@ -2092,7 +2141,7 @@ struct Sci_TextToFind {
slop
-

SCI_SETVISIBLEPOLICY(int caretPolicy, int caretSlop)
+

SCI_SETVISIBLEPOLICY(int visiblePolicy, int visibleSlop)
This determines how the vertical positioning is determined when SCI_ENSUREVISIBLEENFORCEPOLICY is called. It takes VISIBLE_SLOP and VISIBLE_STRICT flags for the policy @@ -2101,30 +2150,24 @@ struct Sci_TextToFind { caretSlop)
.

SCI_SETHSCROLLBAR(bool visible)
- SCI_GETHSCROLLBAR
+ SCI_GETHSCROLLBAR → bool
The horizontal scroll bar is only displayed if it is needed for the assumed width. If you never wish to see it, call SCI_SETHSCROLLBAR(0). Use SCI_SETHSCROLLBAR(1) to enable it again. SCI_GETHSCROLLBAR returns the current state. The default state is to display it when needed.

-

See also: SCI_SETSCROLLWIDTH.

+

See also: SCI_SETSCROLLWIDTH.

SCI_SETVSCROLLBAR(bool visible)
- SCI_GETVSCROLLBAR
+ SCI_GETVSCROLLBAR → bool
By default, the vertical scroll bar is always displayed when required. You can choose to hide or show it with SCI_SETVSCROLLBAR and get the current state with SCI_GETVSCROLLBAR.

-

SCI_SETXOFFSET(int xOffset)
- SCI_GETXOFFSET
- The xOffset is the horizontal scroll position in pixels of the start of the text - view. A value of 0 is the normal position with the first text column visible at the left of the - view.

-

See also: SCI_LINESCROLL

SCI_SETSCROLLWIDTH(int pixelWidth)
- SCI_GETSCROLLWIDTH
+ SCI_GETSCROLLWIDTH → int
For performance, Scintilla does not measure the display width of the document to determine the properties of the horizontal scroll bar. Instead, an assumed width is used. These messages set and get the document width in pixels assumed by Scintilla. @@ -2133,41 +2176,43 @@ struct Sci_TextToFind { SCI_SETSCROLLWIDTHTRACKING

SCI_SETSCROLLWIDTHTRACKING(bool tracking)
- SCI_GETSCROLLWIDTHTRACKING
+ SCI_GETSCROLLWIDTHTRACKING → bool
If scroll width tracking is enabled then the scroll width is adjusted to ensure that all of the lines currently displayed can be completely scrolled. This mode never adjusts the scroll width to be narrower.

SCI_SETENDATLASTLINE(bool endAtLastLine)
- SCI_GETENDATLASTLINE
+ SCI_GETENDATLASTLINE → bool
SCI_SETENDATLASTLINE sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.

White space

- SCI_SETVIEWWS(int wsMode)
- SCI_GETVIEWWS
+ SCI_SETVIEWWS(int viewWS)
+ SCI_GETVIEWWS → int
SCI_SETWHITESPACEFORE(bool - useWhitespaceForeColour, int colour)
+ useSetting, colour fore)
SCI_SETWHITESPACEBACK(bool - useWhitespaceBackColour, int colour)
+ useSetting, colour back)
SCI_SETWHITESPACESIZE(int size)
- SCI_GETWHITESPACESIZE
+ SCI_GETWHITESPACESIZE → int
+ SCI_SETTABDRAWMODE(int tabDrawMode)
+ SCI_GETTABDRAWMODE → int
SCI_SETEXTRAASCENT(int extraAscent)
- SCI_GETEXTRAASCENT
+ SCI_GETEXTRAASCENT → int
SCI_SETEXTRADESCENT(int extraDescent)
- SCI_GETEXTRADESCENT
+ SCI_GETEXTRADESCENT → int
-

SCI_SETVIEWWS(int wsMode)
- SCI_GETVIEWWS
+

SCI_SETVIEWWS(int viewWS)
+ SCI_GETVIEWWS → int
White space can be made visible which may be useful for languages in which white space is significant, such as Python. Space characters appear as small centred dots and tab characters as light arrows pointing to the right. There are also ways to control the display of end of line characters. The two messages set and get the - white space display mode. The wsMode argument can be one of:

+ white space display mode. The viewWS argument can be one of:

- +
@@ -2194,31 +2239,64 @@ struct Sci_TextToFind { + + + + + + + +
SCWS_INVISIBLEWhite space used for indentation is displayed normally but after the first visible character, it is shown as dots and arrows.
SCWS_VISIBLEONLYININDENT3White space used for indentation is displayed as dots and arrows.
-

The effect of using any other wsMode value is undefined.

+

The effect of using any other viewWS value is undefined.

-

SCI_SETWHITESPACEFORE(bool useWhitespaceForeColour, int colour)
- SCI_SETWHITESPACEBACK(bool useWhitespaceBackColour, int colour)
+

SCI_SETWHITESPACEFORE(bool useSetting, colour fore)
+ SCI_SETWHITESPACEBACK(bool useSetting, colour back)
By default, the colour of visible white space is determined by the lexer in use. The foreground and/or background colour of all visible white space can be set globally, overriding the lexer's colours with SCI_SETWHITESPACEFORE and SCI_SETWHITESPACEBACK.

SCI_SETWHITESPACESIZE(int size)
- SCI_GETWHITESPACESIZE
+ SCI_GETWHITESPACESIZE → int
SCI_SETWHITESPACESIZE sets the size of the dots used for mark space characters. The SCI_GETWHITESPACESIZE message retrieves the current size.

+

SCI_SETTABDRAWMODE(int tabDrawMode)
+ SCI_GETTABDRAWMODE → int
+ These two messages get and set how tab characters are drawn when white space is visible. + The tabDrawMode argument can be one of:

+ + + + + + + + + + + + + + + + + + + +
SCTD_LONGARROW0The default mode of an arrow stretching until the tabstop.
SCTD_STRIKEOUT1A horizontal line stretching until the tabstop.
+ +

The effect of using any other tabDrawMode value is undefined.

+

SCI_SETEXTRAASCENT(int extraAscent)
- SCI_GETEXTRAASCENT
+ SCI_GETEXTRAASCENT → int
SCI_SETEXTRADESCENT(int extraDescent)
- SCI_GETEXTRADESCENT
+ SCI_GETEXTRADESCENT → int
Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the baseline (its 'descent'). @@ -2228,15 +2306,17 @@ struct Sci_TextToFind {

Cursor

+ SCI_SETCURSOR(int cursorType)
+ SCI_GETCURSOR → int
-

SCI_SETCURSOR(int curType)
- SCI_GETCURSOR
+

SCI_SETCURSOR(int cursorType)
+ SCI_GETCURSOR → int
The cursor is normally chosen in a context sensitive way, so it will be different over the margin than when over the text. When performing a slow action, you may wish to change to a wait - cursor. You set the cursor type with SCI_SETCURSOR. The curType + cursor. You set the cursor type with SCI_SETCURSOR. The cursorType argument can be:

- +
@@ -2258,18 +2338,31 @@ struct Sci_TextToFind {
SC_CURSORNORMAL

Cursor values 1 through 7 have defined cursors, but only SC_CURSORWAIT is - usefully controllable. Other values of curType cause a pointer to be displayed. + usefully controllable. Other values of cursorType cause a pointer to be displayed. The SCI_GETCURSOR message returns the last cursor type you set, or SC_CURSORNORMAL (-1) if you have not set a cursor type.

Mouse capture

+ SCI_SETMOUSEDOWNCAPTURES(bool captures)
+ SCI_GETMOUSEDOWNCAPTURES → bool
+ SCI_SETMOUSEWHEELCAPTURES(bool captures)
+ SCI_GETMOUSEWHEELCAPTURES → bool

SCI_SETMOUSEDOWNCAPTURES(bool captures)
- SCI_GETMOUSEDOWNCAPTURES
+ SCI_GETMOUSEDOWNCAPTURES → bool
When the mouse is pressed inside Scintilla, it is captured so future mouse movement events are sent to Scintilla. This behaviour may be turned off with SCI_SETMOUSEDOWNCAPTURES(0).

+

SCI_SETMOUSEWHEELCAPTURES(bool captures)
+ SCI_GETMOUSEWHEELCAPTURES → bool
+ On Windows, Scintilla captures all WM_MOUSEWHEEL messages if it has the + focus, even if the mouse pointer is nowhere near the Scintilla editor window. This + behavior can be changed with SCI_SETMOUSEWHEELCAPTURES(0) so that + Scintilla passes the WM_MOUSEWHEEL messages to its parent window. + Scintilla will still react to the mouse wheel if the mouse pointer is over + the editor window.

+

Line endings

Scintilla can handle the major line end conventions and, depending on settings and @@ -2289,53 +2382,240 @@ struct Sci_TextToFind { Unicode line ends.

SCI_SETEOLMODE(int eolMode)
- SCI_GETEOLMODE
+ SCI_GETEOLMODE → int
SCI_CONVERTEOLS(int eolMode)
SCI_SETVIEWEOL(bool visible)
- SCI_GETVIEWEOL
+ SCI_GETVIEWEOL → bool
- SCI_GETLINEENDTYPESSUPPORTED
+ SCI_GETLINEENDTYPESSUPPORTED → int
SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)
- SCI_GETLINEENDTYPESALLOWED
- SCI_GETLINEENDTYPESACTIVE
+ SCI_GETLINEENDTYPESALLOWED → int
+ SCI_GETLINEENDTYPESACTIVE → int

SCI_SETEOLMODE(int eolMode)
- SCI_GETEOLMODE
+ SCI_GETEOLMODE → int
SCI_SETEOLMODE sets the characters that are added into the document when the user - presses the Enter key. You can set eolMode to one of SC_EOL_CRLF (0), + presses the Enter key. You can set eolMode to one of SC_EOL_CRLF (0), SC_EOL_CR (1), or SC_EOL_LF (2). The SCI_GETEOLMODE message retrieves the current state.

SCI_CONVERTEOLS(int eolMode)
This message changes all the end of line characters in the document to match - eolMode. Valid values are: SC_EOL_CRLF (0), SC_EOL_CR + eolMode. Valid values are: SC_EOL_CRLF (0), SC_EOL_CR (1), or SC_EOL_LF (2).

SCI_SETVIEWEOL(bool visible)
- SCI_GETVIEWEOL
+ SCI_GETVIEWEOL → bool
Normally, the end of line characters are hidden, but SCI_SETVIEWEOL allows you to - display (or hide) them by setting visible true (or + display (or hide) them by setting visible true (or false). The visible rendering of the end of line characters is similar to (CR), (LF), or (CR)(LF). SCI_GETVIEWEOL returns the current state.

-

SCI_GETLINEENDTYPESSUPPORTED
+

SCI_GETLINEENDTYPESSUPPORTED → int
SCI_GETLINEENDTYPESSUPPORTED reports the different types of line ends supported by the current lexer. This is a bit set although there is currently only a single choice with either SC_LINE_END_TYPE_DEFAULT (0) or SC_LINE_END_TYPE_UNICODE (1). These values are also used by the other messages concerned with Unicode line ends.

SCI_SETLINEENDTYPESALLOWED(int lineEndBitSet)
- SCI_GETLINEENDTYPESALLOWED
+ SCI_GETLINEENDTYPESALLOWED → int
By default, only the ASCII line ends are interpreted. Unicode line ends may be requested with SCI_SETLINEENDTYPESALLOWED(SC_LINE_END_TYPE_UNICODE) but this will be ineffective unless the lexer also allows you Unicode line ends. SCI_GETLINEENDTYPESALLOWED returns the current state.

-

SCI_GETLINEENDTYPESACTIVE
+

SCI_GETLINEENDTYPESACTIVE → int
SCI_GETLINEENDTYPESACTIVE reports the set of line ends currently interpreted by Scintilla. It is SCI_GETLINEENDTYPESSUPPORTED & SCI_GETLINEENDTYPESALLOWED.

+

Words

+ +

There is support for selecting, navigating by, and searching for words.

+ +

+ Words are contiguous sequences of characters from a particular set of characters. + 4 categories define words: word, whitespace, punctuation, and line ends with each category + having a role in word functions. + Double clicking selects the word at that point, which may be a sequence of word, punctuation, + or whitespace bytes. + Line ends are not selected by double clicking but do act as word separators. +

+ +

Words are defined in terms of characters and the sets of characters in each category can be customized to an extent. + The NUL character (0) is always a space as the APIs to set categories use NUL-terminated strings. + For single-byte encodings a category may be assigned to any character (1 to 0xFF). + For multi-byte encodings a category may be assigned to characters from 1 to 0x7F with static behaviour from 0x80. + For UTF-8, characters from 0x80 will use a category based on their Unicode general category. + For Asian encodings, code pages 932, 936, 949, 950, and 1361, characters from 0x80 are treated as word characters. +

+ +

Identifiers in programming languages are often sequences of words with capitalisation + (aCamelCaseIdentifier) or underscores (an_under_bar_ident) used to mark word boundaries. + The SCI_WORDPART* commands are used for moving between word parts: + SCI_WORDPARTLEFT, + SCI_WORDPARTLEFTEXTEND, + SCI_WORDPARTRIGHT, and + SCI_WORDPARTRIGHTEXTEND. +

+ + SCI_WORDENDPOSITION(int pos, bool onlyWordCharacters) → int
+ SCI_WORDSTARTPOSITION(int pos, bool onlyWordCharacters) → int
+ SCI_ISRANGEWORD(int start, int end) → bool
+ + SCI_SETWORDCHARS(<unused>, const char *characters)
+ SCI_GETWORDCHARS(<unused>, char *characters) → int
+ SCI_SETWHITESPACECHARS(<unused>, const char *characters)
+ SCI_GETWHITESPACECHARS(<unused>, char *characters) → int
+ SCI_SETPUNCTUATIONCHARS(<unused>, const char *characters)
+ SCI_GETPUNCTUATIONCHARS(<unused>, char *characters) → int
+ SCI_SETCHARSDEFAULT
+ +

SCI_WORDENDPOSITION(int pos, bool onlyWordCharacters) → int
+ SCI_WORDSTARTPOSITION(int pos, bool onlyWordCharacters) → int
+ These messages return the start and end of words using the same definition of words as used + internally within Scintilla. You can set your own list of characters that count as words with + SCI_SETWORDCHARS. The position + sets the start or the search, which is forwards when searching for the end and backwards when + searching for the start.

+ +

SCI_ISRANGEWORD(int start, int end) → bool
+ Is the range start..end a word or set of words? This message checks that start is at a word start transition and that + end is at a word end transition. It does not check whether there are any spaces inside the range.

+ + SCI_ISRANGEWORD(int start, int end) → bool
+ +

Set onlyWordCharacters to true (1) to stop searching at the first + non-word character in the search direction. If onlyWordCharacters is + false (0), the first character in the search direction sets the type of the search + as word or non-word and the search stops at the first non-matching character. Searches are also + terminated by the start or end of the document.

+ +

If "w" represents word characters and "." represents non-word characters and "|" represents + the position and true or false is the state of + onlyWordCharacters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Initial stateend, trueend, falsestart, truestart, false
..ww..|..ww....ww..|..ww....ww....|ww....ww..|..ww....ww|....ww..
....ww|ww........wwww|........wwww|........|wwww........|wwww....
..ww|....ww....ww|....ww....ww....|ww....|ww....ww....|ww....ww..
..ww....|ww....ww....ww|....ww....ww|....ww....|ww....ww|....ww..
+ +

SCI_SETWORDCHARS(<unused>, const char *characters)
+ This message defines which characters are members of the word category. + The character categories are set to default values before processing this function. + For example, if you don't allow '_' in your set of characters + use:
+ SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

+ +

SCI_GETWORDCHARS(<unused>, char *characters) → int
+ This fills the characters parameter with all the characters included in words. + The characters parameter must be large enough to hold all of the characters. + If the characters parameter is 0 then the length that should be allocated + to store the entire set is returned.

+ +

For multi-byte encodings, this API will not return meaningful values for 0x80 and above.

+ +

SCI_SETWHITESPACECHARS(<unused>, const char *characters)
+ SCI_GETWHITESPACECHARS(<unused>, char *characters) → int
+ Similar to SCI_SETWORDCHARS, this message allows the user to define which chars Scintilla considers + as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing + such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars + as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right. + This function should be called after SCI_SETWORDCHARS as it will + reset the whitespace characters to the default set. + SCI_GETWHITESPACECHARS behaves similarly to SCI_GETWORDCHARS.

+ +

SCI_SETPUNCTUATIONCHARS(<unused>, const char *characters)
+ SCI_GETPUNCTUATIONCHARS(<unused>, char *characters) → int
+ Similar to SCI_SETWORDCHARS and SCI_SETWHITESPACECHARS, this message + allows the user to define which chars Scintilla considers as punctuation. + SCI_GETPUNCTUATIONCHARS behaves similarly to SCI_GETWORDCHARS.

+ +

SCI_SETCHARSDEFAULT
+ Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other + characters with codes less than 0x20, with word characters set to alphanumeric and '_'. +

+ +

Word keyboard commands are:

+
    +
  • SCI_WORDLEFT
  • +
  • SCI_WORDLEFTEXTEND
  • +
  • SCI_WORDRIGHT
  • +
  • SCI_WORDRIGHTEXTEND
  • +
  • SCI_WORDLEFTEND
  • +
  • SCI_WORDLEFTENDEXTEND
  • +
  • SCI_WORDRIGHTEND
  • +
  • SCI_WORDRIGHTENDEXTEND
  • +
  • SCI_WORDPARTLEFT
  • +
  • SCI_WORDPARTLEFTEXTEND
  • +
  • SCI_WORDPARTRIGHT
  • +
  • SCI_WORDPARTRIGHTEXTEND
  • +
  • SCI_DELWORDLEFT
  • +
  • SCI_DELWORDRIGHT
  • +
  • SCI_DELWORDRIGHTEND
  • +
+

Styling

The styling messages allow you to assign styles to text. If your styling needs can be met by @@ -2348,17 +2628,19 @@ struct Sci_TextToFind { alternative, you might use idle time to style the document. Even if you use a lexer, you might use the styling commands to mark errors detected by a compiler. The following commands can be used.

- SCI_GETENDSTYLED
- SCI_STARTSTYLING(int position, int unused)
+ SCI_GETENDSTYLED → position
+ SCI_STARTSTYLING(int start, int unused)
SCI_SETSTYLING(int length, int style)
SCI_SETSTYLINGEX(int length, const char *styles)
- SCI_SETLINESTATE(int line, int value)
- SCI_GETLINESTATE(int line)
- SCI_GETMAXLINESTATE
+ SCI_SETIDLESTYLING(int idleStyling)
+ SCI_GETIDLESTYLING → int
+ SCI_SETLINESTATE(int line, int state)
+ SCI_GETLINESTATE(int line) → int
+ SCI_GETMAXLINESTATE → int
-

SCI_GETENDSTYLED
+

SCI_GETENDSTYLED → position
Scintilla keeps a record of the last character that is likely to be styled correctly. This is moved forwards when characters after it are styled and moved backwards if changes are made to the text of the document before it. Before drawing text, this position is checked to see if any @@ -2367,26 +2649,46 @@ struct Sci_TextToFind { container. The container can send SCI_GETENDSTYLED to work out where it needs to start styling. Scintilla will always ask to style whole lines.

-

SCI_STARTSTYLING(int pos, int unused)
- This prepares for styling by setting the styling position pos to start at. +

SCI_STARTSTYLING(int start, int unused)
+ This prepares for styling by setting the styling position start to start at. The unused argument was used in earlier versions but is now ignored. After SCI_STARTSTYLING, send multiple SCI_SETSTYLING messages for each - lexical entity to style.

+ lexical entity to style or send SCI_SETSTYLINGEX to style in blocks.

SCI_SETSTYLING(int length, int style)
- This message sets the style of length characters starting at the styling position - and then increases the styling position by length, ready for the next call.
+ This message sets the style of length characters starting at the styling position + and then increases the styling position by length, ready for the next call. + SCI_STARTSTYLING should be called before the first call to this.

SCI_SETSTYLINGEX(int length, const char *styles)
As an alternative to SCI_SETSTYLING, which applies the same style to each byte, - you can use this message which specifies the styles for each of length bytes from - the styling position and then increases the styling position by length, ready for - the next call.

+ you can use this message which specifies the styles for each of length bytes from + the styling position and then increases the styling position by length, ready for + the next call. + SCI_STARTSTYLING should be called before the first call to this. +

-

SCI_SETLINESTATE(int line, int value)
- SCI_GETLINESTATE(int line)
+

SCI_SETIDLESTYLING(int idleStyling)
+ SCI_GETIDLESTYLING → int
+ By default, SC_IDLESTYLING_NONE (0), + syntax styling is performed for all the currently visible text before displaying it. + On very large files, this may make scrolling down slow. + With SC_IDLESTYLING_TOVISIBLE (1), + a small amount of styling is performed before display and then + further styling is performed incrementally in the background as an idle-time task. + This may result in the text initially appearing uncoloured and then, some time later, it is coloured. + Text after the currently visible portion may be styled in the background with SC_IDLESTYLING_AFTERVISIBLE (2). + To style both before and after the visible text in the background use SC_IDLESTYLING_ALL (3). +

+

+ Since wrapping also needs to perform styling and also uses idle time, this setting has no effect when + the document is displayed wrapped. +

+ +

SCI_SETLINESTATE(int line, int state)
+ SCI_GETLINESTATE(int line) → int
As well as the 8 bits of lexical state stored for each character there is also an integer stored for each line. This can be used for longer lived parse states such as what the current scripting language is in an ASP page. Use SCI_SETLINESTATE to set the integer @@ -2394,7 +2696,7 @@ struct Sci_TextToFind { Changing the value produces a SC_MOD_CHANGELINESTATE notification.

-

SCI_GETMAXLINESTATE
+

SCI_GETMAXLINESTATE → int
This returns the last line that has any line state.

Style definition

@@ -2406,7 +2708,7 @@ struct Sci_TextToFind { predefined numbered styles starting at 32, The following STYLE_* constants are defined.

- +
@@ -2477,20 +2779,26 @@ struct Sci_TextToFind { + + + + + + + + + predefined, this is set to the style number of the last predefined style. @@ -2515,51 +2823,49 @@ struct Sci_TextToFind { style 4 for preprocessor, style 5 for operators, and so on.

SCI_STYLERESETDEFAULT
SCI_STYLECLEARALL
- SCI_STYLESETFONT(int styleNumber, char + SCI_STYLESETFONT(int style, const char *fontName)
- SCI_STYLEGETFONT(int styleNumber, char *fontName)
- SCI_STYLESETSIZE(int styleNumber, int - sizeInPoints)
- SCI_STYLEGETSIZE(int styleNumber)
- SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int - sizeInHundredthPoints)
- SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)
- SCI_STYLESETBOLD(int styleNumber, bool + SCI_STYLEGETFONT(int style, char *fontName) → int
+ SCI_STYLESETSIZE(int style, int + sizePoints)
+ SCI_STYLEGETSIZE(int style) → int
+ SCI_STYLESETSIZEFRACTIONAL(int style, int + sizeHundredthPoints)
+ SCI_STYLEGETSIZEFRACTIONAL(int style) → int
+ SCI_STYLESETBOLD(int style, bool bold)
- SCI_STYLEGETBOLD(int styleNumber)
- SCI_STYLESETWEIGHT(int styleNumber, int + SCI_STYLEGETBOLD(int style) → bool
+ SCI_STYLESETWEIGHT(int style, int weight)
- SCI_STYLEGETWEIGHT(int styleNumber)
- SCI_STYLESETITALIC(int styleNumber, bool + SCI_STYLEGETWEIGHT(int style) → int
+ SCI_STYLESETITALIC(int style, bool italic)
- SCI_STYLEGETITALIC(int styleNumber)
- SCI_STYLESETUNDERLINE(int styleNumber, bool + SCI_STYLEGETITALIC(int style) → bool
+ SCI_STYLESETUNDERLINE(int style, bool underline)
- SCI_STYLEGETUNDERLINE(int styleNumber)
- SCI_STYLESETFORE(int styleNumber, int - colour)
- SCI_STYLEGETFORE(int styleNumber)
- SCI_STYLESETBACK(int styleNumber, int - colour)
- SCI_STYLEGETBACK(int styleNumber)
- SCI_STYLESETEOLFILLED(int styleNumber, bool + SCI_STYLEGETUNDERLINE(int style) → bool
+ SCI_STYLESETFORE(int style, colour fore)
+ SCI_STYLEGETFORE(int style) → colour
+ SCI_STYLESETBACK(int style, colour back)
+ SCI_STYLEGETBACK(int style) → colour
+ SCI_STYLESETEOLFILLED(int style, bool eolFilled)
- SCI_STYLEGETEOLFILLED(int styleNumber)
- SCI_STYLESETCHARACTERSET(int styleNumber, - int charSet)
- SCI_STYLEGETCHARACTERSET(int styleNumber)
- SCI_STYLESETCASE(int styleNumber, int - caseMode)
- SCI_STYLEGETCASE(int styleNumber)
- SCI_STYLESETVISIBLE(int styleNumber, bool + SCI_STYLEGETEOLFILLED(int style) → bool
+ SCI_STYLESETCHARACTERSET(int style, + int characterSet)
+ SCI_STYLEGETCHARACTERSET(int style) → int
+ SCI_STYLESETCASE(int style, int + caseVisible)
+ SCI_STYLEGETCASE(int style) → int
+ SCI_STYLESETVISIBLE(int style, bool visible)
- SCI_STYLEGETVISIBLE(int styleNumber)
- SCI_STYLESETCHANGEABLE(int styleNumber, bool + SCI_STYLEGETVISIBLE(int style) → bool
+ SCI_STYLESETCHANGEABLE(int style, bool changeable)
- SCI_STYLEGETCHANGEABLE(int styleNumber)
- SCI_STYLESETHOTSPOT(int styleNumber, bool + SCI_STYLEGETCHANGEABLE(int style) → bool
+ SCI_STYLESETHOTSPOT(int style, bool hotspot)
- SCI_STYLEGETHOTSPOT(int styleNumber)
+ SCI_STYLEGETHOTSPOT(int style) → bool

SCI_STYLERESETDEFAULT
@@ -2574,23 +2880,23 @@ struct Sci_TextToFind { 2. Use SCI_STYLECLEARALL to copy this to all styles.
3. Set the style attributes that make your lexical styles different.

-

SCI_STYLESETFONT(int styleNumber, const char *fontName)
- SCI_STYLEGETFONT(int styleNumber, char *fontName NUL-terminated)
- SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)
- SCI_STYLEGETSIZE(int styleNumber)
- SCI_STYLESETSIZEFRACTIONAL(int styleNumber, int sizeInHundredthPoints)
- SCI_STYLEGETSIZEFRACTIONAL(int styleNumber)
- SCI_STYLESETBOLD(int styleNumber, bool bold)
- SCI_STYLEGETBOLD(int styleNumber)
- SCI_STYLESETWEIGHT(int styleNumber, int weight)
- SCI_STYLEGETWEIGHT(int styleNumber)
- SCI_STYLESETITALIC(int styleNumber, bool italic)
- SCI_STYLEGETITALIC(int styleNumber)
+

SCI_STYLESETFONT(int style, const char *fontName)
+ SCI_STYLEGETFONT(int style, char *fontName NUL-terminated) → int
+ SCI_STYLESETSIZE(int style, int sizePoints)
+ SCI_STYLEGETSIZE(int style) → int
+ SCI_STYLESETSIZEFRACTIONAL(int style, int sizeHundredthPoints)
+ SCI_STYLEGETSIZEFRACTIONAL(int style) → int
+ SCI_STYLESETBOLD(int style, bool bold)
+ SCI_STYLEGETBOLD(int style) → bool
+ SCI_STYLESETWEIGHT(int style, int weight)
+ SCI_STYLEGETWEIGHT(int style) → int
+ SCI_STYLESETITALIC(int style, bool italic)
+ SCI_STYLEGETITALIC(int style) → bool
These messages (plus SCI_STYLESETCHARACTERSET) set the font attributes that are used to match the fonts you request to those available.

The - fontName is a zero terminated string holding the name of a font. Under Windows, + fontName is a zero terminated string holding the name of a font. Under Windows, only the first 32 characters of the name are used, the name is decoded as UTF-8, and the name is not case sensitive. For internal caching, Scintilla tracks fonts by name and does care about the casing of font names, so please be consistent. @@ -2613,84 +2919,190 @@ struct Sci_TextToFind { and 1 SC_WEIGHT_BOLD.

-

SCI_STYLESETUNDERLINE(int styleNumber, bool +

SCI_STYLESETUNDERLINE(int style, bool underline)
- SCI_STYLEGETUNDERLINE(int styleNumber)
+ SCI_STYLEGETUNDERLINE(int style) → bool
You can set a style to be underlined. The underline is drawn in the foreground colour. All characters with a style that includes the underline attribute are underlined, even if they are white space.

-

SCI_STYLESETFORE(int styleNumber, int colour)
- SCI_STYLEGETFORE(int styleNumber)
- SCI_STYLESETBACK(int styleNumber, int colour)
- SCI_STYLEGETBACK(int styleNumber)
+

SCI_STYLESETFORE(int style, colour fore)
+ SCI_STYLEGETFORE(int style) → colour
+ SCI_STYLESETBACK(int style, colour back)
+ SCI_STYLEGETBACK(int style) → colour
Text is drawn in the foreground colour. The space in each character cell that is not occupied by the character is drawn in the background colour.

-

SCI_STYLESETEOLFILLED(int styleNumber, bool +

SCI_STYLESETEOLFILLED(int style, bool eolFilled)
- SCI_STYLEGETEOLFILLED(int styleNumber)
+ SCI_STYLEGETEOLFILLED(int style) → bool
If the last character in the line has a style with this attribute set, the remainder of the line up to the right edge of the window is filled with the background colour set for the last character. This is useful when a document contains embedded sections in another language such - as HTML pages with embedded JavaScript. By setting eolFilled to true + as HTML pages with embedded JavaScript. By setting eolFilled to true and a consistent background colour (different from the background colour set for the HTML styles) to all JavaScript styles then JavaScript sections will be easily distinguished from HTML.

-

SCI_STYLESETCHARACTERSET(int styleNumber, int - charSet)
- SCI_STYLEGETCHARACTERSET(int styleNumber)
+

SCI_STYLESETCHARACTERSET(int style, int + characterSet)
+ SCI_STYLEGETCHARACTERSET(int style) → int
You can set a style to use a different character set than the default. The places where such characters sets are likely to be useful are comments and literal strings. For example, SCI_STYLESETCHARACTERSET(SCE_C_STRING, SC_CHARSET_RUSSIAN) would ensure that strings in Russian would display correctly in C and C++ (SCE_C_STRING is the style number used by the C and C++ lexer to display literal strings; it has the value 6). This - feature works differently on Windows and GTK+.

+ feature works differently on Windows and GTK+.
+ The default character set is SC_CHARSET_DEFAULT.

+

SC_CHARSET_ANSI and SC_CHARSET_DEFAULT specify European Windows code page 1252 unless the code page is set.

-

The character sets supported on Windows are:
- SC_CHARSET_ANSI, SC_CHARSET_ARABIC, SC_CHARSET_BALTIC, - SC_CHARSET_CHINESEBIG5, SC_CHARSET_DEFAULT, - SC_CHARSET_EASTEUROPE, SC_CHARSET_GB2312, - SC_CHARSET_GREEK, SC_CHARSET_HANGUL, SC_CHARSET_HEBREW, - SC_CHARSET_JOHAB, SC_CHARSET_MAC, SC_CHARSET_OEM, - SC_CHARSET_RUSSIAN (code page 1251), - SC_CHARSET_SHIFTJIS, SC_CHARSET_SYMBOL, SC_CHARSET_THAI, - SC_CHARSET_TURKISH, and SC_CHARSET_VIETNAMESE.

+
STYLE_DEFAULT38 Call tips normally use the font attributes defined by STYLE_DEFAULT. - Use of SCI_CALLTIPUSESTYLE + Use of SCI_CALLTIPUSESTYLE causes call tips to use this style instead. Only the font face name, font size, foreground and background colours and character set attributes are used.
STYLE_FOLDDISPLAYTEXT39This is the style used for drawing text tags attached to folded text.
STYLE_LASTPREDEFINED 39 To make it easier for client code to discover the range of styles that are - predefined, this is set to the style number of the last predefined style. This is - currently set to 39 and the last style with an identifier is 38, which reserves space - for one future predefined style.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Character SetWindowsGTK+Cocoa
SC_CHARSET_ANSI✓ (8859-1)
SC_CHARSET_ARABIC
SC_CHARSET_BALTIC
SC_CHARSET_CHINESEBIG5
SC_CHARSET_DEFAULT✓ (8859-1)✓ (8859-1)
SC_CHARSET_EASTEUROPE
SC_CHARSET_GB2312
SC_CHARSET_GREEK
SC_CHARSET_HANGUL
SC_CHARSET_HEBREW
SC_CHARSET_JOHAB
SC_CHARSET_MAC
SC_CHARSET_OEM
SC_CHARSET_RUSSIAN✓ (cp1251)✓ (koi8-r)✓ (cp1251)
SC_CHARSET_SHIFTJIS
SC_CHARSET_SYMBOL
SC_CHARSET_THAI
SC_CHARSET_TURKISH
SC_CHARSET_VIETNAMESE
SC_CHARSET_OEM866✓ (cp866)
SC_CHARSET_CYRILLIC✓ (cp1251)✓ (cp1251)
SC_CHARSET_8859_15
-

The character sets supported on GTK+ are:
- SC_CHARSET_ANSI, SC_CHARSET_CYRILLIC (code page 1251), - SC_CHARSET_EASTEUROPE, - SC_CHARSET_GB2312, SC_CHARSET_HANGUL, - SC_CHARSET_RUSSIAN (KOI8-R), SC_CHARSET_SHIFTJIS, and - SC_CHARSET_8859_15.

- -

SCI_STYLESETCASE(int styleNumber, int caseMode)
- SCI_STYLEGETCASE(int styleNumber)
- The value of caseMode determines how text is displayed. You can set upper case - (SC_CASE_UPPER, 1) or lower case (SC_CASE_LOWER, 2) or display - normally (SC_CASE_MIXED, 0). This does not change the stored text, only how it is +

SCI_STYLESETCASE(int style, int caseVisible)
+ SCI_STYLEGETCASE(int style) → int
+ The value of caseVisible determines how text is displayed. You can set upper case + (SC_CASE_UPPER, 1) or lower case (SC_CASE_LOWER, 2) or camel case (SC_CASE_CAMEL, 3) + or display normally (SC_CASE_MIXED, 0). This does not change the stored text, only how it is displayed.

-

SCI_STYLESETVISIBLE(int styleNumber, bool visible)
- SCI_STYLEGETVISIBLE(int styleNumber)
+

SCI_STYLESETVISIBLE(int style, bool visible)
+ SCI_STYLEGETVISIBLE(int style) → bool
Text is normally visible. However, you can completely hide it by giving it a style with the - visible set to 0. This could be used to hide embedded formatting instructions or - hypertext keywords in HTML or XML.

+ visible set to 0. This could be used to hide embedded formatting instructions or + hypertext keywords in HTML or XML. + Invisible text may not be deleted by user actions but the application may delete invisible text by calling + SCI_DELETERANGE.

-

SCI_STYLESETCHANGEABLE(int styleNumber, bool +

SCI_STYLESETCHANGEABLE(int style, bool changeable)
- SCI_STYLEGETCHANGEABLE(int styleNumber)
+ SCI_STYLEGETCHANGEABLE(int style) → bool
This is an experimental and incompletely implemented style attribute. The default setting is - changeable set true but when set false it makes text - read-only. Currently it only stops the caret from being within not-changeable text and does not - yet stop deleting a range that contains not-changeable text.

+ changeable set true but when set false it makes text + read-only. The user can not move the caret within not-changeable text and not-changeable + text may not be deleted by the user. + The application may delete not-changeable text by calling + SCI_DELETERANGE.

-

SCI_STYLESETHOTSPOT(int styleNumber, bool +

SCI_STYLESETHOTSPOT(int style, bool hotspot)
- SCI_STYLEGETHOTSPOT(int styleNumber)
+ SCI_STYLEGETHOTSPOT(int style) → bool
This style is used to mark ranges of text that can detect mouse clicks. The cursor changes to a hand over hotspots, and the foreground, and background colours may change and an underline appear to indicate that these areas are sensitive to clicking. @@ -2704,71 +3116,72 @@ struct Sci_TextToFind { it was not selected. When there is no selection, the current insertion point is marked by the text caret. This is a vertical line that is normally blinking on and off to attract the users attention.

- SCI_SETSELFORE(bool useSelectionForeColour, int colour)
- SCI_SETSELBACK(bool useSelectionBackColour, int colour)
- SCI_SETSELALPHA(int alpha)
- SCI_GETSELALPHA
+ SCI_SETSELFORE(bool useSetting, colour fore)
+ SCI_SETSELBACK(bool useSetting, colour back)
+ SCI_SETSELALPHA(alpha alpha)
+ SCI_GETSELALPHA → int
SCI_SETSELEOLFILLED(bool filled)
- SCI_GETSELEOLFILLED
- SCI_SETCARETFORE(int colour)
- SCI_GETCARETFORE
+ SCI_GETSELEOLFILLED → bool
+ SCI_SETCARETFORE(colour fore)
+ SCI_GETCARETFORE → colour
SCI_SETCARETLINEVISIBLE(bool show)
- SCI_GETCARETLINEVISIBLE
- SCI_SETCARETLINEBACK(int colour)
- SCI_GETCARETLINEBACK
- SCI_SETCARETLINEBACKALPHA(int alpha)
- SCI_GETCARETLINEBACKALPHA
+ SCI_GETCARETLINEVISIBLE → bool
+ SCI_SETCARETLINEBACK(colour back)
+ SCI_GETCARETLINEBACK → colour
+ SCI_SETCARETLINEBACKALPHA(alpha alpha)
+ SCI_GETCARETLINEBACKALPHA → int
+ SCI_SETCARETLINEFRAME(int width)
+ SCI_GETCARETLINEFRAME → int
SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)
- SCI_GETCARETLINEVISIBLEALWAYS
- SCI_SETCARETPERIOD(int milliseconds)
- SCI_GETCARETPERIOD
- SCI_SETCARETSTYLE(int style)
- SCI_GETCARETSTYLE
- SCI_SETCARETWIDTH(int pixels)
- SCI_GETCARETWIDTH
- SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)
- SCI_GETHOTSPOTACTIVEFORE
- SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)
- SCI_GETHOTSPOTACTIVEBACK
+ SCI_GETCARETLINEVISIBLEALWAYS → bool
+ SCI_SETCARETPERIOD(int periodMilliseconds)
+ SCI_GETCARETPERIOD → int
+ SCI_SETCARETSTYLE(int caretStyle)
+ SCI_GETCARETSTYLE → int
+ SCI_SETCARETWIDTH(int pixelWidth)
+ SCI_GETCARETWIDTH → int
+ SCI_SETHOTSPOTACTIVEFORE(bool useSetting, colour fore)
+ SCI_GETHOTSPOTACTIVEFORE → colour
+ SCI_SETHOTSPOTACTIVEBACK(bool useSetting, colour back)
+ SCI_GETHOTSPOTACTIVEBACK → colour
SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)
- SCI_GETHOTSPOTACTIVEUNDERLINE
+ SCI_GETHOTSPOTACTIVEUNDERLINE → bool
SCI_SETHOTSPOTSINGLELINE(bool singleLine)
- SCI_GETHOTSPOTSINGLELINE
+ SCI_GETHOTSPOTSINGLELINE → bool
SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
- SCI_GETCARETSTICKY
+ SCI_GETCARETSTICKY → int
SCI_TOGGLECARETSTICKY
-

SCI_SETSELFORE(bool useSelectionForeColour, int colour)
- SCI_SETSELBACK(bool useSelectionBackColour, int colour)
+

SCI_SETSELFORE(bool useSetting, colour fore)
+ SCI_SETSELBACK(bool useSetting, colour back)
You can choose to override the default selection colouring with these two messages. The colour - you provide is used if you set useSelection*Colour to true. If it is - set to false, the default styled colouring is used and the colour + you provide is used if you set useSelection*Colour to true. If it is + set to false, the default styled colouring is used and the + fore or back argument has no effect.

-

SCI_SETSELALPHA(int alpha)
- SCI_GETSELALPHA
+

SCI_SETSELALPHA(alpha alpha)
+ SCI_GETSELALPHA → int
The selection can be drawn translucently in the selection background colour by setting an alpha value.

SCI_SETSELEOLFILLED(bool filled)
- SCI_GETSELEOLFILLED
+ SCI_GETSELEOLFILLED → bool
The selection can be drawn up to the right hand border by setting this property.

-

SCI_SETCARETFORE(int colour)
- SCI_GETCARETFORE
+

SCI_SETCARETFORE(colour fore)
+ SCI_GETCARETFORE → colour
The colour of the caret can be set with SCI_SETCARETFORE and retrieved with SCI_GETCARETFORE.

SCI_SETCARETLINEVISIBLE(bool show)
- SCI_GETCARETLINEVISIBLE
- SCI_SETCARETLINEBACK(int colour)
- SCI_GETCARETLINEBACK
- SCI_SETCARETLINEBACKALPHA(int alpha)
- SCI_GETCARETLINEBACKALPHA
+ SCI_GETCARETLINEVISIBLE → bool
+ SCI_SETCARETLINEBACK(colour back)
+ SCI_GETCARETLINEBACK → colour
+ SCI_SETCARETLINEBACKALPHA(alpha alpha)
+ SCI_GETCARETLINEBACKALPHA → int
+ SCI_SETCARETLINEFRAME(int width)
+ SCI_GETCARETLINEFRAME → int
You can choose to make the background colour of the line containing the caret different with these messages. To do this, set the desired background colour with SCI_SETCARETLINEBACK, then use SCI_SETCARETLINEVISIBLE(true) to @@ -2780,35 +3193,39 @@ struct Sci_TextToFind { through. This is done by setting the alpha (translucency) value by calling SCI_SETCARETLINEBACKALPHA. When the alpha is not SC_ALPHA_NOALPHA, the caret line is drawn after all other features so will affect the colour of all other features. + Alternatively SCI_SETCARETLINEFRAME can be used to display the caret line framed + instead of filling the whole background. Set width != 0 to enable this option and width = 0 to disable it.

SCI_SETCARETLINEVISIBLEALWAYS(bool alwaysVisible)
- SCI_GETCARETLINEVISIBLEALWAYS
+ SCI_GETCARETLINEVISIBLEALWAYS → bool
Choose to make the caret line always visible even when the window is not in focus. Default behaviour SCI_SETCARETLINEVISIBLEALWAYS(false) the caret line is only visible when the window is in focus.

-

SCI_SETCARETPERIOD(int milliseconds)
- SCI_GETCARETPERIOD
+

SCI_SETCARETPERIOD(int periodMilliseconds)
+ SCI_GETCARETPERIOD → int
The rate at which the caret blinks can be set with SCI_SETCARETPERIOD which determines the time in milliseconds that the caret is visible or invisible before changing state. Setting the period to 0 stops the caret blinking. The default value is 500 milliseconds. SCI_GETCARETPERIOD returns the current setting.

-

SCI_SETCARETSTYLE(int style)
- SCI_GETCARETSTYLE
+

SCI_SETCARETSTYLE(int caretStyle)
+ SCI_GETCARETSTYLE → int
The style of the caret can be set with SCI_SETCARETSTYLE to be a line caret - (CARETSTYLE_LINE=1), a block caret (CARETSTYLE_BLOCK=2) or to not draw at all - (CARETSTYLE_INVISIBLE=0). The default value is the line caret (CARETSTYLE_LINE=1). + (CARETSTYLE_LINE=1) or a block caret (CARETSTYLE_BLOCK=2) for insert mode combined with + a bar caret (CARETSTYLE_OVERSTRIKE_BAR=0) or a block caret (CARETSTYLE_OVERSTRIKE_BLOCK=16) for overtype mode, + or to not draw at all (CARETSTYLE_INVISIBLE=0). The default value for insert mode is the line caret (CARETSTYLE_LINE=1), + for overtype mode is the bar caret (CARETSTYLE_OVERSTRIKE_BAR=0). You can determine the current caret style setting using SCI_GETCARETSTYLE.

-

The block character draws most combining and multibyte character sequences successfully, +

The block caret draws most combining and multibyte character sequences successfully, though some fonts like Thai Fonts (and possibly others) can sometimes appear strange when the cursor is positioned at these characters, which may result in only drawing a part of the cursor character sequence. This is most notable on Windows platforms.

-

SCI_SETCARETWIDTH(int pixels)
- SCI_GETCARETWIDTH
+

SCI_SETCARETWIDTH(int pixelWidth)
+ SCI_GETCARETWIDTH → int
The width of the line caret can be set with SCI_SETCARETWIDTH to a value of 0, 1, 2 or 3 pixels. The default width is 1 pixel. You can read back the current width with SCI_GETCARETWIDTH. A width of 0 makes the caret invisible (added at version @@ -2816,22 +3233,21 @@ struct Sci_TextToFind { This setting only affects the width of the cursor when the cursor style is set to line caret mode, it does not affect the width for a block caret.

-

SCI_SETHOTSPOTACTIVEFORE(bool useHotSpotForeColour, int colour)
- SCI_GETHOTSPOTACTIVEFORE
- SCI_SETHOTSPOTACTIVEBACK(bool useHotSpotBackColour, int colour)
- SCI_GETHOTSPOTACTIVEBACK
+

SCI_SETHOTSPOTACTIVEFORE(bool useSetting, colour fore)
+ SCI_GETHOTSPOTACTIVEFORE → colour
+ SCI_SETHOTSPOTACTIVEBACK(bool useSetting, + colour back)
+ SCI_GETHOTSPOTACTIVEBACK → colour
SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)
- SCI_GETHOTSPOTACTIVEUNDERLINE
+ SCI_GETHOTSPOTACTIVEUNDERLINE → bool
SCI_SETHOTSPOTSINGLELINE(bool singleLine)
- SCI_GETHOTSPOTSINGLELINE
+ SCI_GETHOTSPOTSINGLELINE → bool
While the cursor hovers over text in a style with the hotspot attribute set, the default colouring can be modified and an underline drawn with these settings. Single line mode stops a hotspot from wrapping onto next line.

SCI_SETCARETSTICKY(int useCaretStickyBehaviour)
- SCI_GETCARETSTICKY
+ SCI_GETCARETSTICKY → int
SCI_TOGGLECARETSTICKY
These messages set, get or toggle the caretSticky setting which controls when the last position of the caret on the line is saved.

@@ -2873,14 +3289,14 @@ struct Sci_TextToFind { SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)
- SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation)
+ SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation) → int
SCI_CLEARREPRESENTATION(const char *encodedCharacter)
SCI_SETCONTROLCHARSYMBOL(int symbol)
- SCI_GETCONTROLCHARSYMBOL
+ SCI_GETCONTROLCHARSYMBOL → int

SCI_SETREPRESENTATION(const char *encodedCharacter, const char *representation)
- SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation NUL-terminated)
+ SCI_GETREPRESENTATION(const char *encodedCharacter, char *representation NUL-terminated) → int
SCI_CLEARREPRESENTATION(const char *encodedCharacter)
Any character, including those normally displayed as mnemonics may be represented by a string inverted in a rounded rectangle.

@@ -2896,7 +3312,7 @@ struct Sci_TextToFind { character is specified as an empty string.

SCI_SETCONTROLCHARSYMBOL(int symbol)
- SCI_GETCONTROLCHARSYMBOL
+ SCI_GETCONTROLCHARSYMBOL → int
The mnemonics may be replaced by a nominated symbol with an ASCII code in the range 32 to 255. If you set a symbol value less than 32, all control characters are displayed as mnemonics. The symbol you set is rendered in the font of the style set for the character. @@ -2905,10 +3321,12 @@ struct Sci_TextToFind {

Margins

-

There may be up to five margins, numbered 0 to SC_MAX_MARGIN (4) - to the left of the text display, plus a gap either side of - the text. Each margin can be set to display only symbols, line numbers, or text with SCI_SETMARGINTYPEN. +

There may be multiple margins to the left of the text display plus a gap either side of the text. + 5 margins are allocated initially numbered from 0 to SC_MAX_MARGIN (4) + but this may be changed by calling + SCI_SETMARGINS. + Each margin can be set to display only symbols, line numbers, or text with + SCI_SETMARGINTYPEN. Textual margins may also display symbols. The markers that can be displayed in each margin are set with SCN_MARGINCLICK notification to the container or + href="#SCN_MARGINCLICK">SCN_MARGINCLICK or SCN_MARGINRIGHTCLICK notification to the container or selects a line of text.

-

The margins are numbered 0 to 4. Using a margin number outside the valid range has no +

Using a margin number outside the valid range has no effect. By default, margin 0 is set to display line numbers, but is given a width of 0, so it is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it @@ -2928,58 +3347,65 @@ struct Sci_TextToFind {

Styled text margins used to show revision and blame information:

Styled text margins used to show revision and blame information

- SCI_SETMARGINTYPEN(int margin, int - type)
- SCI_GETMARGINTYPEN(int margin)
+ + SCI_SETMARGINS(int margins)
+ SCI_GETMARGINS → int
+ SCI_SETMARGINTYPEN(int margin, int marginType)
+ SCI_GETMARGINTYPEN(int margin) → int
SCI_SETMARGINWIDTHN(int margin, int pixelWidth)
- SCI_GETMARGINWIDTHN(int margin)
+ SCI_GETMARGINWIDTHN(int margin) → int
SCI_SETMARGINMASKN(int margin, int mask)
- SCI_GETMARGINMASKN(int margin)
+ SCI_GETMARGINMASKN(int margin) → int
SCI_SETMARGINSENSITIVEN(int margin, bool sensitive)
- SCI_GETMARGINSENSITIVEN(int - margin)
+ SCI_GETMARGINSENSITIVEN(int margin) → bool
SCI_SETMARGINCURSORN(int margin, int cursor)
- SCI_GETMARGINCURSORN(int - margin)
+ SCI_GETMARGINCURSORN(int margin) → int
+ SCI_SETMARGINBACKN(int margin, colour back)
+ SCI_GETMARGINBACKN(int margin) → colour
SCI_SETMARGINLEFT(<unused>, int - pixels)
- SCI_GETMARGINLEFT
+ pixelWidth)
+ SCI_GETMARGINLEFT → int
SCI_SETMARGINRIGHT(<unused>, int - pixels)
- SCI_GETMARGINRIGHT
- SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)
- SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)
- SCI_MARGINSETTEXT(int line, char *text)
- SCI_MARGINGETTEXT(int line, char *text)
+ pixelWidth)
+ SCI_GETMARGINRIGHT → int
+ SCI_SETFOLDMARGINCOLOUR(bool useSetting, colour back)
+ SCI_SETFOLDMARGINHICOLOUR(bool useSetting, colour fore)
+ SCI_MARGINSETTEXT(int line, const char *text)
+ SCI_MARGINGETTEXT(int line, char *text) → int
SCI_MARGINSETSTYLE(int line, int style)
- SCI_MARGINGETSTYLE(int line)
- SCI_MARGINSETSTYLES(int line, char *styles)
- SCI_MARGINGETSTYLES(int line, char *styles)
+ SCI_MARGINGETSTYLE(int line) → int
+ SCI_MARGINSETSTYLES(int line, const char *styles)
+ SCI_MARGINGETSTYLES(int line, char *styles) → int
SCI_MARGINTEXTCLEARALL
SCI_MARGINSETSTYLEOFFSET(int style)
- SCI_MARGINGETSTYLEOFFSET
+ SCI_MARGINGETSTYLEOFFSET → int
SCI_SETMARGINOPTIONS(int marginOptions)
- SCI_GETMARGINOPTIONS
+ SCI_GETMARGINOPTIONS → int
-

SCI_SETMARGINTYPEN(int margin, int iType)
- SCI_GETMARGINTYPEN(int margin)
+

SCI_SETMARGINS(int margins)
+ SCI_GETMARGINS → int
+ Allocate the number of margins or find the number of margins currently allocated.

+ +

SCI_SETMARGINTYPEN(int margin, int marginType)
+ SCI_GETMARGINTYPEN(int margin) → int
These two routines set and get the type of a margin. The margin argument should be 0, 1, 2, 3 or 4. You can use the predefined constants SC_MARGIN_SYMBOL (0) and SC_MARGIN_NUMBER (1) to set a margin as either a line number or a symbol margin. A margin with application defined text may use SC_MARGIN_TEXT (4) or SC_MARGIN_RTEXT (5) to right justify the text. By convention, margin 0 is used for line numbers and the next two are used for symbols. You can - also use the constants SC_MARGIN_BACK (2) and SC_MARGIN_FORE (3) for + also use the constants SC_MARGIN_BACK (2), SC_MARGIN_FORE (3), + and SC_MARGIN_COLOUR (6) for symbol margins that set their background colour to match the STYLE_DEFAULT background and - foreground colours.

+ foreground colours or a specified colour.

SCI_SETMARGINWIDTHN(int margin, int pixelWidth)
- SCI_GETMARGINWIDTHN(int margin)
+ SCI_GETMARGINWIDTHN(int margin) → int
These routines set and get the width of a margin in pixels. A margin with zero width is invisible. By default, Scintilla sets margin 1 for symbols with a width of 16 pixels, so this is a reasonable guess if you are not sure what would be appropriate. Line number margins widths @@ -2989,7 +3415,7 @@ struct Sci_TextToFind { suitable width.

SCI_SETMARGINMASKN(int margin, int mask)
- SCI_GETMARGINMASKN(int margin)
+ SCI_GETMARGINMASKN(int margin) → int
The mask is a 32-bit value. Each bit corresponds to one of 32 logical symbols that can be displayed in a margin that is enabled for symbols. There is a useful constant, SC_MASK_FOLDERS (0xFE000000 or -33554432), that is a mask for the 7 logical @@ -3016,42 +3442,47 @@ struct Sci_TextToFind {

SCI_SETMARGINSENSITIVEN(int margin, bool sensitive)
- SCI_GETMARGINSENSITIVEN(int margin)
+ SCI_GETMARGINSENSITIVEN(int margin) → bool
Each of the five margins can be set sensitive or insensitive to mouse clicks. A click in a sensitive margin sends a SCN_MARGINCLICK SCN_MARGINCLICK or SCN_MARGINRIGHTCLICK notification to the container. Margins that are not sensitive act as selection margins which make it easy to select ranges of lines. By default, all margins are insensitive.

SCI_SETMARGINCURSORN(int margin, int cursor)
- SCI_GETMARGINCURSORN(int margin)
+ SCI_GETMARGINCURSORN(int margin) → int
A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with SCI_SETMARGINCURSORN(margin, SC_CURSORARROW) or restored to a reversed arrow with SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW).

+

SCI_SETMARGINBACKN(int margin, colour back)
+ SCI_GETMARGINBACKN(int margin) → colour
+ A margin of type SC_MARGIN_COLOUR + may have its colour set with SCI_SETMARGINBACKN.

-

SCI_SETMARGINLEFT(<unused>, int pixels)
- SCI_GETMARGINLEFT
- SCI_SETMARGINRIGHT(<unused>, int pixels)
- SCI_GETMARGINRIGHT
+

SCI_SETMARGINLEFT(<unused>, int pixelWidth)
+ SCI_GETMARGINLEFT → int
+ SCI_SETMARGINRIGHT(<unused>, int pixelWidth)
+ SCI_GETMARGINRIGHT → int
These messages set and get the width of the blank margin on both sides of the text in pixels. The default is to one pixel on each side.

-

SCI_SETFOLDMARGINCOLOUR(bool useSetting, int colour)
- SCI_SETFOLDMARGINHICOLOUR(bool useSetting, int colour)
+

SCI_SETFOLDMARGINCOLOUR(bool useSetting, colour back)
+ SCI_SETFOLDMARGINHICOLOUR(bool useSetting, colour fore)
These messages allow changing the colour of the fold margin and fold margin highlight. On Windows the fold margin colour defaults to ::GetSysColor(COLOR_3DFACE) and the fold margin highlight colour to ::GetSysColor(COLOR_3DHIGHLIGHT).

- SCI_MARGINSETTEXT(int line, char *text)
- SCI_MARGINGETTEXT(int line, char *text)
+ SCI_MARGINSETTEXT(int line, const char *text)
+ SCI_MARGINGETTEXT(int line, char *text) → int
SCI_MARGINSETSTYLE(int line, int style)
- SCI_MARGINGETSTYLE(int line)
- SCI_MARGINSETSTYLES(int line, char *styles)
- SCI_MARGINGETSTYLES(int line, char *styles)
+ SCI_MARGINGETSTYLE(int line) → int
+ SCI_MARGINSETSTYLES(int line, const char *styles)
+ SCI_MARGINGETSTYLES(int line, char *styles) → int
SCI_MARGINTEXTCLEARALL
Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. A different string may be set for each line with SCI_MARGINSETTEXT. @@ -3068,19 +3499,19 @@ struct Sci_TextToFind {

SCI_MARGINSETSTYLEOFFSET(int style)
- SCI_MARGINGETSTYLEOFFSET
+ SCI_MARGINGETSTYLEOFFSET → int
Margin styles may be completely separated from standard text styles by setting a style offset. For example, SCI_MARGINSETSTYLEOFFSET(256) would allow the margin styles to be numbered from 256 up to 511 so they do not overlap styles set by lexers. Each style number set with SCI_MARGINSETSTYLE or SCI_MARGINSETSTYLES has the offset added before looking up the style.

- Always call SCI_ALLOCATEEXTENDEDSTYLES + Always call SCI_ALLOCATEEXTENDEDSTYLES before SCI_MARGINSETSTYLEOFFSET and use the result as the argument to SCI_MARGINSETSTYLEOFFSET.

SCI_SETMARGINOPTIONS(int marginOptions)
- SCI_GETMARGINOPTIONS
+ SCI_GETMARGINOPTIONS → int
Define margin options by enabling appropriate bit flags. At the moment, only one flag is available SC_MARGINOPTION_SUBLINESELECT=1, which controls how wrapped lines are selected when clicking on margin in front of them. If SC_MARGINOPTION_SUBLINESELECT is set only sub line of wrapped @@ -3101,28 +3532,28 @@ struct Sci_TextToFind {

Annotations used for inline diagnostics

- SCI_ANNOTATIONSETTEXT(int line, char *text)
- SCI_ANNOTATIONGETTEXT(int line, char *text)
+ SCI_ANNOTATIONSETTEXT(int line, const char *text)
+ SCI_ANNOTATIONGETTEXT(int line, char *text) → int
SCI_ANNOTATIONSETSTYLE(int line, int style)
- SCI_ANNOTATIONGETSTYLE(int line)
- SCI_ANNOTATIONSETSTYLES(int line, char *styles)
- SCI_ANNOTATIONGETSTYLES(int line, char *styles)
- SCI_ANNOTATIONGETLINES(int line)
+ SCI_ANNOTATIONGETSTYLE(int line) → int
+ SCI_ANNOTATIONSETSTYLES(int line, const char *styles)
+ SCI_ANNOTATIONGETSTYLES(int line, char *styles) → int
+ SCI_ANNOTATIONGETLINES(int line) → int
SCI_ANNOTATIONCLEARALL
SCI_ANNOTATIONSETVISIBLE(int visible)
- SCI_ANNOTATIONGETVISIBLE
+ SCI_ANNOTATIONGETVISIBLE → int
SCI_ANNOTATIONSETSTYLEOFFSET(int style)
- SCI_ANNOTATIONGETSTYLEOFFSET
+ SCI_ANNOTATIONGETSTYLEOFFSET → int

- SCI_ANNOTATIONSETTEXT(int line, char *text)
- SCI_ANNOTATIONGETTEXT(int line, char *text)
+ SCI_ANNOTATIONSETTEXT(int line, const char *text)
+ SCI_ANNOTATIONGETTEXT(int line, char *text) → int
SCI_ANNOTATIONSETSTYLE(int line, int style)
- SCI_ANNOTATIONGETSTYLE(int line)
- SCI_ANNOTATIONSETSTYLES(int line, char *styles)
- SCI_ANNOTATIONGETSTYLES(int line, char *styles)
- SCI_ANNOTATIONGETLINES(int line)
+ SCI_ANNOTATIONGETSTYLE(int line) → int
+ SCI_ANNOTATIONSETSTYLES(int line, const char *styles)
+ SCI_ANNOTATIONGETSTYLES(int line, char *styles) → int
+ SCI_ANNOTATIONGETLINES(int line) → int
SCI_ANNOTATIONCLEARALL
A different string may be set for each line with SCI_ANNOTATIONSETTEXT. To clear annotations call SCI_ANNOTATIONSETTEXT with a NULL pointer. @@ -3145,12 +3576,12 @@ struct Sci_TextToFind {

SCI_ANNOTATIONSETVISIBLE(int visible)
- SCI_ANNOTATIONGETVISIBLE
+ SCI_ANNOTATIONGETVISIBLE → int
Annotations can be made visible in a view and there is a choice of display style when visible. - The two messages set and get the annotation display mode. The visible + The two messages set and get the annotation display mode. The visible argument can be one of:

- +
@@ -3188,7 +3619,7 @@ struct Sci_TextToFind {

SCI_ANNOTATIONSETSTYLEOFFSET(int style)
- SCI_ANNOTATIONGETSTYLEOFFSET
+ SCI_ANNOTATIONGETSTYLEOFFSET → int
Annotation styles may be completely separated from standard text styles by setting a style offset. For example, SCI_ANNOTATIONSETSTYLEOFFSET(512) would allow the annotation styles to be numbered from 512 up to 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). @@ -3196,36 +3627,31 @@ struct Sci_TextToFind { or SCI_ANNOTATIONSETSTYLES has the offset added before looking up the style.

- Always call SCI_ALLOCATEEXTENDEDSTYLES + Always call SCI_ALLOCATEEXTENDEDSTYLES before SCI_ANNOTATIONSETSTYLEOFFSET and use the result as the argument to SCI_ANNOTATIONSETSTYLEOFFSET.

Other settings

- SCI_SETBUFFEREDDRAW(bool isBuffered)
- SCI_GETBUFFEREDDRAW
+ SCI_SETBUFFEREDDRAW(bool buffered)
+ SCI_GETBUFFEREDDRAW → bool
SCI_SETPHASESDRAW(int phases)
- SCI_GETPHASESDRAW
- SCI_SETTWOPHASEDRAW(bool twoPhase)
- SCI_GETTWOPHASEDRAW
+ SCI_GETPHASESDRAW → int
SCI_SETTECHNOLOGY(int technology)
- SCI_GETTECHNOLOGY
+ SCI_GETTECHNOLOGY → int
SCI_SETFONTQUALITY(int fontQuality)
- SCI_GETFONTQUALITY
+ SCI_GETFONTQUALITY → int
SCI_SETCODEPAGE(int codePage)
- SCI_GETCODEPAGE
+ SCI_GETCODEPAGE → int
SCI_SETIMEINTERACTION(int imeInteraction)
- SCI_GETIMEINTERACTION
- SCI_SETWORDCHARS(<unused>, const char *characters)
- SCI_GETWORDCHARS(<unused>, char *characters)
- SCI_SETWHITESPACECHARS(<unused>, const char *characters)
- SCI_GETWHITESPACECHARS(<unused>, char *characters)
- SCI_SETPUNCTUATIONCHARS(<unused>, const char *characters)
- SCI_GETPUNCTUATIONCHARS(<unused>, char *characters)
- SCI_SETCHARSDEFAULT
+ SCI_GETIMEINTERACTION → int
+ SCI_GRABFOCUS
SCI_SETFOCUS(bool focus)
- SCI_GETFOCUS
+ SCI_GETFOCUS → bool

To forward a message (WM_XXXX, WPARAM, LPARAM) to Scintilla, you can use @@ -3237,23 +3663,33 @@ struct Sci_TextToFind { collect changes to mouse settings, but could be used for other user interface items in the future).

-

SCI_SETBUFFEREDDRAW(bool isBuffered)
- SCI_GETBUFFEREDDRAW
+

SCI_SETBUFFEREDDRAW(bool buffered)
+ SCI_GETBUFFEREDDRAW → bool
These messages turn buffered drawing on or off and report the buffered drawing state. Buffered drawing draws each line into a bitmap rather than directly to the screen and then copies the bitmap to the screen. This avoids flickering although it does take longer. The default is for - drawing to be buffered.

+ drawing to be buffered on Win32 and GTK+ and to not be buffered on Cocoa and Qt. + Buffered drawing is not supported on Cocoa. +

+ +

Current platforms perform window buffering so it is almost always better for this option to be turned off. + For Win32 and GTK+, client code should turn off buffering at initialisation. + There are some older platforms and unusual modes where buffering may still be useful. +

SCI_SETPHASESDRAW(int phases)
- SCI_GETPHASESDRAW
+ SCI_GETPHASESDRAW → int
There are several orders in which the text area may be drawn offering a trade-off between speed and allowing all pixels of text to be seen even when they overlap other elements.

-

In single phase drawing (SC_PHASES_ONE) each +

In single phase drawing (SC_PHASES_ONE) each run of characters in one style is drawn along with its background. If a character overhangs the end of a run, such as in "V_" where the "V" is in a different style from the "_", then this can cause the right hand side of the "V" to be overdrawn by the background of the "_" which cuts it off.

+

+ Single phase drawing is deprecated and should not be used by applications. +

Two phase drawing (SC_PHASES_TWO) fixes this by drawing all the backgrounds of a line first and then drawing the text in transparent mode. Lines are drawn separately and no line will overlap another @@ -3271,35 +3707,29 @@ struct Sci_TextToFind { This mode is incompatible with buffered drawing and will act as SC_PHASES_TWO if buffered drawing is turned on. Multiple phase drawing is slower than two phase drawing. - Setting the layout cache to SC_CACHE_PAGE + Setting the layout cache with + + SCI_SETLAYOUTCACHE(SC_CACHE_PAGE) or higher can ensure that multiple phase drawing is not significantly slower.

-

SCI_SETTWOPHASEDRAW(bool twoPhase)
- SCI_GETTWOPHASEDRAW
- This property has been replaced with the preceding PHASESDRAW property which is more general, - allowing multiple phase drawing as well as one and two phase drawing.

-

SCI_SETTECHNOLOGY(int technology)
- SCI_GETTECHNOLOGY
+ SCI_GETTECHNOLOGY → int
The technology property allows choosing between different drawing APIs and options. On most platforms, the only choice is SC_TECHNOLOGY_DEFAULT (0). On Windows Vista or later, SC_TECHNOLOGY_DIRECTWRITE (1), - SC_TECHNOLOGY_DIRECTWRITERETAIN (2), or - SC_TECHNOLOGY_DIRECTWRITEDC (3) + SC_TECHNOLOGY_DIRECTWRITERETAIN (2), or + SC_TECHNOLOGY_DIRECTWRITEDC (3) can be chosen to use the Direct2D and DirectWrite APIs for higher quality antialiased drawing. - SC_TECHNOLOGY_DIRECTWRITERETAIN differs from + SC_TECHNOLOGY_DIRECTWRITERETAIN differs from SC_TECHNOLOGY_DIRECTWRITE by requesting that the frame is retained after being presented which may prevent drawing failures on some cards and drivers. - SC_TECHNOLOGY_DIRECTWRITEDC differs from + SC_TECHNOLOGY_DIRECTWRITEDC differs from SC_TECHNOLOGY_DIRECTWRITE by using DirectWrite to draw into a GDI DC. Since Direct2D buffers drawing, Scintilla's buffering can be turned off with - SCI_SETBUFFEREDDRAW(0). - Since SC_TECHNOLOGY_DIRECTWRITERETAIN and - SC_TECHNOLOGY_DIRECTWRITEDC - are provisional, they may be changed or removed in a future release if a better solution is found.

+ SCI_SETBUFFEREDDRAW(0).

SCI_SETFONTQUALITY(int fontQuality)
- SCI_GETFONTQUALITY
+ SCI_GETFONTQUALITY → int
Manage font quality (antialiasing method). Currently, the following values are available on Windows: SC_EFF_QUALITY_DEFAULT (backward compatible), SC_EFF_QUALITY_NON_ANTIALIASED, @@ -3309,15 +3739,16 @@ struct Sci_TextToFind { by SC_EFF_QUALITY_MASK (0xf) will be used for quality.

SCI_SETCODEPAGE(int codePage)
- SCI_GETCODEPAGE
- Scintilla has some support for Japanese, Chinese and Korean DBCS. Use this message with - codePage set to the code page number to set Scintilla to use code page information - to ensure double byte characters are treated as one character rather than two. This also stops - the caret from moving between the two bytes in a double byte character. - Do not use this message to choose between different single byte character sets: it doesn't do that. + SCI_GETCODEPAGE → int
+ Scintilla supports UTF-8, Japanese, Chinese and Korean DBCS along with single byte encodings like Latin-1. + UTF-8 (SC_CP_UTF8) is the default. Use this message with + codePage set to the code page number to set Scintilla to use code page information + to ensure multiple byte characters are treated as one character rather than multiple. This also stops + the caret from moving between the bytes in a multi-byte character. + Do not use this message to choose between different single byte character sets - use + SCI_STYLESETCHARACTERSET. Call with - codePage set to zero to disable DBCS support. The default is - SCI_SETCODEPAGE(0).

+ codePage set to zero to disable multi-byte support.

Code page SC_CP_UTF8 (65001) sets Scintilla into Unicode mode with the document treated as a sequence of characters expressed in UTF-8. The text is converted to the platform's @@ -3326,12 +3757,11 @@ struct Sci_TextToFind { horizontal space, such as Thai, will mostly work but there are some issues where the characters are drawn separately leading to visual glitches. Bi-directional text is not supported.

-

Code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), - 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab) - although these may require installation of language specific support.

+

Code page can be set to 65001 (UTF-8), 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), + 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab).

SCI_SETIMEINTERACTION(int imeInteraction)
- SCI_GETIMEINTERACTION
+ SCI_GETIMEINTERACTION → int
When entering text in Chinese, Japanese, or Korean an Input Method Editor (IME) may be displayed. The IME may be an extra window appearing above Scintilla or may be displayed by Scintilla itself as text. On some platforms there is a choice between the two techniques. @@ -3342,47 +3772,37 @@ struct Sci_TextToFind {

The windowed behaviour can be chosen with SCI_SETIMEINTERACTION(SC_IME_WINDOWED) and the inline behaviour with SCI_SETIMEINTERACTION(SC_IME_INLINE). Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.

+

When the inline IME mode is active, characters are added tentatively before being finalised and an + SCN_CHARADDED + notification is sent for each character.

-

SCI_SETWORDCHARS(<unused>, const char *characters)
- Scintilla has several functions that operate on words, which are defined to be contiguous - sequences of characters from a particular set of characters. This message defines which - characters are members of that set. The character sets are set to default values before processing this - function. - For example, if you don't allow '_' in your set of characters - use:
- SCI_SETWORDCHARS(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");

- -

SCI_GETWORDCHARS(<unused>, char *characters)
- This fills the characters parameter with all the characters included in words. - The characters parameter must be large enough to hold all of the characters. - If the characters parameter is 0 then the length that should be allocated - to store the entire set is returned.

- -

SCI_SETWHITESPACECHARS(<unused>, const char *characters)
- SCI_GETWHITESPACECHARS(<unused>, char *characters)
- Similar to SCI_SETWORDCHARS, this message allows the user to define which chars Scintilla considers - as whitespace. Setting the whitespace chars allows the user to fine-tune Scintilla's behaviour doing - such things as moving the cursor to the start or end of a word; for example, by defining punctuation chars - as whitespace, they will be skipped over when the user presses ctrl+left or ctrl+right. - This function should be called after SCI_SETWORDCHARS as it will - reset the whitespace characters to the default set. - SCI_GETWHITESPACECHARS behaves similarly to SCI_GETWORDCHARS.

- -

SCI_SETPUNCTUATIONCHARS(<unused>, const char *characters)
- SCI_GETPUNCTUATIONCHARS(<unused>, char *characters)
- Similar to SCI_SETWORDCHARS and SCI_SETWHITESPACECHARS, this message - allows the user to define which chars Scintilla considers as punctuation. - SCI_GETPUNCTUATIONCHARS behaves similarly to SCI_GETWORDCHARS.

- -

SCI_SETCHARSDEFAULT
- Use the default sets of word and whitespace characters. This sets whitespace to space, tab and other - characters with codes less than 0x20, with word characters set to alphanumeric and '_'. -

- +
+ These bidirectional features are experimental and incomplete.
+

SCI_SETBIDIRECTIONAL(int bidirectional)
+ SCI_GETBIDIRECTIONAL → int
+ Some languages, like Arabic and Hebrew, are written from right to left instead of from left to right as English is. + Documents that use multiple languages may contain both directions and this is termed "bidirectional". + The default text direction may be right to left or left to right. + Scintilla only correctly displays bidirectional text on some platforms. + Currently, there is experimental support for bidirectional text on Win32 using DirectWrite and on macOS using Cocoa. + Only UTF-8 documents will show bidirectional behaviour and only in SC_BIDIRECTIONAL_L2R mode. + Some features, such as virtual space may not work with + bidirectional text or may work only in some circumstances.

+

There are additional processing and storage costs to bidirectional text. + As some applications may not want to pay the costs, bidirectional support must be explicitly enabled by calling + SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R) (1) which chooses left to right as the default direction or + SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_R2L) (2) for default right to left. + On Win32, this should be done after setting the technology to SC_TECHNOLOGY_DIRECTWRITE, + SC_TECHNOLOGY_DIRECTWRITERETAIN, or + SC_TECHNOLOGY_DIRECTWRITEDC.

+

If the call succeeded SCI_GETBIDIRECTIONAL will return the same value otherwise + SC_BIDIRECTIONAL_DISABLED (0) is returned. +

+

SCI_GRABFOCUS
SCI_SETFOCUS(bool focus)
- SCI_GETFOCUS
+ SCI_GETFOCUS → bool
Scintilla can be told to grab the focus with this message. This is needed more on GTK+ where focus handling is more complicated than on Windows.

@@ -3391,16 +3811,15 @@ struct Sci_TextToFind { but with the need to indicate that Scintilla has the logical focus.

Brace highlighting

- SCI_BRACEHIGHLIGHT(int pos1, int - pos2)
- SCI_BRACEBADLIGHT(int pos1)
- SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
- SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
- SCI_BRACEMATCH(int position, int - maxReStyle)
+ SCI_BRACEHIGHLIGHT(int posA, int + posB)
+ SCI_BRACEBADLIGHT(int pos)
+ SCI_BRACEHIGHLIGHTINDICATOR(bool useSetting, int indicator)
+ SCI_BRACEBADLIGHTINDICATOR(bool useSetting, int indicator)
+ SCI_BRACEMATCH(int pos, int maxReStyle) → position
-

SCI_BRACEHIGHLIGHT(int pos1, int pos2)
+

SCI_BRACEHIGHLIGHT(int posA, int posB)
Up to two characters can be highlighted in a 'brace highlighting style', which is defined as style number STYLE_BRACELIGHT (34). If you have enabled indent guides, you may also wish to highlight the indent that corresponds @@ -3408,21 +3827,21 @@ struct Sci_TextToFind { href="#SCI_GETCOLUMN">SCI_GETCOLUMN and highlight the indent with SCI_SETHIGHLIGHTGUIDE.

-

SCI_BRACEBADLIGHT(int pos1)
+

SCI_BRACEBADLIGHT(int pos)
If there is no matching brace then the brace badlighting style, style STYLE_BRACEBAD (35), can be used to show the brace that is unmatched. Using a position of INVALID_POSITION (-1) removes the highlight.

-

SCI_BRACEHIGHLIGHTINDICATOR(bool useBraceHighlightIndicator, int indicatorNumber)
+

SCI_BRACEHIGHLIGHTINDICATOR(bool useSetting, int indicator)
Use specified indicator to highlight matching braces instead of changing their style.

-

SCI_BRACEBADLIGHTINDICATOR(bool useBraceBadLightIndicator, int indicatorNumber)
+

SCI_BRACEBADLIGHTINDICATOR(bool useSetting, int indicator)
Use specified indicator to highlight non matching brace instead of changing its style.

-

SCI_BRACEMATCH(int pos, int maxReStyle)
+

SCI_BRACEMATCH(int pos, int maxReStyle) → position
The SCI_BRACEMATCH message finds a corresponding matching brace given - pos, the position of one brace. The brace characters handled are '(', ')', '[', + pos, the position of one brace. The brace characters handled are '(', ')', '[', ']', '{', '}', '<', and '>'. The search is forwards from an opening brace and backwards from a closing brace. If the character at position is not a brace character, or a matching brace cannot be found, the return value is -1. Otherwise, the return value is the position of @@ -3430,7 +3849,7 @@ struct Sci_TextToFind {

A match only occurs if the style of the matching brace is the same as the starting brace or the matching brace is beyond the end of styling. Nested braces are handled correctly. The - maxReStyle parameter must currently be 0 - it may be used in the future to limit + maxReStyle parameter must currently be 0 - it may be used in the future to limit the length of brace searches.

Tabs and Indentation Guides

@@ -3449,40 +3868,39 @@ struct Sci_TextToFind { inserting a tab at the current character position and backspace unindents the line rather than deleting a character. Scintilla can also display indentation guides (vertical lines) to help you to generate code.

- SCI_SETTABWIDTH(int widthInChars)
- SCI_GETTABWIDTH
+ SCI_SETTABWIDTH(int tabWidth)
+ SCI_GETTABWIDTH → int
SCI_CLEARTABSTOPS(int line)
SCI_ADDTABSTOP(int line, int x)
- SCI_GETNEXTTABSTOP(int line, int x)
+ SCI_GETNEXTTABSTOP(int line, int x) → int
SCI_SETUSETABS(bool useTabs)
- SCI_GETUSETABS
- SCI_SETINDENT(int widthInChars)
- SCI_GETINDENT
+ SCI_GETUSETABS → bool
+ SCI_SETINDENT(int indentSize)
+ SCI_GETINDENT → int
SCI_SETTABINDENTS(bool tabIndents)
- SCI_GETTABINDENTS
+ SCI_GETTABINDENTS → bool
SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)
- SCI_GETBACKSPACEUNINDENTS
+ SCI_GETBACKSPACEUNINDENTS → bool
SCI_SETLINEINDENTATION(int line, int indentation)
- SCI_GETLINEINDENTATION(int line)
- SCI_GETLINEINDENTPOSITION(int - line)
+ SCI_GETLINEINDENTATION(int line) → int
+ SCI_GETLINEINDENTPOSITION(int line) → position
SCI_SETINDENTATIONGUIDES(int indentView)
- SCI_GETINDENTATIONGUIDES
+ SCI_GETINDENTATIONGUIDES → int
SCI_SETHIGHLIGHTGUIDE(int column)
- SCI_GETHIGHLIGHTGUIDE
+ SCI_GETHIGHLIGHTGUIDE → int
-

SCI_SETTABWIDTH(int widthInChars)
- SCI_GETTABWIDTH
+

SCI_SETTABWIDTH(int tabWidth)
+ SCI_GETTABWIDTH → int
SCI_SETTABWIDTH sets the size of a tab as a multiple of the size of a space character in STYLE_DEFAULT. The default tab width is 8 characters. There are no limits on tab sizes, but values less than 1 or large values may have undesirable effects.

SCI_CLEARTABSTOPS(int line)
SCI_ADDTABSTOP(int line, int x)
- SCI_GETNEXTTABSTOP(int line, int x)
+ SCI_GETNEXTTABSTOP(int line, int x) → int
SCI_CLEARTABSTOPS clears explicit tabstops on a line. SCI_ADDTABSTOP adds an explicit tabstop at the specified distance from the left (in pixels), and SCI_GETNEXTTABSTOP gets the next explicit tabstop position set after the given x position, @@ -3491,14 +3909,14 @@ struct Sci_TextToFind {

SCI_SETUSETABS(bool useTabs)
- SCI_GETUSETABS
+ SCI_GETUSETABS → bool
SCI_SETUSETABS determines whether indentation should be created out of a mixture - of tabs and spaces or be based purely on spaces. Set useTabs to false + of tabs and spaces or be based purely on spaces. Set useTabs to false (0) to create all tabs and indents out of spaces. The default is true. You can use SCI_GETCOLUMN to get the column of a position taking the width of a tab into account.

-

SCI_SETINDENT(int widthInChars)
- SCI_GETINDENT
+

SCI_SETINDENT(int indentSize)
+ SCI_GETINDENT → int
SCI_SETINDENT sets the size of indentation in terms of the width of a space in STYLE_DEFAULT. If you set a width of 0, the indent size is the same as the tab size. There are no limits on indent sizes, but values @@ -3506,9 +3924,9 @@ struct Sci_TextToFind {

SCI_SETTABINDENTS(bool tabIndents)
- SCI_GETTABINDENTS
+ SCI_GETTABINDENTS → bool
SCI_SETBACKSPACEUNINDENTS(bool bsUnIndents)
- SCI_GETBACKSPACEUNINDENTS
+ SCI_GETBACKSPACEUNINDENTS → bool

Inside indentation white space, the tab and backspace keys can be made to indent and @@ -3516,16 +3934,16 @@ struct Sci_TextToFind { SCI_SETTABINDENTS and SCI_SETBACKSPACEUNINDENTS functions.

SCI_SETLINEINDENTATION(int line, int indentation)
- SCI_GETLINEINDENTATION(int line)
+ SCI_GETLINEINDENTATION(int line) → int
The amount of indentation on a line can be discovered and set with SCI_GETLINEINDENTATION and SCI_SETLINEINDENTATION. The indentation is measured in character columns, which correspond to the width of space characters.

-

SCI_GETLINEINDENTPOSITION(int line)
+

SCI_GETLINEINDENTPOSITION(int line) → position
This returns the position at the end of indentation of a line.

SCI_SETINDENTATIONGUIDES(int indentView)
- SCI_GETINDENTATIONGUIDES
+ SCI_GETINDENTATIONGUIDES → int
Indentation guides are dotted vertical lines that appear within indentation white space every indent size columns. They make it easy to see which constructs line up especially when they extend over multiple pages. Style There are 4 indentation guide views. SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on empty lines.

-
ANNOTATION_HIDDEN
+
@@ -3566,10 +3984,10 @@ struct Sci_TextToFind {
SC_IV_NONE

SCI_SETHIGHLIGHTGUIDE(int column)
- SCI_GETHIGHLIGHTGUIDE
+ SCI_GETHIGHLIGHTGUIDE → int
When brace highlighting occurs, the indentation guide corresponding to the braces may be highlighted with the brace highlighting style,
STYLE_BRACELIGHT (34). Set column to 0 to + href="#StyleDefinition">STYLE_BRACELIGHT (34). Set column to 0 to cancel this highlight.

Markers

@@ -3596,41 +4014,36 @@ struct Sci_TextToFind { their line moves. When a line is deleted, its markers are combined, by an OR operation, with the markers of the next line.

SCI_MARKERDEFINE(int markerNumber, int - markerSymbols)
+ markerSymbol)
SCI_MARKERDEFINEPIXMAP(int markerNumber, - const char *xpm)
+ const char *pixmap)
SCI_RGBAIMAGESETWIDTH(int width)
SCI_RGBAIMAGESETHEIGHT(int height)
SCI_RGBAIMAGESETSCALE(int scalePercent)
SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)
- SCI_MARKERSYMBOLDEFINED(int markerNumber) -
- SCI_MARKERSETFORE(int markerNumber, int - colour)
- SCI_MARKERSETBACK(int markerNumber, int - colour)
- SCI_MARKERSETBACKSELECTED(int markerNumber, int - colour)
- SCI_MARKERENABLEHIGHLIGHT(int enabled)
- SCI_MARKERSETALPHA(int markerNumber, int - alpha)
- SCI_MARKERADD(int line, int markerNumber)
- SCI_MARKERADDSET(int line, int markerMask)
+ SCI_MARKERSYMBOLDEFINED(int markerNumber) → int
+ SCI_MARKERSETFORE(int markerNumber, colour + fore)
+ SCI_MARKERSETBACK(int markerNumber, colour + back)
+ SCI_MARKERSETBACKSELECTED(int markerNumber, colour + back)
+ SCI_MARKERENABLEHIGHLIGHT(bool enabled)
+ SCI_MARKERSETALPHA(int markerNumber, alpha alpha)
+ SCI_MARKERADD(int line, int markerNumber) → int
+ SCI_MARKERADDSET(int line, int markerSet)
SCI_MARKERDELETE(int line, int markerNumber)
SCI_MARKERDELETEALL(int markerNumber)
- SCI_MARKERGET(int line)
- SCI_MARKERNEXT(int lineStart, int - markerMask)
- SCI_MARKERPREVIOUS(int lineStart, int - markerMask)
- SCI_MARKERLINEFROMHANDLE(int - handle)
- SCI_MARKERDELETEHANDLE(int handle)
+ SCI_MARKERGET(int line) → int
+ SCI_MARKERNEXT(int lineStart, int markerMask) → int
+ SCI_MARKERPREVIOUS(int lineStart, int markerMask) → int
+ SCI_MARKERLINEFROMHANDLE(int markerHandle) → int
+ SCI_MARKERDELETEHANDLE(int markerHandle)
-

SCI_MARKERDEFINE(int markerNumber, int markerSymbols)
+

SCI_MARKERDEFINE(int markerNumber, int markerSymbol)
This message associates a marker number in the range 0 to 31 with one of the marker symbols or an ASCII character. The general-purpose marker symbols currently available are:
SC_MARK_CIRCLE, @@ -3698,7 +4111,7 @@ struct Sci_TextToFind { Macintosh), plus/minus shows folded lines as '+' and opened folds as '-', Circle tree, Box tree.

- +
@@ -3802,7 +4215,7 @@ struct Sci_TextToFind {

Marker samples

SCI_MARKERDEFINEPIXMAP(int markerNumber, const char - *xpm)
+ *pixmap)
Markers can be set to pixmaps with this message. The XPM format is used for the pixmap. Pixmaps use the SC_MARK_PIXMAP marker symbol.

@@ -3821,38 +4234,35 @@ struct Sci_TextToFind { The default scale, 100, will stretch each image pixel to cover 4 screen pixels on a retina display.

Pixmaps use the SC_MARK_RGBAIMAGE marker symbol.

-

SCI_MARKERSYMBOLDEFINED(int markerNumber)
+

SCI_MARKERSYMBOLDEFINED(int markerNumber) → int
Returns the symbol defined for a markerNumber with SCI_MARKERDEFINE or SC_MARK_PIXMAP if defined with SCI_MARKERDEFINEPIXMAP or SC_MARK_RGBAIMAGE if defined with SCI_MARKERDEFINERGBAIMAGE.

-

SCI_MARKERSETFORE(int markerNumber, int colour)
- SCI_MARKERSETBACK(int markerNumber, int colour)
+

SCI_MARKERSETFORE(int markerNumber, colour fore)
+ SCI_MARKERSETBACK(int markerNumber, colour back)
These two messages set the foreground and background colour of a marker number.
- SCI_MARKERSETBACKSELECTED(int markerNumber, int colour)
+ SCI_MARKERSETBACKSELECTED(int markerNumber, colour back)
This message sets the highlight background colour of a marker number when its folding block is selected. The default colour is #FF0000.

SCI_MARKERENABLEHIGHLIGHT(bool enabled)
This message allows to enable/disable the highlight folding block when it is selected. (i.e. block that contains the caret)

-

SCI_MARKERSETALPHA(int markerNumber, int alpha)
+

SCI_MARKERSETALPHA(int markerNumber, + alpha alpha)
When markers are drawn in the content area, either because there is no margin for them or they are of SC_MARK_BACKGROUND or SC_MARK_UNDERLINE types, they may be drawn translucently by setting an alpha value.

-

SCI_MARKERADD(int line, int markerNumber)
- This message adds marker number markerNumber to a line. The message returns -1 if +

SCI_MARKERADD(int line, int markerNumber) → int
+ This message adds marker number markerNumber to a line. The message returns -1 if this fails (illegal line number, out of memory) or it returns a marker handle number that - identifies the added marker. You can use this returned handle with SCI_MARKERLINEFROMHANDLE to find where a marker is after moving or combining lines and with SCI_MARKERDELETEHANDLE to delete the marker based on its handle. The message does not check the value of markerNumber, nor does it check if the line already contains the marker.

-

SCI_MARKERADDSET(int line, int markerMask)
+

SCI_MARKERADDSET(int line, int markerSet)
This message can add one or more markers to a line with a single call, specified in the same "one-bit-per-marker" 32-bit integer format returned by SCI_MARKERGET (and used by the mask-based marker search functions @@ -3872,28 +4282,28 @@ struct Sci_TextToFind { This removes markers of the given number from all lines. If markerNumber is -1, it deletes all markers from all lines.

-

SCI_MARKERGET(int line)
+

SCI_MARKERGET(int line) → int
This returns a 32-bit integer that indicates which markers were present on the line. Bit 0 is set if marker 0 is present, bit 1 for marker 1 and so on.

-

SCI_MARKERNEXT(int lineStart, int markerMask)
- SCI_MARKERPREVIOUS(int lineStart, int markerMask)
+

SCI_MARKERNEXT(int lineStart, int markerMask) → int
+ SCI_MARKERPREVIOUS(int lineStart, int markerMask) → int
These messages search efficiently for lines that include a given set of markers. The search - starts at line number lineStart and continues forwards to the end of the file + starts at line number lineStart and continues forwards to the end of the file (SCI_MARKERNEXT) or backwards to the start of the file - (SCI_MARKERPREVIOUS). The markerMask argument should have one bit set + (SCI_MARKERPREVIOUS). The markerMask argument should have one bit set for each marker you wish to find. Set bit 0 to find marker 0, bit 1 for marker 1 and so on. The message returns the line number of the first line that contains one of the markers in - markerMask or -1 if no marker is found.

+ markerMask or -1 if no marker is found.

-

SCI_MARKERLINEFROMHANDLE(int markerHandle)
- The markerHandle argument is an identifier for a marker returned by SCI_MARKERLINEFROMHANDLE(int markerHandle) → int
+ The markerHandle argument is an identifier for a marker returned by
SCI_MARKERADD. This function searches the document for the marker with this handle and returns the line number that contains it or -1 if it is not found.

SCI_MARKERDELETEHANDLE(int markerHandle)
- The markerHandle argument is an identifier for a marker returned by markerHandle argument is an identifier for a marker returned by SCI_MARKERADD. This function searches the document for the marker with this handle and deletes the marker if it is found.

@@ -3911,7 +4321,7 @@ struct Sci_TextToFind { They may also be invisible when used to track pieces of content for the application as INDIC_HIDDEN.

The SCI_INDIC* messages allow you to get and set the visual appearance of the - indicators. They all use an indicatorNumber argument in the range 0 to INDIC_MAX(35) + indicators. They all use an indicator argument in the range 0 to INDIC_MAX(35) to set the indicator to style. To prevent interference the set of indicators is divided up into a range for use by lexers (0..7) a range for use by containers (8=INDIC_CONTAINER .. 31=INDIC_IME-1) @@ -3919,8 +4329,9 @@ struct Sci_TextToFind {

Indicators are stored in a format similar to run length encoding which is efficient in both speed and storage for sparse information.

-

An indicator may store different values for each range but currently all values are drawn the same. - In the future, it may be possible to draw different values in different styles.

+

An indicator may store different values for each range but normally all values are drawn the same. + The SCI_INDICSETFLAGS + API may be used to display different colours for different values.

Originally, Scintilla used a different technique for indicators but this has been removed @@ -3928,53 +4339,53 @@ struct Sci_TextToFind { While both techniques were supported, the term "modern indicators" was used for the newer implementation.

- SCI_INDICSETSTYLE(int indicatorNumber, int + SCI_INDICSETSTYLE(int indicator, int indicatorStyle)
- SCI_INDICGETSTYLE(int indicatorNumber)
- SCI_INDICSETFORE(int indicatorNumber, int - colour)
- SCI_INDICGETFORE(int indicatorNumber)
- SCI_INDICSETALPHA(int indicatorNumber, int alpha)
- SCI_INDICGETALPHA(int indicatorNumber)
- SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
- SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
- SCI_INDICSETUNDER(int indicatorNumber, bool under)
- SCI_INDICGETUNDER(int indicatorNumber)
- SCI_INDICSETHOVERSTYLE(int indicatorNumber, int + SCI_INDICGETSTYLE(int indicator) → int
+ SCI_INDICSETFORE(int indicator, colour + fore)
+ SCI_INDICGETFORE(int indicator) → colour
+ SCI_INDICSETALPHA(int indicator, alpha alpha)
+ SCI_INDICGETALPHA(int indicator) → int
+ SCI_INDICSETOUTLINEALPHA(int indicator, alpha alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicator) → int
+ SCI_INDICSETUNDER(int indicator, bool under)
+ SCI_INDICGETUNDER(int indicator) → bool
+ SCI_INDICSETHOVERSTYLE(int indicator, int indicatorStyle)
- SCI_INDICGETHOVERSTYLE(int indicatorNumber)
- SCI_INDICSETHOVERFORE(int indicatorNumber, int - colour)
- SCI_INDICGETHOVERFORE(int indicatorNumber)
- SCI_INDICSETFLAGS(int indicatorNumber, int flags)
- SCI_INDICGETFLAGS(int indicatorNumber)
+ SCI_INDICGETHOVERSTYLE(int indicator) → int
+ SCI_INDICSETHOVERFORE(int indicator, colour + fore)
+ SCI_INDICGETHOVERFORE(int indicator) → colour
+ SCI_INDICSETFLAGS(int indicator, int flags)
+ SCI_INDICGETFLAGS(int indicator) → int

SCI_SETINDICATORCURRENT(int indicator)
- SCI_GETINDICATORCURRENT
+ SCI_GETINDICATORCURRENT → int
SCI_SETINDICATORVALUE(int value)
- SCI_GETINDICATORVALUE
- SCI_INDICATORFILLRANGE(int position, int fillLength)
- SCI_INDICATORCLEARRANGE(int position, int clearLength)
- SCI_INDICATORALLONFOR(int position)
- SCI_INDICATORVALUEAT(int indicator, int position)
- SCI_INDICATORSTART(int indicator, int position)
- SCI_INDICATOREND(int indicator, int position)
+ SCI_GETINDICATORVALUE → int
+ SCI_INDICATORFILLRANGE(int start, int lengthFill)
+ SCI_INDICATORCLEARRANGE(int start, int lengthClear)
+ SCI_INDICATORALLONFOR(int pos) → int
+ SCI_INDICATORVALUEAT(int indicator, int pos) → int
+ SCI_INDICATORSTART(int indicator, int pos) → int
+ SCI_INDICATOREND(int indicator, int pos) → int
SCI_FINDINDICATORSHOW(int start, int end)
SCI_FINDINDICATORFLASH(int start, int end)
SCI_FINDINDICATORHIDE
-

SCI_INDICSETSTYLE(int indicatorNumber, int +

SCI_INDICSETSTYLE(int indicator, int indicatorStyle)
- SCI_INDICGETSTYLE(int indicatorNumber)
+ SCI_INDICGETSTYLE(int indicator) → int
These two messages set and get the style for a particular indicator. The indicator styles currently available are:
Indicator samples

-
SC_MARKNUM_*
+
@@ -4049,8 +4460,8 @@ struct Sci_TextToFind { @@ -4061,8 +4472,8 @@ struct Sci_TextToFind { @@ -4109,12 +4520,29 @@ struct Sci_TextToFind { + + + + + + + + + + + + + + + + @@ -4154,6 +4582,22 @@ struct Sci_TextToFind { + + + + + + + + + + + + + + + +
SymbolA rectangle with rounded corners around the text using translucent drawing with the interior usually more transparent than the border. You can use - SCI_INDICSETALPHA and - SCI_INDICSETOUTLINEALPHA + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour.
A rectangle around the text using translucent drawing with the interior usually more transparent than the border. You can use - SCI_INDICSETALPHA and - SCI_INDICSETOUTLINEALPHA + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA to control the alpha transparency values. The default alpha values are 30 for fill colour and 50 for outline colour. This indicator does not colour the top pixel of the line so that indicators on contiguous lines are visually distinct and disconnected.A dotted rectangle around the text using translucent drawing. Translucency alternates between the alpha and outline alpha settings with the top-left pixel using the alpha setting. - SCI_INDICSETALPHA and - SCI_INDICSETOUTLINEALPHA + SCI_INDICSETALPHA and + SCI_INDICSETOUTLINEALPHA control the alpha transparency values. The default values are 30 for alpha and 50 for outline alpha. To avoid excessive memory allocation the maximum width of a dotted box is 4000 pixels.
INDIC_GRADIENT20A vertical gradient between a colour and alpha at top to fully transparent at bottom.
INDIC_GRADIENTCENTRE21A vertical gradient with the specified colour and alpha in the middle + fading to fully transparent at top and bottom.
INDIC_SQUIGGLEPIXMAPChange the colour of the text to the indicator's fore colour.
INDIC_POINT18Draw a triangle below the start of the indicator range.
INDIC_POINTCHARACTER19Draw a triangle below the centre of the first character of the indicator range.
@@ -4162,94 +4606,94 @@ struct Sci_TextToFind { SCI_INDICSETSTYLE(1, INDIC_TT);
SCI_INDICSETSTYLE(2, INDIC_PLAIN);

-

SCI_INDICSETFORE(int indicatorNumber, int colour)
- SCI_INDICGETFORE(int indicatorNumber)
+

SCI_INDICSETFORE(int indicator, colour fore)
+ SCI_INDICGETFORE(int indicator) → colour
These two messages set and get the colour used to draw an indicator. The default indicator colours are equivalent to:
SCI_INDICSETFORE(0, 0x007f00); (dark green)
SCI_INDICSETFORE(1, 0xff0000); (light blue)
SCI_INDICSETFORE(2, 0x0000ff); (light red)

-

SCI_INDICSETALPHA(int indicatorNumber, int alpha)
- SCI_INDICGETALPHA(int indicatorNumber)
+

SCI_INDICSETALPHA(int indicator, alpha alpha)
+ SCI_INDICGETALPHA(int indicator) → int
These two messages set and get the alpha transparency used for drawing the fill colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from 0 (completely transparent) to 255 (no transparency).

-

SCI_INDICSETOUTLINEALPHA(int indicatorNumber, int alpha)
- SCI_INDICGETOUTLINEALPHA(int indicatorNumber)
+

SCI_INDICSETOUTLINEALPHA(int indicator, alpha alpha)
+ SCI_INDICGETOUTLINEALPHA(int indicator) → int
These two messages set and get the alpha transparency used for drawing the outline colour of the INDIC_ROUNDBOX and INDIC_STRAIGHTBOX rectangle. The alpha value can range from 0 (completely transparent) to 255 (no transparency).

-

SCI_INDICSETUNDER(int indicatorNumber, bool under)
- SCI_INDICGETUNDER(int indicatorNumber)
+

SCI_INDICSETUNDER(int indicator, bool under)
+ SCI_INDICGETUNDER(int indicator) → bool
These two messages set and get whether an indicator is drawn under text or over(default). - Drawing under text works only for indicators when two phase drawing - is enabled.

+ Drawing under text does not work with the deprecated single phase drawing + mode.

-

SCI_INDICSETHOVERSTYLE(int indicatorNumber, int +

SCI_INDICSETHOVERSTYLE(int indicator, int indicatorStyle)
- SCI_INDICGETHOVERSTYLE(int indicatorNumber)
- SCI_INDICSETHOVERFORE(int indicatorNumber, int colour)
- SCI_INDICGETHOVERFORE(int indicatorNumber)
+ SCI_INDICGETHOVERSTYLE(int indicator) → int
+ SCI_INDICSETHOVERFORE(int indicator, colour fore)
+ SCI_INDICGETHOVERFORE(int indicator) → colour
These messages set and get the colour and style used to draw indicators when the mouse is over them or the caret moved into them. - The mouse cursor also changes when an indicator is drawn in hover style. + The mouse cursor also changes when an indicator is drawn in hover style. The default is for the hover appearance to be the same as the normal appearance and calling - SCI_INDICSETFORE or - SCI_INDICSETSTYLE will + SCI_INDICSETFORE or + SCI_INDICSETSTYLE will also reset the hover attribute.

-

SCI_INDICSETFLAGS(int indicatorNumber, int flags)
- SCI_INDICGETFLAGS(int indicatorNumber)
+

SCI_INDICSETFLAGS(int indicator, int flags)
+ SCI_INDICGETFLAGS(int indicator) → int
These messages set and get the flags associated with an indicator. There is currently one flag defined, SC_INDICFLAG_VALUEFORE: when this flag is set the colour used by the indicator is not from the indicator's fore setting but instead from the value of the indicator at that point in the file. This allows many colours to be displayed for a single indicator. The value is an RGB integer colour that has been ored with SC_INDICVALUEBIT(0x1000000) - when calling SCI_SETINDICATORVALUE. + when calling SCI_SETINDICATORVALUE. To find the colour from the value, and the value with SC_INDICVALUEMASK(0xFFFFFF).

SCI_SETINDICATORCURRENT(int indicator)
- SCI_GETINDICATORCURRENT
+ SCI_GETINDICATORCURRENT → int
These two messages set and get the indicator that will be affected by calls to - SCI_INDICATORFILLRANGE(int position, int fillLength) and - SCI_INDICATORCLEARRANGE(int position, int clearLength). + SCI_INDICATORFILLRANGE(int start, int lengthFill) and + SCI_INDICATORCLEARRANGE(int start, int lengthClear).

SCI_SETINDICATORVALUE(int value)
- SCI_GETINDICATORVALUE
+ SCI_GETINDICATORVALUE → int
These two messages set and get the value that will be set by calls to - SCI_INDICATORFILLRANGE. + SCI_INDICATORFILLRANGE.

- SCI_INDICATORFILLRANGE(int position, int fillLength)
- SCI_INDICATORCLEARRANGE(int position, int clearLength)
+ SCI_INDICATORFILLRANGE(int start, int lengthFill)
+ SCI_INDICATORCLEARRANGE(int start, int lengthClear)
These two messages fill or clear a range for the current indicator. SCI_INDICATORFILLRANGE fills with the the current value.

- SCI_INDICATORALLONFOR(int position)
+ SCI_INDICATORALLONFOR(int pos) → int
Retrieve a bitmap value representing which indicators are non-zero at a position. Only the first 32 indicators are represented in the result so no IME indicators are included.

- SCI_INDICATORVALUEAT(int indicator, int position)
+ SCI_INDICATORVALUEAT(int indicator, int pos) → int
Retrieve the value of a particular indicator at a position.

- SCI_INDICATORSTART(int indicator, int position)
- SCI_INDICATOREND(int indicator, int position)
+ SCI_INDICATORSTART(int indicator, int pos) → int
+ SCI_INDICATOREND(int indicator, int pos) → int
Find the start or end of a range with one value from a position within the range. Can be used to iterate through the document to discover all the indicator positions.

@@ -4296,63 +4740,64 @@ struct Sci_TextToFind {

When the user makes a selection from the list the container is sent a SCN_AUTOCSELECTION notification message. On return from the notification Scintilla will insert - the selected text unless the autocompletion list has been cancelled, for example by the container sending - SCI_AUTOCCANCEL.

+ the selected text and the container is sent a SCN_AUTOCCOMPLETED notification message unless the autocompletion list has been cancelled, for example by the container sending + SCI_AUTOCCANCEL.

To make use of autocompletion you must monitor each character added to the document. See SciTEBase::CharAdded() in SciTEBase.cxx for an example of autocompletion.

- SCI_AUTOCSHOW(int lenEntered, const char - *list)
+ SCI_AUTOCSHOW(int lengthEntered, const char + *itemList)
SCI_AUTOCCANCEL
- SCI_AUTOCACTIVE
- SCI_AUTOCPOSSTART
+ SCI_AUTOCACTIVE → bool
+ SCI_AUTOCPOSSTART → position
SCI_AUTOCCOMPLETE
SCI_AUTOCSTOPS(<unused>, const char - *chars)
- SCI_AUTOCSETSEPARATOR(char - separator)
- SCI_AUTOCGETSEPARATOR
+ *characterSet)
+ SCI_AUTOCSETSEPARATOR(int + separatorCharacter)
+ SCI_AUTOCGETSEPARATOR → int
SCI_AUTOCSELECT(<unused>, const char *select)
- SCI_AUTOCGETCURRENT
- SCI_AUTOCGETCURRENTTEXT(<unused>, - char *text)
+ SCI_AUTOCGETCURRENT → int
+ SCI_AUTOCGETCURRENTTEXT(<unused>, char *text) → int
SCI_AUTOCSETCANCELATSTART(bool cancel)
- SCI_AUTOCGETCANCELATSTART
+ SCI_AUTOCGETCANCELATSTART → bool
SCI_AUTOCSETFILLUPS(<unused>, const char - *chars)
+ *characterSet)
SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)
- SCI_AUTOCGETCHOOSESINGLE
+ SCI_AUTOCGETCHOOSESINGLE → bool
SCI_AUTOCSETIGNORECASE(bool ignoreCase)
- SCI_AUTOCGETIGNORECASE
+ SCI_AUTOCGETIGNORECASE → bool
SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
- SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
+ SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR → int
SCI_AUTOCSETMULTI(int multi)
- SCI_AUTOCGETMULTI
+ SCI_AUTOCGETMULTI → int
SCI_AUTOCSETORDER(int order)
- SCI_AUTOCGETORDER
+ SCI_AUTOCGETORDER → int
SCI_AUTOCSETAUTOHIDE(bool autoHide)
- SCI_AUTOCGETAUTOHIDE
+ SCI_AUTOCGETAUTOHIDE → bool
SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)
- SCI_AUTOCGETDROPRESTOFWORD
+ SCI_AUTOCGETDROPRESTOFWORD → bool
SCI_REGISTERIMAGE(int type, const char *xpmData)
SCI_REGISTERRGBAIMAGE(int type, const char *pixels)
SCI_CLEARREGISTEREDIMAGES
- SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)
- SCI_AUTOCGETTYPESEPARATOR
+ SCI_AUTOCSETTYPESEPARATOR(int separatorCharacter)
+ SCI_AUTOCGETTYPESEPARATOR → int
SCI_AUTOCSETMAXHEIGHT(int rowCount)
- SCI_AUTOCGETMAXHEIGHT
+ SCI_AUTOCGETMAXHEIGHT → int
SCI_AUTOCSETMAXWIDTH(int characterCount)
- SCI_AUTOCGETMAXWIDTH
+ SCI_AUTOCGETMAXWIDTH → int
-

SCI_AUTOCSHOW(int lenEntered, const char *list)
- This message causes a list to be displayed. lenEntered is the number of - characters of the word already entered and list is the list of words separated by +

SCI_AUTOCSHOW(int lengthEntered, const char *itemList)
+ This message causes a list to be displayed. lengthEntered is the number of + characters of the word already entered and itemList is the list of words separated by separator characters. The initial separator character is a space but this can be set or got with SCI_AUTOCSETSEPARATOR and SCI_AUTOCSETORDER + Alternative handling of list order may be specified with SCI_AUTOCSETORDER

SCI_AUTOCCANCEL
@@ -4373,90 +4818,90 @@ struct Sci_TextToFind { autocompletion can be specified with SCI_AUTOCSTOPS.

-

SCI_AUTOCACTIVE
+

SCI_AUTOCACTIVE → bool
This message returns non-zero if there is an active autocompletion list and zero if there is not.

-

SCI_AUTOCPOSSTART
+

SCI_AUTOCPOSSTART → position
This returns the value of the current position when SCI_AUTOCSHOW started display of the list.

SCI_AUTOCCOMPLETE
This message triggers autocompletion. This has the same effect as the tab key.

-

SCI_AUTOCSTOPS(<unused>, const char *chars)
- The chars argument is a string containing a list of characters that will +

SCI_AUTOCSTOPS(<unused>, const char *characterSet)
+ The characterSet argument is a string containing a list of characters that will automatically cancel the autocompletion list. When you start the editor, this list is empty.

-

SCI_AUTOCSETSEPARATOR(char separator)
- SCI_AUTOCGETSEPARATOR
+

SCI_AUTOCSETSEPARATOR(int separatorCharacter)
+ SCI_AUTOCGETSEPARATOR → int
These two messages set and get the separator character used to separate words in the SCI_AUTOCSHOW list. The default is the space character.

SCI_AUTOCSELECT(<unused>, const char *select)
- SCI_AUTOCGETCURRENT
+ SCI_AUTOCGETCURRENT → int
This message selects an item in the autocompletion list. It searches the list of words for the - first that matches select. By default, comparisons are case sensitive, but you can + first that matches select. By default, comparisons are case sensitive, but you can change this with SCI_AUTOCSETIGNORECASE. The match is character - by character for the length of the select string. That is, if select is "Fred" it + by character for the length of the select string. That is, if select is "Fred" it will match "Frederick" if this is the first item in the list that begins with "Fred". If an item is found, it is selected. If the item is not found, the autocompletion list closes if auto-hide is true (see SCI_AUTOCSETAUTOHIDE).
The current selection index can be retrieved with SCI_AUTOCGETCURRENT.

-

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text NUL-terminated)
+

SCI_AUTOCGETCURRENTTEXT(<unused>, char *text NUL-terminated) → int
This message retrieves the current selected text in the autocompletion list. Normally the SCN_AUTOCSELECTION notification is used instead.

-

The value is copied to the text buffer, returning the length (not including the +

The value is copied to the text buffer, returning the length (not including the terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.

If the value argument is 0 then the length that should be allocated to store the value is returned; again, the terminating 0 is not included.

SCI_AUTOCSETCANCELATSTART(bool cancel)
- SCI_AUTOCGETCANCELATSTART
+ SCI_AUTOCGETCANCELATSTART → bool
The default behaviour is for the list to be cancelled if the caret moves to the location it was at when the list was displayed. By calling this message with a false argument, the list is not cancelled until the caret moves at least one character before the word being completed.

-

SCI_AUTOCSETFILLUPS(<unused>, const char *chars)
+

SCI_AUTOCSETFILLUPS(<unused>, const char *characterSet)
If a fillup character is typed with an autocompletion list active, the currently selected item in the list is added into the document, then the fillup character is added. Common fillup characters are '(', '[' and '.' but others are possible depending on the language. By default, no fillup characters are set.

SCI_AUTOCSETCHOOSESINGLE(bool chooseSingle)
- SCI_AUTOCGETCHOOSESINGLE
+ SCI_AUTOCGETCHOOSESINGLE → bool
If you use SCI_AUTOCSETCHOOSESINGLE(1) and a list has only one item, it is automatically added and no list is displayed. The default is to display the list even if there is only a single item.

SCI_AUTOCSETIGNORECASE(bool ignoreCase)
- SCI_AUTOCGETIGNORECASE
+ SCI_AUTOCGETIGNORECASE → bool
By default, matching of characters to list members is case sensitive. These messages let you set and get case sensitivity.

SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)
- SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR
+ SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR → int
When autocompletion is set to ignore case (SCI_AUTOCSETIGNORECASE), by default it will nonetheless select the first list member that matches in a case sensitive way to entered characters. This corresponds to a behaviour property of SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE (0). If you want autocompletion to ignore case at all, choose SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE (1).

SCI_AUTOCSETMULTI(int multi)
- SCI_AUTOCGETMULTI
+ SCI_AUTOCGETMULTI → int
When autocompleting with multiple selections present, the autocompleted text can go into just the main selection with SC_MULTIAUTOC_ONCE (0) or into each selection with SC_MULTIAUTOC_EACH (1). The default is SC_MULTIAUTOC_ONCE.

SCI_AUTOCSETORDER(int order)
- SCI_AUTOCGETORDER
+ SCI_AUTOCGETORDER → int
The default setting SC_ORDER_PRESORTED (0) requires that the list be provided in alphabetical sorted order.

Sorting the list can be done by Scintilla instead of the application with SC_ORDER_PERFORMSORT (1). @@ -4464,29 +4909,29 @@ struct Sci_TextToFind {

Applications that wish to prioritize some values and show the list in order of priority instead of alphabetical order can use SC_ORDER_CUSTOM (2). - This requires extra processing in SCI_AUTOCSHOW to create a sorted index. + This requires extra processing in SCI_AUTOCSHOW to create a sorted index.

-

Setting the order should be done before calling SCI_AUTOCSHOW. +

Setting the order should be done before calling SCI_AUTOCSHOW.

SCI_AUTOCSETAUTOHIDE(bool autoHide)
- SCI_AUTOCGETAUTOHIDE
+ SCI_AUTOCGETAUTOHIDE → bool
By default, the list is cancelled if there are no viable matches (the user has typed characters that no longer match a list entry). If you want to keep displaying the original - list, set autoHide to false. This also effects autoHide
to false. This also effects SCI_AUTOCSELECT.

SCI_AUTOCSETDROPRESTOFWORD(bool dropRestOfWord)
- SCI_AUTOCGETDROPRESTOFWORD
+ SCI_AUTOCGETDROPRESTOFWORD → bool
When an item is selected, any word characters following the caret are first erased if - dropRestOfWord is set true. The default is false.

+ dropRestOfWord is set true. The default is false.

SCI_REGISTERIMAGE(int type, const char *xpmData)
SCI_REGISTERRGBAIMAGE(int type, const char *pixels)
SCI_CLEARREGISTEREDIMAGES
- SCI_AUTOCSETTYPESEPARATOR(char separatorCharacter)
- SCI_AUTOCGETTYPESEPARATOR
+ SCI_AUTOCSETTYPESEPARATOR(int separatorCharacter)
+ SCI_AUTOCGETTYPESEPARATOR → int
Autocompletion list items may display an image as well as text. Each image is first registered with an integer type. Then this integer is included in the text of the list separated by a '?' from the text. For example, @@ -4502,7 +4947,7 @@ struct Sci_TextToFind {

SCI_AUTOCSETMAXHEIGHT(int rowCount)
- SCI_AUTOCGETMAXHEIGHT
+ SCI_AUTOCGETMAXHEIGHT → int
Get or set the maximum number of rows that will be visible in an autocompletion list. If there are more rows in the list, then a vertical scrollbar is shown. The default is 5. @@ -4510,7 +4955,7 @@ struct Sci_TextToFind {

SCI_AUTOCSETMAXWIDTH(int characterCount)
- SCI_AUTOCGETMAXWIDTH
+ SCI_AUTOCGETMAXWIDTH → int
Get or set the maximum width of an autocompletion list expressed as the number of characters in the longest item that will be totally visible. If zero (the default) then the list's width is calculated to fit the item with the most characters. Any items that cannot be fully displayed within @@ -4523,24 +4968,26 @@ struct Sci_TextToFind { listed for autocompletion work on them; you cannot display a user list at the same time as an autocompletion list is active. They differ in the following respects:

+ SCI_USERLISTSHOW(int listType, const char *itemList)
+

o The SCI_AUTOCSETCHOOSESINGLE message has no effect.
- o When the user makes a selection you are sent a SCN_USERLISTSELECTION notification message rather than notification message rather than SCN_AUTOCSELECTION.

BEWARE: if you have set fillup characters or stop characters, these will still be active with the user list, and may result in items being selected or the user list cancelled due to the user typing into the editor.

-

SCI_USERLISTSHOW(int listType, const char *list)
- The listType parameter is returned to the container as the wParam +

SCI_USERLISTSHOW(int listType, const char *itemList)
+ The listType parameter is returned to the container as the wParam field of the SCNotification structure. It must be greater than 0 as this is how Scintilla tells the difference between an autocompletion list and a user list. If you have different types of list, for example a list of - buffers and a list of macros, you can use listType to tell which one has returned + buffers and a list of macros, you can use listType to tell which one has returned a selection.

Call tips

@@ -4551,14 +4998,12 @@ struct Sci_TextToFind { STYLE_DEFAULT. You can choose to use STYLE_CALLTIP to define the facename, size, foreground and background colours and character set with - SCI_CALLTIPUSESTYLE. + SCI_CALLTIPUSESTYLE. This also enables support for Tab characters. There is some interaction between call tips and autocompletion lists in that showing a call tip cancels any active autocompletion list, and vice versa.

-

Call tips are not implemented on Qt.

-

Call tips can highlight part of the text within them. You could use this to highlight the current argument to a function by counting the number of commas (or whatever separator your language uses). See SciTEBase::CharAdded() in SciTEBase.cxx for an @@ -4578,34 +5023,34 @@ struct Sci_TextToFind { href="#SCN_DWELLEND">SCN_DWELLEND. This method could be used in a debugger to give the value of a variable, or during editing to give information about the word under the pointer.

- SCI_CALLTIPSHOW(int posStart, const char + SCI_CALLTIPSHOW(int pos, const char *definition)
SCI_CALLTIPCANCEL
- SCI_CALLTIPACTIVE
- SCI_CALLTIPPOSSTART
+ SCI_CALLTIPACTIVE → bool
+ SCI_CALLTIPPOSSTART → position
SCI_CALLTIPSETPOSSTART(int posStart)
SCI_CALLTIPSETHLT(int highlightStart, int highlightEnd)
- SCI_CALLTIPSETBACK(int colour)
- SCI_CALLTIPSETFORE(int colour)
- SCI_CALLTIPSETFOREHLT(int colour)
- SCI_CALLTIPUSESTYLE(int tabsize)
+ SCI_CALLTIPSETBACK(colour back)
+ SCI_CALLTIPSETFORE(colour fore)
+ SCI_CALLTIPSETFOREHLT(colour fore)
+ SCI_CALLTIPUSESTYLE(int tabSize)
SCI_CALLTIPSETPOSITION(bool above)
-

SCI_CALLTIPSHOW(int posStart, const char *definition)
+

SCI_CALLTIPSHOW(int pos, const char *definition)
This message starts the process by displaying the call tip window. If a call tip is already active, this has no effect.
- posStart is the position in the document at which to align the call tip. The call + pos is the position in the document at which to align the call tip. The call tip text is aligned to start 1 line below this character unless you have included up and/or down arrows in the call tip text in which case the tip is aligned to the right-hand edge of the rightmost arrow. The assumption is that you will start the text with something like "\001 1 of 3 \002".
- definition is the call tip text. This can contain multiple lines separated by + definition is the call tip text. This can contain multiple lines separated by '\n' (Line Feed, ASCII code 10) characters. Do not include '\r' (Carriage Return, ASCII code 13), as this will most likely print as an empty box. '\t' (Tab, ASCII code 9) is supported if you set a tabsize with - SCI_CALLTIPUSESTYLE.
+ SCI_CALLTIPUSESTYLE.
The position of the caret is remembered here so that the call tip can be cancelled automatically if subsequent deletion moves the caret before this position.

@@ -4615,19 +5060,20 @@ struct Sci_TextToFind { function. Call tips are cancelled if you delete back past the position where the caret was when the tip was triggered.

-

SCI_CALLTIPACTIVE
+

SCI_CALLTIPACTIVE → bool
This returns 1 if a call tip is active and 0 if it is not active.

-

SCI_CALLTIPPOSSTART
+

SCI_CALLTIPPOSSTART → position
SCI_CALLTIPSETPOSSTART(int posStart)
This message returns or sets the value of the current position when SCI_CALLTIPSHOW started to display the tip.

-

SCI_CALLTIPSETHLT(int hlStart, int hlEnd)
+

SCI_CALLTIPSETHLT(int highlightStart, int highlightEnd)
This sets the region of the call tips text to display in a highlighted style. - hlStart is the zero-based index into the string of the first character to - highlight and hlEnd is the index of the first character after the highlight. - hlEnd must be greater than hlStart; hlEnd-hlStart is the + highlightStart is the zero-based index into the string of the first character to + highlight and highlightEnd is the index of the first character after the highlight. + highlightEnd must be greater than highlightStart; + highlightEnd-highlightStart is the number of characters to highlight. Highlights can extend over line ends if this is required.

@@ -4638,23 +5084,23 @@ struct Sci_TextToFind { SCI_CALLTIPSETFOREHLT.

-

SCI_CALLTIPSETBACK(int colour)
+

SCI_CALLTIPSETBACK(colour back)
The background colour of call tips can be set with this message; the default colour is white. It is not a good idea to set a dark colour as the background as the default colour for normal calltip text is mid grey and the default colour for highlighted text is dark blue. This also sets the background colour of STYLE_CALLTIP.

-

SCI_CALLTIPSETFORE(int colour)
+

SCI_CALLTIPSETFORE(colour fore)
The colour of call tip text can be set with this message; the default colour is mid grey. This also sets the foreground colour of STYLE_CALLTIP.

-

SCI_CALLTIPSETFOREHLT(int colour)
+

SCI_CALLTIPSETFOREHLT(colour fore)
The colour of highlighted call tip text can be set with this message; the default colour is dark blue.

-

SCI_CALLTIPUSESTYLE(int tabsize)
+

SCI_CALLTIPUSESTYLE(int tabSize)
This message changes the style used for call tips from STYLE_DEFAULT to - STYLE_CALLTIP and sets a tab size in screen pixels. If tabsize is + STYLE_CALLTIP and sets a tab size in screen pixels. If tabsize is less than 1, Tab characters are not treated specially. Once this call has been used, the call tip foreground and background colours are also taken from the style.

@@ -4861,15 +5307,18 @@ struct Sci_TextToFind { SCI_DELLINERIGHT SCI_LINEDELETE + + SCI_LINECUT - SCI_LINECUT SCI_LINECOPY SCI_LINETRANSPOSE + SCI_LINEREVERSE + SCI_LINEDUPLICATE @@ -4922,6 +5371,9 @@ struct Sci_TextToFind {

The SCI_WORDPART* commands are used to move between word segments marked by capitalisation (aCamelCaseIdentifier) or underscores (an_under_bar_ident).

+

The SCI_WORD[LEFT|RIGHT]END* commands are + similar to SCI_WORD[LEFT|RIGHT]* but move between word ends instead of word starts.

+

The SCI_HOME* commands move the caret to the start of the line, while the SCI_VCHOME* commands move the caret to the first non-blank character of the line (ie. just after the indentation) unless it is already there; in this case, it acts as SCI_HOME*.

@@ -4943,6 +5395,10 @@ struct Sci_TextToFind { by binding the home and end keys to these commands.

+

The SCI_CANCEL command cancels autocompletion and + calltip display and drops any additional selections. +

+

Key bindings

There is a default binding of keys to commands that is defined in the Scintilla source in @@ -4975,16 +5431,18 @@ struct Sci_TextToFind { SCK_WIN.

The modifiers are a combination of zero or more of SCMOD_ALT, - SCMOD_CTRL, SCMOD_SHIFT, and SCMOD_META. + SCMOD_CTRL, SCMOD_SHIFT, + SCMOD_META, and SCMOD_SUPER. On OS X, the Command key is mapped to SCMOD_CTRL and the Control key to SCMOD_META. + SCMOD_SUPER is only available on GTK+ which is commonly the Windows key. If you are building a table, you might want to use SCMOD_NORM, which has the value 0, to mean no modifiers.

SCI_ASSIGNCMDKEY(int keyDefinition, int sciCommand)
This assigns the given key definition to a Scintilla command identified by - sciCommand. sciCommand can be any SCI_* command that has + sciCommand. sciCommand can be any SCI_* command that has no arguments.

SCI_CLEARCMDKEY(int Popup edit menu -

SCI_USEPOPUP(bool bEnablePopup)
+
SCI_USEPOPUP(int popUpMode)
+
+ +

SCI_USEPOPUP(int popUpMode)
Clicking the wrong button on the mouse pops up a short default editing menu. This may be - turned off with SCI_USEPOPUP(0). If you turn it off, context menu commands (in + turned off with SCI_USEPOPUP(SC_POPUP_NEVER). If you turn it off, context menu commands (in Windows, WM_CONTEXTMENU) will not be handled by Scintilla, so the parent of the Scintilla window will have the opportunity to handle the message.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueMeaning
SC_POPUP_NEVER0Never show default editing menu.
SC_POPUP_ALL1Show default editing menu if clicking on scintilla.
SC_POPUP_TEXT2Show default editing menu only if clicking on text area.
+

Macro recording

Start and stop macro recording mode. In macro recording mode, actions are reported to the @@ -5015,6 +5519,10 @@ struct Sci_TextToFind { notifications. It is then up to the container to record these actions for future replay.

+ SCI_STARTRECORD
+ SCI_STOPRECORD
+
+

SCI_STARTRECORD
SCI_STOPRECORD
These two messages turn macro recording on and off.

@@ -5030,25 +5538,24 @@ struct Sci_TextToFind { HDCs., on GTK+ 3.x cairo_t *, and on Cocoa CGContextRef is used.

- SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat - *pfr)
+ SCI_FORMATRANGE(bool draw, Sci_RangeToFormat *fr) → position
SCI_SETPRINTMAGNIFICATION(int magnification)
- SCI_GETPRINTMAGNIFICATION
+ SCI_GETPRINTMAGNIFICATION → int
SCI_SETPRINTCOLOURMODE(int mode)
- SCI_GETPRINTCOLOURMODE
- SCI_SETPRINTWRAPMODE
- SCI_GETPRINTWRAPMODE
+ SCI_GETPRINTCOLOURMODE → int
+ SCI_SETPRINTWRAPMODE(int wrapMode)
+ SCI_GETPRINTWRAPMODE → int
-

SCI_FORMATRANGE(bool bDraw, Sci_RangeToFormat *pfr)
+

SCI_FORMATRANGE(bool draw, Sci_RangeToFormat *fr) → position
This call renders a range of text into a device context. If you use this for printing, you will probably want to arrange a page header and footer; Scintilla does not do this for you. See SciTEWin::Print() in SciTEWinDlg.cxx for an example. Each use of this message renders a range of text into a rectangular area and returns the position in the document of the next character to print.

-

bDraw controls if any output is done. Set this to false if you are paginating +

draw controls if any output is done. Set this to false if you are paginating (for example, if you use this with MFC you will need to paginate in OnBeginPrinting() before you output each page.

@@ -5074,9 +5581,9 @@ struct Sci_RangeToFormat {
      chrg.cpMin and chrg.cpMax define the start position and maximum
     position of characters to output. All of each line within this character range is drawn.

-

On Cocoa, the surface IDs for printing (bDraw=1) should be the graphics port of the current context +

On Cocoa, the surface IDs for printing (draw=1) should be the graphics port of the current context ((CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]) when the view's drawRect method is called. - The Surface IDs are not really used for measurement (bDraw=0) but can be set + The Surface IDs are not really used for measurement (draw=0) but can be set to a bitmap context (created with CGBitmapContextCreate) to avoid runtime warnings.

On GTK+, the surface IDs to use can be found from the printing context with @@ -5092,20 +5599,20 @@ struct Sci_RangeToFormat { area, header and footer code.

SCI_SETPRINTMAGNIFICATION(int magnification)
- SCI_GETPRINTMAGNIFICATION
+ SCI_GETPRINTMAGNIFICATION → int
SCI_GETPRINTMAGNIFICATION lets you to print at a different size than the screen - font. magnification is the number of points to add to the size of each screen + font. magnification is the number of points to add to the size of each screen font. A value of -3 or -4 gives reasonably small print. You can get this value with SCI_GETPRINTMAGNIFICATION.

SCI_SETPRINTCOLOURMODE(int mode)
- SCI_GETPRINTCOLOURMODE
+ SCI_GETPRINTCOLOURMODE → int
These two messages set and get the method used to render coloured text on a printer that is probably using white paper. It is especially important to consider the treatment of colour if you use a dark or black screen background. Printing white on black uses up toner and ink very many times faster than the other way around. You can set the mode to one of:

- +
@@ -5122,7 +5629,8 @@ struct Sci_RangeToFormat { - + @@ -5155,15 +5663,25 @@ struct Sci_RangeToFormat { - + + + + + + + + + +
Symbol0Print using the current screen colours. This is the default.Print using the current screen colours with the exception of line number margins which print on a white background. + This is the default.
4Everything prints in its own colour on a white background except that line numbers - use their own background colour.Everything prints in its own foreground colour but all styles up to and including STYLE_LINENUMBER will print + on a white background.
SC_PRINT_SCREENCOLOURS5Print using the current screen colours for both foreground and background. + This is the only mode that does not set the background colour of the line number margin to white.

SCI_SETPRINTWRAPMODE(int wrapMode)
- SCI_GETPRINTWRAPMODE
- These two functions get and set the printer wrap mode. wrapMode can be + SCI_GETPRINTWRAPMODE → int
+ These two functions get and set the printer wrap mode. wrapMode can be set to SC_WRAP_NONE (0), SC_WRAP_WORD (1) or SC_WRAP_CHAR (2). The default is SC_WRAP_WORD, which wraps printed output so that all characters fit @@ -5177,11 +5695,11 @@ struct Sci_RangeToFormat { between words.

Direct access

- SCI_GETDIRECTFUNCTION
- SCI_GETDIRECTPOINTER
- SCI_GETCHARACTERPOINTER
- SCI_GETRANGEPOINTER(int position, int rangeLength)
- SCI_GETGAPPOSITION
+ SCI_GETDIRECTFUNCTION → int
+ SCI_GETDIRECTPOINTER → int
+ SCI_GETCHARACTERPOINTER → int
+ SCI_GETRANGEPOINTER(int start, int lengthRange) → int
+ SCI_GETGAPPOSITION → position

On Windows, the message-passing scheme used to communicate between the container and @@ -5201,7 +5719,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SciFnDirect, sptr_t and uptr_t are declared in - Scintilla.h. hSciWnd is the window handle returned when you created + Scintilla.h. hSciWnd is the window handle returned when you created the Scintilla window.

While faster, this direct calling will cause problems if performed from a different thread @@ -5216,19 +5734,19 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_GETDIRECTFUNCTION and the need to call Scintilla indirectly via the function pointer.

-

SCI_GETDIRECTFUNCTION
+

SCI_GETDIRECTFUNCTION → int
This message returns the address of the function to call to handle Scintilla messages without the overhead of passing through the Windows messaging system. You need only call this once, regardless of the number of Scintilla windows you create.

-

SCI_GETDIRECTPOINTER
+

SCI_GETDIRECTPOINTER → int
This returns a pointer to data that identifies which Scintilla window is in use. You must call this once for each Scintilla window you create. When you call the direct function, you must pass in the direct pointer associated with the target window.

-

SCI_GETCHARACTERPOINTER
- SCI_GETRANGEPOINTER(int position, int rangeLength)
- SCI_GETGAPPOSITION
+

SCI_GETCHARACTERPOINTER → int
+ SCI_GETRANGEPOINTER(int start, int lengthRange) → int
+ SCI_GETGAPPOSITION → position
Grant temporary direct read-only access to the memory used by Scintilla to store the document.

SCI_GETCHARACTERPOINTER moves the gap within Scintilla so that the @@ -5269,60 +5787,123 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ documents in a single Scintilla window and so you can display a single document in multiple windows (for use with splitter windows).

-

Although these messages use document *pDoc, to ensure compatibility with future - releases of Scintilla you should treat pDoc as an opaque void*. That +

Although these messages use document *doc, to ensure compatibility with future + releases of Scintilla you should treat doc as an opaque void*. That is, you can use and store the pointer as described in this section but you should not dereference it.

- SCI_GETDOCPOINTER
+ SCI_GETDOCPOINTER → document *
SCI_SETDOCPOINTER(<unused>, document - *pDoc)
- SCI_CREATEDOCUMENT
+ *doc)
+ SCI_CREATEDOCUMENT(int bytes, int documentOptions) → document *
SCI_ADDREFDOCUMENT(<unused>, document - *pDoc)
+ *doc)
SCI_RELEASEDOCUMENT(<unused>, document - *pDoc)
+ *doc)
+ SCI_GETDOCUMENTOPTIONS → int
-

SCI_GETDOCPOINTER
+

SCI_GETDOCPOINTER → document *
This returns a pointer to the document currently in use by the window. It has no other effect.

-

SCI_SETDOCPOINTER(<unused>, document *pDoc)
+

SCI_SETDOCPOINTER(<unused>, document *doc)
This message does the following:
1. It removes the current window from the list held by the current document.
2. It reduces the reference count of the current document by 1.
3. If the reference count reaches 0, the document is deleted.
- 4. pDoc is set as the new document for the window.
- 5. If pDoc was 0, a new, empty document is created and attached to the + 4. doc is set as the new document for the window.
+ 5. If doc was 0, a new, empty document is created and attached to the window.
- 6. If pDoc was not 0, its reference count is increased by 1.

+ 6. If doc was not 0, its reference count is increased by 1.

-

SCI_CREATEDOCUMENT
+

SCI_CREATEDOCUMENT(int bytes, int documentOptions) → document *
This message creates a new, empty document and returns a pointer to it. This document is not - selected into the editor and starts with a reference count of 1. This means that you have - ownership of it and must either reduce its reference count by 1 after using + selected into the editor and starts with a reference count of 1. This means that you have + ownership of it and must either reduce its reference count by 1 after using SCI_SETDOCPOINTER so that the Scintilla window owns it or you must make sure that - you reduce the reference count by 1 with SCI_RELEASEDOCUMENT before you close the - application to avoid memory leaks.

+ you reduce the reference count by 1 with SCI_RELEASEDOCUMENT before you close the + application to avoid memory leaks. The bytes argument determines + the initial memory allocation for the document as it is more efficient + to allocate once rather than rely on the buffer growing as data is added. + If SCI_CREATEDOCUMENT fails then 0 is returned.

-

SCI_ADDREFDOCUMENT(<unused>, document *pDoc)
+

The documentOptions argument + chooses between different document capabilities which affect memory allocation and performance with + SC_DOCUMENTOPTION_DEFAULT (0) choosing standard options. + SC_DOCUMENTOPTION_STYLES_NONE (0x1) stops allocation of memory to style characters + which saves significant memory, often 40% with the whole document treated as being style 0. + Lexers may still produce visual styling by using indicators. + SC_DOCUMENTOPTION_TEXT_LARGE (0x100) accomodates documents larger than 2 GigaBytes + in 64-bit executables. +

+ +

With SC_DOCUMENTOPTION_STYLES_NONE, lexers are still active and may display + indicators. Some may produce folding information althoough most require lexical styles to correctly determine folding. + Its often more efficient to set the null lexer SCLEX_NULL so no lexer is run. +

+ +

The SC_DOCUMENTOPTION_TEXT_LARGE option is experimental and has not been + thoroughly tested. Lexers may fail or hang when lexing past 2GB or 4GB. + Applications using this option should be tested to ensure the option works in their circumstances and each lexer + included should also be tested with documents larger than 4GB. + For many applications lexing documents larger than 4GB will be too sluggish so SC_DOCUMENTOPTION_STYLES_NONE + and the null lexer SCLEX_NULL can be used. Another approach is to turn on idle styling with + SCI_SETIDLESTYLING. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueEffect
SC_DOCUMENTOPTION_DEFAULT0Standard behaviour
SC_DOCUMENTOPTION_STYLES_NONE0x1Stop allocation of memory for styles and treat all text as style 0.
SC_DOCUMENTOPTION_TEXT_LARGE0x100Allow document to be larger than 2 GB.
+ +

SCI_ADDREFDOCUMENT(<unused>, document *doc)
This increases the reference count of a document by 1. If you want to replace the current document in the Scintilla window and take ownership of the current document, for example if you are editing many documents in one window, do the following:
1. Use SCI_GETDOCPOINTER to get a pointer to the document, - pDoc.
- 2. Use SCI_ADDREFDOCUMENT(0, pDoc) to increment the reference count.
- 3. Use SCI_SETDOCPOINTER(0, pNewDoc) to set a different document or + doc.
+ 2. Use SCI_ADDREFDOCUMENT(0, doc) to increment the reference count.
+ 3. Use SCI_SETDOCPOINTER(0, docNew) to set a different document or SCI_SETDOCPOINTER(0, 0) to set a new, empty document.

-

SCI_RELEASEDOCUMENT(<unused>, document *pDoc)
- This message reduces the reference count of the document identified by pDoc. pDoc +

SCI_RELEASEDOCUMENT(<unused>, document *doc)
+ This message reduces the reference count of the document identified by doc. doc must be the result of SCI_GETDOCPOINTER or SCI_CREATEDOCUMENT and must point at a document that still exists. If you call this on a document with a reference count of 1 that is still attached to a Scintilla window, bad things will happen. To keep the world spinning in its orbit you must balance each call to SCI_CREATEDOCUMENT or SCI_ADDREFDOCUMENT with a call to SCI_RELEASEDOCUMENT.

+

SCI_GETDOCUMENTOPTIONS → int
+ Returns the options that were used to create the document.

+

Background loading and saving

To ensure a responsive user interface, applications may decide to load and save documents using a separate thread @@ -5330,19 +5911,25 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Loading in the background

+ SCI_CREATELOADER(int bytes, int documentOptions) → int
+
+

An application can load all of a file into a buffer it allocates on a background thread and then add the data in that buffer into a Scintilla document on the user interface thread. That technique uses extra memory to store a complete copy of the file and also means that the time that Scintilla takes to perform initial line end discovery blocks the user interface.

To avoid these issues, a loader object may be created and used to load the file. The loader object supports the ILoader interface.

-

SCI_CREATELOADER(int bytes)
+

SCI_CREATELOADER(int bytes, int documentOptions) → int
Create an object that supports the ILoader interface which can be used to load data and then be turned into a Scintilla document object for attachment to a view object. - The bytes argument determines the initial memory allocation for the document as it is more efficient + The bytes argument determines the initial memory allocation for the document as it is more efficient to allocate once rather than rely on the buffer growing as data is added. If SCI_CREATELOADER fails then 0 is returned.

+

The documentOptions argument + is described in the SCI_CREATEDOCUMENT section.

+

ILoader

@@ -5350,7 +5937,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ public:
        virtual int SCI_METHOD Release() = 0;
        // Returns a status code from SC_STATUS_*
-        virtual int SCI_METHOD AddData(char *data, int length) = 0;
+        virtual int SCI_METHOD AddData(const char *data, Sci_Position length) = 0;
        virtual void * SCI_METHOD ConvertToDocument() = 0;
};
@@ -5359,16 +5946,17 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ AddData will return SC_STATUS_OK unless a failure, such as memory exhaustion occurs. If a failure occurs in AddData or in a file reading call then loading can be abandoned and the loader released with the Release call. - When the whole file has been read, the ConvertToDocument method should be called to produce a Scintilla - document pointer which can be used in the same way as a document pointer returned from - SCI_CREATEDOCUMENT. + When the whole file has been read, ConvertToDocument should be called to produce a Scintilla + document pointer. The newly created document will have a reference count of 1 in the same way as a document pointer + returned from + SCI_CREATEDOCUMENT. There is no need to call Release after ConvertToDocument.

Saving in the background

An application that wants to save in the background should lock the document with SCI_SETREADONLY(1) to prevent modifications and retrieve a pointer to the unified document contents with - SCI_GETCHARACTERPOINTER. + SCI_GETCHARACTERPOINTER. The buffer of a locked document will not move so the pointer is valid until the application calls SCI_SETREADONLY(0).

If the user tries to performs a modification while the document is locked then a "fold" property should be set to "1" with SCI_SETPROPERTY("fold", "1") to enable folding.

- SCI_VISIBLEFROMDOCLINE(int - docLine)
- SCI_DOCLINEFROMVISIBLE(int - displayLine)
+ SCI_VISIBLEFROMDOCLINE(int docLine) → int
+ SCI_DOCLINEFROMVISIBLE(int displayLine) → int
SCI_SHOWLINES(int lineStart, int lineEnd)
SCI_HIDELINES(int lineStart, int lineEnd)
- SCI_GETLINEVISIBLE(int line)
- SCI_GETALLLINESVISIBLE
+ SCI_GETLINEVISIBLE(int line) → bool
+ SCI_GETALLLINESVISIBLE → bool
SCI_SETFOLDLEVEL(int line, int level)
- SCI_GETFOLDLEVEL(int line)
+ SCI_GETFOLDLEVEL(int line) → int
SCI_SETAUTOMATICFOLD(int automaticFold)
- SCI_GETAUTOMATICFOLD
+ SCI_GETAUTOMATICFOLD → int
SCI_SETFOLDFLAGS(int flags)
- SCI_GETLASTCHILD(int line, int level)
- SCI_GETFOLDPARENT(int line)
+ SCI_GETLASTCHILD(int line, int level) → int
+ SCI_GETFOLDPARENT(int line) → int
SCI_SETFOLDEXPANDED(int line, bool expanded)
- SCI_GETFOLDEXPANDED(int line)
- SCI_CONTRACTEDFOLDNEXT(int lineStart)
+ SCI_GETFOLDEXPANDED(int line) → bool
+ SCI_CONTRACTEDFOLDNEXT(int lineStart) → int
SCI_TOGGLEFOLD(int line)
+ SCI_TOGGLEFOLDSHOWTEXT(int line, const char *text)
+ SCI_FOLDDISPLAYTEXTSETSTYLE(int style)
SCI_FOLDLINE(int line, int action)
SCI_FOLDCHILDREN(int line, int action)
SCI_FOLDALL(int action)
@@ -5422,30 +6010,30 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ line)
-

SCI_VISIBLEFROMDOCLINE(int docLine)
+

SCI_VISIBLEFROMDOCLINE(int docLine) → int
When some lines are hidden and/or annotations are displayed, then a particular line in the document may be displayed at a different position to its document position. If no lines are hidden and there are no annotations, this message returns - docLine. Otherwise, this returns the display line (counting the very first visible + docLine. Otherwise, this returns the display line (counting the very first visible line as 0). The display line of an invisible line is the same as the previous visible line. The display line number of the first line in the document is 0. If lines are hidden and - docLine is outside the range of lines in the document, the return value is -1. + docLine is outside the range of lines in the document, the return value is -1. Lines can occupy more than one display line if they wrap.

-

SCI_DOCLINEFROMVISIBLE(int displayLine)
+

SCI_DOCLINEFROMVISIBLE(int displayLine) → int
When some lines are hidden and/or annotations are displayed, then a particular line in the document may be displayed at a different position to its document position. This message returns the document line number that corresponds to a display line (counting the display line of the first line in the document as - 0). If displayLine is less than or equal to 0, the result is 0. If - displayLine is greater than or equal to the number of displayed lines, the result + 0). If displayLine is less than or equal to 0, the result is 0. If + displayLine is greater than or equal to the number of displayed lines, the result is the number of lines in the document.

SCI_SHOWLINES(int lineStart, int lineEnd)
SCI_HIDELINES(int lineStart, int lineEnd)
- SCI_GETLINEVISIBLE(int line)
- SCI_GETALLLINESVISIBLE
+ SCI_GETLINEVISIBLE(int line) → bool
+ SCI_GETALLLINESVISIBLE → bool
The first two messages mark a range of lines as visible or invisible and then redraw the display. SCI_GETLINEVISIBLE reports on the visible state of a line and returns 1 if it is @@ -5456,11 +6044,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ flags. The first line can not be hidden.

SCI_SETFOLDLEVEL(int line, int level)
- SCI_GETFOLDLEVEL(int line)
+ SCI_GETFOLDLEVEL(int line) → int
These two messages set and get a 32-bit value that contains the fold level of a line and some flags associated with folding. The fold level is a number in the range 0 to - SC_FOLDLEVELNUMBERMASK (4095). However, the initial fold level is set to - SC_FOLDLEVELBASE (1024) to allow unsigned arithmetic on folding levels. There are + SC_FOLDLEVELNUMBERMASK (0x0FFF). However, the initial fold level is set to + SC_FOLDLEVELBASE (0x400) to allow unsigned arithmetic on folding levels. There are two addition flag bits. SC_FOLDLEVELWHITEFLAG indicates that the line is blank and allows it to be treated slightly different then its level may indicate. For example, blank lines should generally not be fold points and will be considered part of the preceding section even though @@ -5482,10 +6070,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ In addition to showing markers in the folding margin, you can indicate folds to the user by drawing lines in the text area. The lines are drawn in the foreground colour set for STYLE_DEFAULT. Bits set in - flags determine where folding lines are drawn:
+ flags determine where folding lines are drawn:

- +
@@ -5549,28 +6137,67 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

This message causes the display to redraw.

-

SCI_GETLASTCHILD(int startLine, int level)
- This message searches for the next line after startLine, that has a folding level - that is less than or equal to level and then returns the previous line number. If - you set level to -1, level is set to the folding level of line - startLine. If from is a fold point, SCI_GETLASTCHILD(from, +

SCI_GETLASTCHILD(int line, int level) → int
+ This message searches for the next line after line, that has a folding level + that is less than or equal to level and then returns the previous line number. If + you set level to -1, level is set to the folding level of line + line. If from is a fold point, SCI_GETLASTCHILD(from, -1) returns the last line that would be in made visible or hidden by toggling the fold state.

-

SCI_GETFOLDPARENT(int startLine)
- This message returns the line number of the first line before startLine that is +

SCI_GETFOLDPARENT(int line) → int
+ This message returns the line number of the first line before line that is marked as a fold point with SC_FOLDLEVELHEADERFLAG and has a fold level less than - the startLine. If no line is found, or if the header flags and fold levels are + the line. If no line is found, or if the header flags and fold levels are inconsistent, the return value is -1.

SCI_TOGGLEFOLD(int line)
+ SCI_TOGGLEFOLDSHOWTEXT(int line, const char *text)
Each fold point may be either expanded, displaying all its child lines, or contracted, hiding - all the child lines. This message toggles the folding state of the given line as long as it has - the SC_FOLDLEVELHEADERFLAG set. This message takes care of folding or expanding + all the child lines. These messages toggle the folding state of the given line as long as it has + the SC_FOLDLEVELHEADERFLAG set. These messages take care of folding or expanding all the lines that depend on the line. The display updates after this message.

+

An optional text tag may be shown to the right of the folded text with the + text argument to + SCI_TOGGLEFOLDSHOWTEXT. + The text is drawn with the + STYLE_FOLDDISPLAYTEXT style.

+ +

SCI_FOLDDISPLAYTEXTSETSTYLE(int style)
+ This message changes the appearance of fold text tags.

+
Symbol
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueEffect
SC_FOLDDISPLAYTEXT_HIDDEN0Do not display the text tags. This is the default.
SC_FOLDDISPLAYTEXT_STANDARD1Display the text tags.
SC_FOLDDISPLAYTEXT_BOXED2Display the text tags with a box drawn around them.

SCI_SETFOLDEXPANDED(int line, bool expanded)
- SCI_GETFOLDEXPANDED(int line)
+ SCI_GETFOLDEXPANDED(int line) → bool
These messages set and get the expanded state of a single line. The set message has no effect on the visible state of the line or any lines that depend on it. It does change the markers in the folding margin. If you ask for the expansion state of a line that is outside the document, @@ -5592,7 +6219,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

To affect the entire document call SCI_FOLDALL. With SC_FOLDACTION_TOGGLE the first fold header in the document is examined to decide whether to expand or contract.

- +
@@ -5632,9 +6259,9 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETAUTOMATICFOLD(int automaticFold)
- SCI_GETAUTOMATICFOLD
+ SCI_GETAUTOMATICFOLD → int
Instead of implementing all the logic for handling folding in the container, Scintilla can provide behaviour - that is adequate for many applications. The automaticFold argument is a bit set defining + that is adequate for many applications. The automaticFold argument is a bit set defining which of the 3 pieces of folding implementation should be enabled. Most applications should be able to use the SC_AUTOMATICFOLD_SHOW and SC_AUTOMATICFOLD_CHANGE flags unless they wish to implement quite different behaviour such as defining their own fold structure. @@ -5642,7 +6269,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ like to add or change click behaviour such as showing method headers only when Shift+Alt is used in conjunction with a click.

-
Symbol
+
@@ -5677,11 +6304,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Symbol
-

SCI_CONTRACTEDFOLDNEXT(int lineStart)
+

SCI_CONTRACTEDFOLDNEXT(int lineStart) → int
Search efficiently for lines that are contracted fold headers. This is useful when saving the user's folding when switching documents or saving folding with a file. - The search starts at line number lineStart and continues forwards to the end of the file. - lineStart is returned if it is a contracted fold header otherwise the next contracted + The search starts at line number lineStart and continues forwards to the end of the file. + lineStart is returned if it is a contracted fold header otherwise the next contracted fold header is returned. If there are no more contracted fold headers then -1 is returned.

SCI_ENSUREVISIBLE(int line)
@@ -5695,22 +6322,22 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Line wrapping

SCI_SETWRAPMODE(int wrapMode)
- SCI_GETWRAPMODE
+ SCI_GETWRAPMODE → int
SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)
- SCI_GETWRAPVISUALFLAGS
+ SCI_GETWRAPVISUALFLAGS → int
SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)
- SCI_GETWRAPVISUALFLAGSLOCATION
- SCI_SETWRAPINDENTMODE(int indentMode)
- SCI_GETWRAPINDENTMODE
+ SCI_GETWRAPVISUALFLAGSLOCATION → int
+ SCI_SETWRAPINDENTMODE(int wrapIndentMode)
+ SCI_GETWRAPINDENTMODE → int
SCI_SETWRAPSTARTINDENT(int indent)
- SCI_GETWRAPSTARTINDENT
+ SCI_GETWRAPSTARTINDENT → int
SCI_SETLAYOUTCACHE(int cacheMode)
- SCI_GETLAYOUTCACHE
+ SCI_GETLAYOUTCACHE → int
SCI_SETPOSITIONCACHE(int size)
- SCI_GETPOSITIONCACHE
+ SCI_GETPOSITIONCACHE → int
SCI_LINESSPLIT(int pixelWidth)
SCI_LINESJOIN
- SCI_WRAPCOUNT(int docLine)
+ SCI_WRAPCOUNT(int docLine) → int

By default, Scintilla does not wrap lines of text. If you enable line wrapping, lines wider @@ -5744,7 +6371,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCN_PAINTED notification.

SCI_SETWRAPMODE(int wrapMode)
- SCI_GETWRAPMODE
+ SCI_GETWRAPMODE → int
Set wrapMode to SC_WRAP_WORD (1) to enable wrapping on word or style boundaries, SC_WRAP_CHAR (2) to enable wrapping between any characters, SC_WRAP_WHITESPACE (3) to enable @@ -5755,11 +6382,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETWRAPVISUALFLAGS(int wrapVisualFlags)
- SCI_GETWRAPVISUALFLAGS
+ SCI_GETWRAPVISUALFLAGS → int
You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in wrapVisualFlags determine which visual flags are drawn.

- +
@@ -5798,12 +6425,12 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Symbol

SCI_SETWRAPVISUALFLAGSLOCATION(int wrapVisualFlagsLocation)
- SCI_GETWRAPVISUALFLAGSLOCATION
+ SCI_GETWRAPVISUALFLAGSLOCATION → int
You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text. Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.

- +
@@ -5833,14 +6460,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Symbol
-

SCI_SETWRAPINDENTMODE(int indentMode)
- SCI_GETWRAPINDENTMODE
+

SCI_SETWRAPINDENTMODE(int wrapIndentMode)
+ SCI_GETWRAPINDENTMODE → int
Wrapped sublines can be indented to the position of their first subline or one more indent level. The default is SC_WRAPINDENT_FIXED. The modes are:

- +
@@ -5853,8 +6480,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ - + @@ -5868,11 +6497,17 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ + + + + + +
Symbol
SC_WRAPINDENT_FIXED 0Wrapped sublines aligned to left of window plus amount set by - SCI_SETWRAPSTARTINDENT + Wrapped sublines aligned to left of window plus amount set by + SCI_SETWRAPSTARTINDENT +
2 Wrapped sublines are aligned to first subline indent plus one more level of indentation
SC_WRAPINDENT_DEEPINDENT3Wrapped sublines are aligned to first subline indent plus two more levels of indentation

SCI_SETWRAPSTARTINDENT(int indent)
- SCI_GETWRAPSTARTINDENT
+ SCI_GETWRAPSTARTINDENT → int
SCI_SETWRAPSTARTINDENT sets the size of indentation of sublines for wrapped lines in terms of the average character width in STYLE_DEFAULT. @@ -5883,10 +6518,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETLAYOUTCACHE(int cacheMode)
- SCI_GETLAYOUTCACHE
- You can set cacheMode to one of the symbols in the table:

+ SCI_GETLAYOUTCACHE → int
+ You can set cacheMode to one of the symbols in the table:

- +
@@ -5933,7 +6568,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
Symbol

SCI_SETPOSITIONCACHE(int size)
- SCI_GETPOSITIONCACHE
+ SCI_GETPOSITIONCACHE → int
The position cache stores position information for short runs of text so that their layout can be determined more quickly if the run recurs. The size in entries of this cache can be set with SCI_SETPOSITIONCACHE.

@@ -5941,7 +6576,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_LINESSPLIT(int pixelWidth)
Split a range of lines indicated by the target into lines that are at most pixelWidth wide. Splitting occurs on word boundaries wherever possible in a similar manner to line wrapping. - When pixelWidth is 0 then the width of the window is used. + When pixelWidth is 0 then the width of the window is used.

SCI_LINESJOIN
@@ -5950,7 +6585,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Where this would lead to no space between words, an extra space is inserted.

-

SCI_WRAPCOUNT(int docLine)
+

SCI_WRAPCOUNT(int docLine) → int
Document lines can occupy more than one display line if they wrap and this returns the number of display lines needed to wrap a document line.

@@ -5962,7 +6597,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCI_ZOOMIN
SCI_ZOOMOUT
SCI_SETZOOM(int zoomInPoints)
- SCI_GETZOOM
+ SCI_GETZOOM → int

SCI_ZOOMIN
@@ -5972,7 +6607,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ current zoom factor is greater than -10 points.

SCI_SETZOOM(int zoomInPoints)
- SCI_GETZOOM
+ SCI_GETZOOM → int
These messages let you set and get the zoom factor directly. There is no limit set on the factors you can set, so limiting yourself to -10 to +20 to match the incremental zoom functions is a good idea.

@@ -5981,20 +6616,23 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

You can choose to mark lines that exceed a given length by drawing a vertical line or by colouring the background of characters that exceed the set length.

- SCI_SETEDGEMODE(int mode)
- SCI_GETEDGEMODE
+ SCI_SETEDGEMODE(int edgeMode)
+ SCI_GETEDGEMODE → int
SCI_SETEDGECOLUMN(int column)
- SCI_GETEDGECOLUMN
- SCI_SETEDGECOLOUR(int colour)
- SCI_GETEDGECOLOUR
+ SCI_GETEDGECOLUMN → int
+ SCI_SETEDGECOLOUR(colour edgeColour)
+ SCI_GETEDGECOLOUR → colour
+
+ SCI_MULTIEDGEADDLINE(int column, colour edgeColour)
+ SCI_MULTIEDGECLEARALL

SCI_SETEDGEMODE(int edgeMode)
- SCI_GETEDGEMODE
+ SCI_GETEDGEMODE → int
These two messages set and get the mode used to display long lines. You can set one of the values in the table:

- +
@@ -6035,22 +6673,94 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ + + + + + + + +
SymbolThe background colour of characters after the column limit is changed to the colour set by SCI_SETEDGECOLOUR. This is recommended for proportional fonts.
EDGE_MULTILINE3This is similar to EDGE_LINE but in contrary to showing only one single + line a configurable set of vertical lines can be shown simultaneously. This edgeMode + uses a completely independent dataset that can only be configured by using the + SCI_MULTIEDGE* messages.

SCI_SETEDGECOLUMN(int column)
- SCI_GETEDGECOLUMN
+ SCI_GETEDGECOLUMN → int
These messages set and get the column number at which to display the long line marker. When drawing lines, the column sets a position in units of the width of a space character in STYLE_DEFAULT. When setting the background colour, the column is a character count (allowing for tabs) into the line.

-

SCI_SETEDGECOLOUR(int colour)
- SCI_GETEDGECOLOUR
+

SCI_SETEDGECOLOUR(colour edgeColour)
+ SCI_GETEDGECOLOUR → colour
These messages set and get the colour of the marker used to show that a line has exceeded the length set by SCI_SETEDGECOLUMN.

+

SCI_MULTIEDGEADDLINE(int column, + colour edgeColour)
+ SCI_MULTIEDGECLEARALL
+ SCI_MULTIEDGEADDLINE adds a new vertical edge to the view. The edge will be + displayed at the given column number. The resulting edge position depends on the metric + of a space character in STYLE_DEFAULT. All the edges can be cleared with + SCI_MULTIEDGECLEARALL.

+ +

Accessibility

+ +

Scintilla supports some platform accessibility features. + This support differs between platforms. + On GTK+ and Cocoa the platform accessibility APIs are implemented sufficiently to + make screen readers work. + On Win32, the system caret is manipulated to help screen readers. +

+ + SCI_SETACCESSIBILITY(int accessibility)
+ SCI_GETACCESSIBILITY → int
+
+ +

SCI_SETACCESSIBILITY(int accessibility)
+ SCI_GETACCESSIBILITY → int
+ These messages may enable or disable accessibility and report its current status.

+ +

On most platforms, accessibility is either implemented or not implemented and this can be + discovered with SCI_GETACCESSIBILITY with + SCI_SETACCESSIBILITY performing no action. + On GTK+, there are storage and performance costs to accessibility, so it can be disabled + by calling SCI_SETACCESSIBILITY. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueAccessibility status
SC_ACCESSIBILITY_DISABLED0Accessibility is disabled.
SC_ACCESSIBILITY_ENABLED1Accessibility is enabled.
+

Lexer

If you define the symbol SCI_LEXER when building Scintilla, (this is sometimes @@ -6063,38 +6773,42 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ functions: GetLexerCount, GetLexerName, and GetLexerFactory. See externalLexer.cxx for more.

SCI_SETLEXER(int lexer)
- SCI_GETLEXER
+ SCI_GETLEXER → int
SCI_SETLEXERLANGUAGE(<unused>, const char - *name)
- SCI_GETLEXERLANGUAGE(<unused>, char - *name)
+ *language)
+ SCI_GETLEXERLANGUAGE(<unused>, char *language) → int
SCI_LOADLEXERLIBRARY(<unused>, const char *path)
SCI_COLOURISE(int start, int end)
- SCI_CHANGELEXERSTATE(int start, int end)
- SCI_PROPERTYNAMES(<unused>, char *names)
- SCI_PROPERTYTYPE(const char *name)
- SCI_DESCRIBEPROPERTY(const char *name, char *description)
+ SCI_CHANGELEXERSTATE(int start, int end) → int
+ SCI_PROPERTYNAMES(<unused>, char *names) → int
+ SCI_PROPERTYTYPE(const char *name) → int
+ SCI_DESCRIBEPROPERTY(const char *name, char *description) → int
SCI_SETPROPERTY(const char *key, const char *value)
- SCI_GETPROPERTY(const char *key, char *value)
- SCI_GETPROPERTYEXPANDED(const char *key, char *value)
- SCI_GETPROPERTYINT(const char *key, int default)
- SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions)
+ SCI_GETPROPERTY(const char *key, char *value) → int
+ SCI_GETPROPERTYEXPANDED(const char *key, char *value) → int
+ SCI_GETPROPERTYINT(const char *key, int defaultValue) → int
+ SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions) → int
SCI_SETKEYWORDS(int keyWordSet, const char - *keyWordList)
+ *keyWords)
- SCI_GETSUBSTYLEBASES(<unused>, char *styles)
- SCI_DISTANCETOSECONDARYSTYLES
- SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)
+ SCI_GETSUBSTYLEBASES(<unused>, char *styles) → int
+ SCI_DISTANCETOSECONDARYSTYLES → int
+ SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles) → int
SCI_FREESUBSTYLES
- SCI_GETSUBSTYLESSTART(int styleBase)
- SCI_GETSUBSTYLESLENGTH(int styleBase)
- SCI_GETSTYLEFROMSUBSTYLE(int subStyle)
- SCI_GETPRIMARYSTYLEFROMSTYLE(int style)
+ SCI_GETSUBSTYLESSTART(int styleBase) → int
+ SCI_GETSUBSTYLESLENGTH(int styleBase) → int
+ SCI_GETSTYLEFROMSUBSTYLE(int subStyle) → int
+ SCI_GETPRIMARYSTYLEFROMSTYLE(int style) → int
SCI_SETIDENTIFIERS(int style, const char *identifiers)
+ SCI_PRIVATELEXERCALL(int operation, int pointer) → int
+ SCI_GETNAMEDSTYLES → int
+ SCI_NAMEOFSTYLE(int style, char *name) → int
+ SCI_TAGSOFSTYLE(int style, char *tags) → int
+ SCI_DESCRIPTIONOFSTYLE(int style, char *description) → int

SCI_SETLEXER(int lexer)
- SCI_GETLEXER
+ SCI_GETLEXER → int
You can select the lexer to use with an integer code from the SCLEX_* enumeration in Scintilla.h. There are two codes in this sequence that do not use lexers: SCLEX_NULL to select no lexing action and SCLEX_CONTAINER which sends @@ -6103,11 +6817,11 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCLEX_AUTOMATIC value; this identifies additional external lexers that Scintilla assigns unused lexer numbers to.

-

SCI_SETLEXERLANGUAGE(<unused>, const char *name)
- SCI_GETLEXERLANGUAGE(<unused>, char *name NUL-terminated)
+

SCI_SETLEXERLANGUAGE(<unused>, const char *language)
+ SCI_GETLEXERLANGUAGE(<unused>, char *language NUL-terminated) → int
SCI_SETLEXERLANGUAGE lets you select a lexer by name, and is the only method if you are using an external lexer or if you have written a lexer module for a language of your own and do not wish - to assign it an explicit lexer number. To select an existing lexer, set name to + to assign it an explicit lexer number. To select an existing lexer, set language to match the (case sensitive) name given to the module, for example "ada" or "python", not "Ada" or "Python". To locate the name for the built-in lexers, open the relevant Lex*.cxx file and search for LexerModule. The third argument in the @@ -6123,21 +6837,21 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.

-

SCI_COLOURISE(int startPos, int endPos)
+

SCI_COLOURISE(int start, int end)
This requests the current lexer or the container (if the lexer is set to - SCLEX_CONTAINER) to style the document between startPos and - endPos. If endPos is -1, the document is styled from - startPos to the end. If the "fold" property is set to + SCLEX_CONTAINER) to style the document between start and + end. If end is -1, the document is styled from + start to the end. If the "fold" property is set to "1" and your lexer or container supports folding, fold levels are also set. This message causes a redraw.

-

SCI_CHANGELEXERSTATE(int startPos, int endPos)
+

SCI_CHANGELEXERSTATE(int start, int end) → int
Indicate that the internal state of a lexer has changed over a range and therefore there may be a need to redraw.

-

SCI_PROPERTYNAMES(<unused>, char *names NUL-terminated)
- SCI_PROPERTYTYPE(const char *name)
- SCI_DESCRIBEPROPERTY(const char *name, char *description NUL-terminated)
+

SCI_PROPERTYNAMES(<unused>, char *names NUL-terminated) → int
+ SCI_PROPERTYTYPE(const char *name) → int
+ SCI_DESCRIBEPROPERTY(const char *name, char *description NUL-terminated) → int
Information may be retrieved about the properties that can be set for the current lexer. This information is only available for newer lexers. SCI_PROPERTYNAMES returns a string with all of the valid properties separated by "\n". @@ -6148,14 +6862,14 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

SCI_SETPROPERTY(const char *key, const char *value)
You can communicate settings to lexers with keyword:value string pairs. There is no limit to - the number of keyword pairs you can set, other than available memory. key is a - case sensitive keyword, value is a string that is associated with the keyword. If + the number of keyword pairs you can set, other than available memory. key is a + case sensitive keyword, value is a string that is associated with the keyword. If there is already a value string associated with the keyword, it is replaced. If you pass a zero - length string, the message does nothing. Both key and value are used - without modification; extra spaces at the beginning or end of key are + length string, the message does nothing. Both key and value are used + without modification; extra spaces at the beginning or end of key are significant.

-

The value string can refer to other keywords. For example, +

The value string can refer to other keywords. For example, SCI_SETPROPERTY("foldTimes10", "$(fold)0") stores the string "$(fold)0", but when this is accessed, the $(fold) is replaced by the value of the "fold" keyword (or by nothing if this keyword does not exist).

@@ -6176,7 +6890,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ Documentation for the property may be located above the call as a multi-line comment starting with
// property <property-name>

-

SCI_GETPROPERTY(const char *key, char *value NUL-terminated)
+

SCI_GETPROPERTY(const char *key, char *value NUL-terminated) → int
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied buffer and return the length (not including the terminating 0). If not found, copy an empty string to the buffer and return 0.

@@ -6187,7 +6901,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

If the value argument is 0 then the length that should be allocated to store the value is returned; again, the terminating 0 is not included.

-

SCI_GETPROPERTYEXPANDED(const char *key, char *value)
+

SCI_GETPROPERTYEXPANDED(const char *key, char *value) → int
Lookup a keyword:value pair using the specified key; if found, copy the value to the user-supplied buffer and return the length (not including the terminating 0). If not found, copy an empty string to the buffer and return 0.

@@ -6198,7 +6912,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

If the value argument is 0 then the length that should be allocated to store the value (including any indicated keyword replacement) is returned; again, the terminating 0 is not included.

-

SCI_GETPROPERTYINT(const char *key, int default)
+

SCI_GETPROPERTYINT(const char *key, int defaultValue) → int
Lookup a keyword:value pair using the specified key; if found, interpret the value as an integer and return it. If not found (or the value is an empty string) then return the supplied default. If the keyword:value pair is found but is not a number, then return 0.

@@ -6206,10 +6920,10 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){

Note that "keyword replacement" as described in SCI_SETPROPERTY will be performed before any numeric interpretation.

-

SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
+

SCI_SETKEYWORDS(int keyWordSet, const char *keyWords)
You can set up to 9 lists of keywords for use by the current lexer. - keyWordSet can be 0 to 8 (actually 0 to KEYWORDSET_MAX) - and selects which keyword list to replace. keyWordList is a list of keywords + keyWordSet can be 0 to 8 (actually 0 to KEYWORDSET_MAX) + and selects which keyword list to replace. keyWords is a list of keywords separated by spaces, tabs, "\n" or "\r" or any combination of these. It is expected that the keywords will be composed of standard ASCII printing characters, but there is nothing to stop you using any non-separator character codes from 1 to 255 @@ -6228,7 +6942,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ There is nothing to stop you building your own keyword lists into the lexer, but this means that the lexer must be rebuilt if more keywords are added.

-

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions NUL-terminated)
+

SCI_DESCRIBEKEYWORDSETS(<unused>, char *descriptions NUL-terminated) → int
A description of all of the keyword sets separated by "\n" is returned by SCI_DESCRIBEKEYWORDSETS.

Substyles

@@ -6237,38 +6951,58 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ purpose would exhaust the number of allowed styles quickly. This is alleviated by substyles which allow the application to determine how many sets of identifiers to allocate for each purpose. - Lexers have to explicitly support this feature by implementing the methods in ILexerWithSubStyles.

+ Lexers have to explicitly support this feature by implementing particular methods.

-

SCI_GETSUBSTYLEBASES(<unused>, char *styles NUL-terminated)
- Fill styles with a byte for each style that can be split into substyles.

+

SCI_GETSUBSTYLEBASES(<unused>, char *styles NUL-terminated) → int
+ Fill styles with a byte for each style that can be split into substyles.

-

SCI_DISTANCETOSECONDARYSTYLES
+

SCI_DISTANCETOSECONDARYSTYLES → int
Returns the distance between a primary style and its corresponding secondary style.

-

SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles)
+

SCI_ALLOCATESUBSTYLES(int styleBase, int numberStyles) → int
Allocate some number of substyles for a particular base style returning the first substyle number allocated. Substyles are allocated contiguously.

SCI_FREESUBSTYLES
Free all allocated substyles.

-

SCI_GETSUBSTYLESSTART(int styleBase)
- SCI_GETSUBSTYLESLENGTH(int styleBase)
+

SCI_GETSUBSTYLESSTART(int styleBase) → int
+ SCI_GETSUBSTYLESLENGTH(int styleBase) → int
Return the start and length of the substyles allocated for a base style.

-

SCI_GETSTYLEFROMSUBSTYLE(int subStyle)
+

SCI_GETSTYLEFROMSUBSTYLE(int subStyle) → int
For a sub style, return the base style, else return the argument.

-

SCI_GETPRIMARYSTYLEFROMSTYLE(int style)
+

SCI_GETPRIMARYSTYLEFROMSTYLE(int style) → int
For a secondary style, return the primary style, else return the argument.

SCI_SETIDENTIFIERS(int style, const char *identifiers)
Similar to SCI_SETKEYWORDS but for substyles. The prefix feature available with SCI_SETKEYWORDS is not implemented for SCI_SETIDENTIFIERS.

+

SCI_PRIVATELEXERCALL(int operation, int pointer) → int
+ Call into a lexer in a way not understood by Scintilla.

+ +

Style Metadata

+

Lexers may provide information on the styles they use. + Lexers have to explicitly support this feature by implementing particular methods.

+ +

SCI_GETNAMEDSTYLES → int
+ Retrieve the number of named styles for the lexer.

+ +

SCI_NAMEOFSTYLE(int style, char *name) → int
+ Retrieve the name of a style. This is a C preprocessor symbol like "SCE_C_COMMENTDOC".

+ +

SCI_TAGSOFSTYLE(int style, char *tags) → int
+ Retrieve the tags of a style. This is a space-separated set of words like "comment documentation".

+ +

SCI_DESCRIPTIONOFSTYLE(int style, char *description) → int
+ Retrieve an English-language description of a style which may be suitable for display in a user interface. + This looks like "Doc comment: block comments beginning with /** or /*!".

+

Lexer Objects

-

Lexers are programmed as objects that implement the ILexer interface and that interact +

Lexers are programmed as objects that implement the ILexer4 interface and that interact with the document they are lexing through the IDocument interface. Previously lexers were defined by providing lexing and folding functions but creating an object to handle the interaction of a lexer with a document allows the lexer to store state information that @@ -6276,86 +7010,50 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ or variable declarations and style these depending on their role.

A set of helper classes allows older lexers defined by functions to be used in Scintilla.

-

ILexer

+

ILexer4

-class ILexer {
+class ILexer4 {
public:
-    virtual - int SCI_METHOD - Version() -const = - 0;
-    virtual - void SCI_METHOD - Release() -= 0;
-    virtual -const -char -* -SCI_METHOD PropertyNames() - = 0;
-    virtual - int SCI_METHOD PropertyType(const char *name) = 0;
-    virtual - const char * SCI_METHOD DescribeProperty(const char *name) = 0;
-    virtual - int SCI_METHOD - PropertySet(const - char - *key, - const -char *val) - = - 0;
-    virtual -const char -* SCI_METHOD DescribeWordListSets() - = -0;
-    virtual - int SCI_METHOD - WordListSet(int - n, - const -char *wl) - = - 0;
-    virtual - void SCI_METHOD - Lex(unsigned - int - startPos, - int - lengthDoc, -int initStyle, - IDocument -*pAccess) - = -0;
-    virtual - void SCI_METHOD - Fold(unsigned - int startPos, - int - lengthDoc, -int initStyle, - IDocument -*pAccess) - = -0;
-    virtual - void -* SCI_METHOD -PrivateCall(int - operation, -void -*pointer) -= 0;
+        virtual int SCI_METHOD Version() const = 0;
+        virtual void SCI_METHOD Release() = 0;
+        virtual const char * SCI_METHOD PropertyNames() = 0;
+        virtual int SCI_METHOD PropertyType(const char *name) = 0;
+        virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
+        virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0;
+        virtual const char * SCI_METHOD DescribeWordListSets() = 0;
+        virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0;
+        virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
+        virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
+        virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
+        virtual int SCI_METHOD LineEndTypesSupported() = 0;
+        virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
+        virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
+        virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
+        virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0;
+        virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0;
+        virtual void SCI_METHOD FreeSubStyles() = 0;
+        virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
+        virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
+        virtual const char * SCI_METHOD GetSubStyleBases() = 0;
+        virtual int SCI_METHOD NamedStyles() = 0;
+        virtual const char * SCI_METHOD NameOfStyle(int style) = 0;
+        virtual const char * SCI_METHOD TagsOfStyle(int style) = 0;
+        virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0;
};
+

+The types Sci_Position and Sci_PositionU are used for positions and line numbers in the document. +With Scintilla 4, 64-bit builds define these as 64-bit types to allow future implementation of documents larger than 2 GB. +

+ +

+Methods that return strings as const char * are not required to maintain separate allocations indefinitely: +lexer implementations may own a single buffer that is reused for each call. +Callers should make an immediate copy of returned strings. +

+

The return values from PropertySet and WordListSet are used to indicate whether the change requires performing lexing or folding over any of the document. It is the position at which to restart lexing and folding or -1 @@ -6365,7 +7063,7 @@ optimisation could be to remember where a setting first affects the document and

Version returns an enumerated value specifying which version of the interface is implemented: -lvOriginal for ILexer and lvSubStyles for ILexerWithSubStyles.

+lvRelease4 for ILexer4. Prior to Scintilla 4.0 different values were possible.

Release is called to destroy the lexer object.

@@ -6383,160 +7081,44 @@ needs to be folded as this allowed fixing up the last line from the previous fol The new approach allows the lexer to decide whether to backtrack or to handle this more efficiently.

-

ILexerWithSubStyles

- -

-To allow lexers to report which line ends they support, and to support substyles, -Ilexer is extended to ILexerWithSubStyles. +

NamedStyles, NameOfStyle, +TagsOfStyle, and DescriptionOfStyle +are used to provide information on the set of styles used by this lexer. +NameOfStyle is the C-language identifier like "SCE_LUA_COMMENT". +TagsOfStyle is a set of tags describing the style in a standardized way like "literal string multiline raw". +A set of common tags and conventions for combining them is described here. +DescriptionOfStyle is an English description of the style like "Function or method name definition".

-
-class ILexerWithSubStyles : public ILexer {
-public:
-        virtual int SCI_METHOD LineEndTypesSupported() = 0;
-        virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
-        virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
-        virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
-        virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0;
-        virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0;
-        virtual void SCI_METHOD FreeSubStyles() = 0;
-        virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
-        virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
-        virtual const char * SCI_METHOD GetSubStyleBases() = 0;
-};
-
-

IDocument

-class IDocument - {
+class IDocument {
public:
-    virtual - int SCI_METHOD - Version() -const = - 0;
-    virtual - void SCI_METHOD - SetErrorStatus(int - status) - = -0;
-    virtual - int SCI_METHOD - Length() -const = - 0;
-    virtual - void SCI_METHOD - GetCharRange(char - *buffer, - int -position, -int lengthRetrieve) - const - = -0;
-    virtual - char SCI_METHOD - StyleAt(int - position) -const = - 0;
-    virtual - int SCI_METHOD - LineFromPosition(int position) - const = - 0;
-    virtual -int SCI_METHOD - LineStart(int line) - const = - 0;
-    virtual -int SCI_METHOD - GetLevel(int line) - -const = -0;
-    virtual -int SCI_METHOD - SetLevel(int - line, -int level) - = -0;
-    virtual - int SCI_METHOD - GetLineState(int - line) - const -= 0 -;
-    virtual - int SCI_METHOD - SetLineState(int - line, - int state) - = - 0;
-    virtual - void SCI_METHOD - StartStyling(int - position, - char mask) - = - 0;
-    virtual bool - SCI_METHOD - SetStyleFor(int - length, - char style) - = 0 -;
-     virtual - bool SCI_METHOD - SetStyles(int - length, -const char - *styles) - = -0;
-    virtual void - SCI_METHOD - DecorationSetCurrentIndicator(int - indicator) - = - 0;
-    virtual - void SCI_METHOD - DecorationFillRange(int - position, - int value, - int fillLength) - - = -0;
-    virtual - void SCI_METHOD - ChangeLexerState(int - start, - int end) - = - 0;
-    virtual - int SCI_METHOD - CodePage() - const -= 0 -;
-    virtual bool - SCI_METHOD - IsDBCSLeadByte(char - ch) - const = - 0;
+        virtual int SCI_METHOD Version() const = 0;
+        virtual void SCI_METHOD SetErrorStatus(int status) = 0;
+        virtual Sci_Position SCI_METHOD Length() const = 0;
+        virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0;
+        virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0;
+        virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0;
+        virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0;
+        virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0;
+        virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0;
+        virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0;
+        virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0;
+        virtual void SCI_METHOD StartStyling(Sci_Position position) = 0;
+        virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0;
+        virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0;
+        virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
+        virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0;
+        virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0;
+        virtual int SCI_METHOD CodePage() const = 0;
+        virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
+        virtual const char * SCI_METHOD BufferPointer() = 0;
+        virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0;
+        virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0;
+        virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0;
+        virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0;
};
@@ -6556,36 +7138,29 @@ exceptions. Exceptions should not be thrown over build boundaries as the two sides may be built with different compilers or incompatible exception options.

-

IDocumentWithLineEnd

-

To allow lexers to determine the end position of a line and thus more easily support Unicode line ends -IDocument is extended to IDocumentWithLineEnd.

+IDocument includes LineEnd which should be used rather than testing for specific +line end characters.

GetRelativePosition navigates the document by whole characters, returning INVALID_POSITION for movement beyond the start and end of the document.

GetCharacterAndWidth provides a standard conversion from UTF-8 bytes to a UTF-32 character or from DBCS to a 16 bit value. Bytes in invalid UTF-8 are reported individually with values 0xDC80+byteValue, which are not valid Unicode code points. -The pWidth argument can be NULL if the caller does not need to know the number of +The pWidth argument can be NULL if the caller does not need to know the number of bytes in the character.

-
-class IDocumentWithLineEnd : public IDocument {
-public:
-        virtual int SCI_METHOD LineEnd(int line) const = 0;
-        virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0;
-        virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0;
-};
-
- -

The ILexer, ILexerWithSubStyles, IDocument, and -IDocumentWithLineEnd interfaces may be -expanded in the future with extended versions (ILexer2...). +

The ILexer4 and IDocument interfaces may be +expanded in the future with extended versions (ILexer5...). The Version method indicates which interface is implemented and thus which methods may be called.

+

Scintilla 4 changed the definition of IDocument by merging the previously separate +IDocumentWithLineEnd interface and +removing the mask parameter to StartStyling.

+

Notifications

Notifications are sent (fired) from the Scintilla control to its container when an event has @@ -6601,7 +7176,7 @@ implemented and thus which methods may be called.

The container is passed a SCNotification structure containing information about the event.

-struct NotifyHeader {   // This matches the Win32 NMHDR structure
+struct Sci_NotifyHeader {   // This matches the Win32 NMHDR structure
     void *hwndFrom;     // environment specific window handle/pointer
     uptr_t idFrom;        // CtrlID of the window issuing the notification
     unsigned int code;  // The SCN_* notification code
@@ -6609,37 +7184,43 @@ struct NotifyHeader {   // This matches the Win32 NMHDR structure
 
 struct SCNotification {
 	struct Sci_NotifyHeader nmhdr;
-	int position;
+	Sci_Position position;
 	/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
-	/* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
-	/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
-	/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
-	/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
+	/* SCN_MARGINRIGHTCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, */
+	/* SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
+	/* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
+	/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_AUTOCSELECTIONCHANGE */
 
-	int ch;		/* SCN_CHARADDED, SCN_KEY */
+	int ch;
+	/* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETE, SCN_AUTOCSELECTION, */
+	/* SCN_USERLISTSELECTION */
 	int modifiers;
 	/* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
 	/* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
 
 	int modificationType;	/* SCN_MODIFIED */
 	const char *text;
-	/* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
+	/* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED, */
+	/* SCN_AUTOCSELECTIONCHANGE */
 
-	int length;		/* SCN_MODIFIED */
-	int linesAdded;	/* SCN_MODIFIED */
+	Sci_Position length;		/* SCN_MODIFIED */
+	Sci_Position linesAdded;	/* SCN_MODIFIED */
 	int message;	/* SCN_MACRORECORD */
 	uptr_t wParam;	/* SCN_MACRORECORD */
 	sptr_t lParam;	/* SCN_MACRORECORD */
-	int line;		/* SCN_MODIFIED */
+	Sci_Position line;		/* SCN_MODIFIED */
 	int foldLevelNow;	/* SCN_MODIFIED */
 	int foldLevelPrev;	/* SCN_MODIFIED */
-	int margin;		/* SCN_MARGINCLICK */
-	int listType;	/* SCN_USERLISTSELECTION */
+	int margin;		/* SCN_MARGINCLICK, SCN_MARGINRIGHTCLICK */
+	int listType;	/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTIONCHANGE */
 	int x;			/* SCN_DWELLSTART, SCN_DWELLEND */
 	int y;		/* SCN_DWELLSTART, SCN_DWELLEND */
 	int token;		/* SCN_MODIFIED with SC_MOD_CONTAINER */
 	int annotationLinesAdded;	/* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
 	int updated;	/* SCN_UPDATEUI */
+	int listCompletionMethod;
+	/* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */
+
 };
 
@@ -6674,15 +7255,20 @@ struct SCNotification { SCN_AUTOCCHARDELETED
SCN_FOCUSIN
SCN_FOCUSOUT
+ SCN_AUTOCCOMPLETED
+ SCN_MARGINRIGHTCLICK
+ SCN_AUTOCSELECTIONCHANGE

The following SCI_* messages are associated with these notifications:

SCI_SETMODEVENTMASK(int eventMask)
- SCI_GETMODEVENTMASK
- SCI_SETMOUSEDWELLTIME(int milliseconds)
- SCI_GETMOUSEDWELLTIME
+ SCI_GETMODEVENTMASK → int
+ SCI_SETCOMMANDEVENTS(bool commandEvents)
+ SCI_GETCOMMANDEVENTS → bool
+ SCI_SETMOUSEDWELLTIME(int periodMilliseconds)
+ SCI_GETMOUSEDWELLTIME → int
SCI_SETIDENTIFIER(int identifier)
- SCI_GETIDENTIFIER
+ SCI_GETIDENTIFIER → int

The following additional notifications are sent using a secondary "command" method and should @@ -6699,7 +7285,7 @@ struct SCNotification {

SCI_SETIDENTIFIER(int identifier)
- SCI_GETIDENTIFIER
+ SCI_GETIDENTIFIER → int
These two messages set and get the identifier of the Scintilla instance which is included in notifications as the idFrom field. When an application creates multiple Scintilla widgets, this allows the source of each notification to be found. @@ -6714,14 +7300,14 @@ struct SCNotification { href="#SCI_SETLEXER">SCI_SETLEXER(SCLEX_CONTAINER) to make the container act as the lexer, you will receive this notification when Scintilla is about to display or print text that requires styling. You are required to style the text from the line that contains the position - returned by SCI_GETENDSTYLED up to + returned by SCI_GETENDSTYLED up to the position passed in SCNotification.position. Symbolically, you need code of the form:

-    startPos = SCI_GETENDSTYLED()
-    lineNumber = SCI_GETENDSTYLED()
+    lineNumber = SCI_LINEFROMPOSITION(startPos);
-    startPos = SCI_POSITIONFROMLINE(lineNumber);
     MyStyleRoutine(startPos, SCNotification.position);
 
@@ -6761,10 +7347,12 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); held down in a similar manner to SCN_KEY.

SCN_UPDATEUI
- Either the text or styling of the document has changed or the selection range or scroll position has changed. + Either the text or styling of the document has changed or the selection range or scroll position may have changed. Now would be a good time to update any container UI elements that depend on document or view state. + As it is sometimes difficult to determine whether a change has occurred, these events may also fire when there + has been no actual change. The updated field is set to the bit set of things changed since the previous notification.

- +
@@ -6782,7 +7370,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -6791,7 +7379,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -6800,7 +7388,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -6809,7 +7397,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -6824,7 +7412,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); while in a SCN_MODIFIED event. The SCNotification fields used are:

-
Symbol0x01Contents, styling or markers have been changed.Contents, styling or markers may have been changed.
0x02Selection has been changed.Selection may have been changed.
0x04Scrolled vertically.May have scrolled vertically.
0x08Scrolled horizontally.May have scrolled horizontally.
+
@@ -6850,7 +7438,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - @@ -6897,7 +7485,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); SC_PERFORMED_* bits tell you if the action was done by the user, or the result of Undo or Redo of a previous action.

-
Field
lengthLength of the change in cells or characters when the text or styling + Length of the change in bytes when the text or styling changes. Set to 0 if not used.
+
@@ -7018,7 +7606,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -7046,7 +7634,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - @@ -7057,8 +7645,8 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); - + @@ -7099,7 +7687,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); @@ -7163,10 +7751,12 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); EN_CHANGE). No other information is sent. If you need more detailed information use SCN_MODIFIED. You can filter the types of changes you are notified about with SCI_SETMODEVENTMASK.

+ href="#SCI_SETMODEVENTMASK">SCI_SETMODEVENTMASK and + SCI_SETCOMMANDEVENTS.

SCI_SETMODEVENTMASK(int eventMask)
- SCI_GETMODEVENTMASK
+ SCI_GETMODEVENTMASK → int
These messages set and get an event mask that determines which document change events are notified to the container with SCN_MODIFIED and SCI_POSITIONFROMLINE(lineNumber); SC_MOD_BEFOREINSERT, SC_MOD_BEFOREDELETE, SC_MULTILINEUNDOREDO, and SC_MODEVENTMASKALL.

+

SCI_SETCOMMANDEVENTS(bool commandEvents)
+ SCI_GETCOMMANDEVENTS → bool
+ These messages set and get whether SCEN_* command events are + sent to the container. For SCEN_CHANGE this acts as an additional filter over + SCI_SETMODEVENTMASK. + Most applications should set this off to avoid overhead and only use + SCN_MODIFIED.

+

SCEN_SETFOCUS
SCEN_KILLFOCUS
SCEN_SETFOCUS (512) is fired when Scintilla receives focus and @@ -7202,7 +7800,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber); Editor::NotifyMacroRecord. The fields of SCNotification set in this notification are:

-
SymbolText is about to be inserted into the document.position, if performed by user then text in cells, length in cellsposition, if performed by user then text in bytes, length in bytes
0x8000A line state has changed because SCI_SETLINESTATE + A line state has changed because SCI_SETLINESTATE was called. line0x200000The explicit tab stops on a line have changed because SCI_CLEARTABSTOPS or - SCI_ADDTABSTOP was called.The explicit tab stops on a line have changed because SCI_CLEARTABSTOPS or + SCI_ADDTABSTOP was called. line
0x100000 Text is about to be inserted. The handler may change the text being inserted by calling - SCI_CHANGEINSERTION. + SCI_CHANGEINSERTION. No other modifications may be made in this handler. position, length, text
+
@@ -7233,13 +7831,14 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(lineNumber);
Field

SCN_MARGINCLICK
- This notification tells the container that the mouse was clicked inside a SCN_MARGINRIGHTCLICK

+ These notifications tell the container that the mouse was clicked or right clicked inside a
margin that was marked as sensitive (see SCI_SETMARGINSENSITIVEN). This can be used to perform folding or to place breakpoints. The following SCNotification fields are used:

- +
@@ -7297,7 +7896,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next The user has selected an item in a user list. The SCNotification fields used are:

-
Field
+
@@ -7326,11 +7925,24 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next + + + + + + + + + +
FieldThe position the list was displayed at.
chIf a fillup character was the method of selection, the used + character, otherwise 0.
listCompletionMethodA value indicating the way in which the completion + occurred. See the table below.

- + See the SCN_AUTOCCOMPLETED notification + for the possible values for listCompletionMethod.

SCN_URIDROPPED
Only on the GTK+ version. Indicates that the user has dragged a URI such as a file name or Web address onto Scintilla. The container could interpret this as a request to open the file. The @@ -7345,7 +7957,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next key press indicates the dwell is over. Both notifications set the same fields in SCNotification:

- +
@@ -7373,15 +7985,15 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
Field

-

SCI_SETMOUSEDWELLTIME(int milliseconds)
- SCI_GETMOUSEDWELLTIME
+

SCI_SETMOUSEDWELLTIME(int periodMilliseconds)
+ SCI_GETMOUSEDWELLTIME → int
These two messages set and get the time the mouse must sit still, in milliseconds, to generate a SCN_DWELLSTART notification. If set to SC_TIME_FOREVER, the default, no dwell events are generated.

SCN_ZOOM
This notification is generated when the user zooms the display using the keyboard or the - SCI_SETZOOM method is called. This + SCI_SETZOOM method is called. This notification can be used to recalculate positions, such as the width of the line number margin to maintain sizes in terms of characters rather than pixels. SCNotification has no additional information.

@@ -7421,7 +8033,7 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next SCI_AUTOCCANCEL message before returning from the notification. The SCNotification fields used are:

- +
@@ -7441,6 +8053,82 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next + + + + + + + + + + + +
FieldThe text of the selection.
chIf a fillup character was the method of selection, the used + character, otherwise 0.
listCompletionMethodA value indicating the way in which the completion + occurred. See the table below.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SymbolValueMeaning
SC_AC_FILLUP1A fillup character triggered the completion. The character used is + in ch.
SC_AC_DOUBLECLICK2A double-click triggered the completion. ch is 0.
SC_AC_TAB3The tab key or SCI_TAB triggered the completion. ch is 0.
SC_AC_NEWLINE4A new line or SCI_NEWLINE triggered the completion. ch is 0.
SC_AC_COMMAND5The + + SCI_AUTOCSELECT message + triggered the completion. ch is 0.
@@ -7452,6 +8140,51 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next The user deleted a character while autocompletion list was active. There is no other information in SCNotification.

+ +

SCN_AUTOCCOMPLETED
+
This notification is generated after an autocompletion has inserted its + text. The fields are identical to the + + SCN_AUTOCSELECTION + notification.

+ +

SCN_AUTOCSELECTIONCHANGE
+
This notification is sent when items are highlighted in an autocompletion or user list. + The + SCNotification fields used are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldUsage
listTypeThis is set to the listType parameter from the SCI_USERLISTSHOW message + or 0 for an autocompletion.
textThe text of the selection.
positionThe position the list was displayed at.
+

SCN_FOCUSIN
SCN_FOCUSOUT
SCN_FOCUSIN (2028) is fired when Scintilla receives focus and @@ -7519,9 +8252,9 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next widgets.

void scintilla_set_id(ScintillaObject *sci, uptr_t id)
- Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all + Set the control ID which will be used in the idFrom field of the Sci_NotifyHeader structure of all notifications for this instance. - This is equivalent to SCI_SETIDENTIFIER.

+ This is equivalent to SCI_SETIDENTIFIER.

sptr_t scintilla_send_message(ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam)
The main entry point allows sending any of the messages described in this document.

@@ -7536,13 +8269,6 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next

Provisional features are displayed in this document with a distinctive background colour.

-

There are currently no provisional messages. - The SC_TECHNOLOGY_DIRECTWRITERETAIN and - SC_TECHNOLOGY_DIRECTWRITEDC values for - SCI_SETTECHNOLOGY are provisional.

- -

Using C++11 <regex> is provisional.

-

Some developers may want to only use features that are stable and have graduated from provisional status. To avoid using provisional messages compile with the symbol SCI_DISABLE_PROVISIONAL defined.

@@ -7600,25 +8326,35 @@ EM_FORMATRANGE INCLUDE_DEPRECATED_FEATURES in Scintilla.h. To ensure future compatibility you should change them as indicated.

-

SC_CP_DBCS Deprecated
- This was used to set a DBCS (Double Byte Character Set) mode on GTK+. - An explicit DBCS code page should be used when calling SCI_SETCODEPAGE

+ + SCI_SETKEYSUNICODE(bool keysUnicode)
+ SCI_GETKEYSUNICODE → bool
+ SCI_SETTWOPHASEDRAW(bool twoPhase)
+ SCI_GETTWOPHASEDRAW → bool
+ SCI_SETSTYLEBITS(int bits)
+ SCI_GETSTYLEBITS → int
+ SCI_GETSTYLEBITSNEEDED → int
+
-

SCI_SETUSEPALETTE(bool allowPaletteUse) Deprecated
- SCI_GETUSEPALETTE Deprecated
- Scintilla no longer supports palette mode. The last version to support palettes was 2.29. - Any calls to these methods should be removed.

-

SCI_SETKEYSUNICODE(bool keysUnicode) Deprecated
- SCI_GETKEYSUNICODE Deprecated
+ SCI_GETKEYSUNICODE → bool Deprecated
On Windows, Scintilla no longer supports narrow character windows so input is always treated as Unicode.

+

SCI_SETTWOPHASEDRAW(bool twoPhase)
+ SCI_GETTWOPHASEDRAW → bool
+ This property has been replaced with the preceding PHASESDRAW property which is more general, + allowing multiple phase drawing as well as one and two phase drawing.

+ +

Single phase drawing SC_PHASES_ONE, is deprecated and should be replaced with + 2-phase SC_PHASES_TWO or multi-phase SC_PHASES_MULTIPLE drawing. +

+

The following are features that should be removed from calling code but are still defined to avoid breaking callers.

SCI_SETSTYLEBITS(int bits) Deprecated
- SCI_GETSTYLEBITS Deprecated
- SCI_GETSTYLEBITSNEEDED Deprecated
+ SCI_GETSTYLEBITS → int Deprecated
+ SCI_GETSTYLEBITSNEEDED → int Deprecated
INDIC0_MASK, INDIC1_MASK, INDIC2_MASK, INDICS_MASK Deprecated
Scintilla no longer supports style byte indicators. The last version to support style byte indicators was 3.4.2. Any use of these symbols should be removed and replaced with standard indicators. @@ -7662,6 +8398,17 @@ EM_SETTARGETDEVICE

Removed features

+

These features have now been removed completely.

+ +

SC_CP_DBCS Removed in 2016 with release 3.7.1
+ This was used to set a DBCS (Double Byte Character Set) mode on GTK+. + An explicit DBCS code page should be used when calling SCI_SETCODEPAGE

+ +

SCI_SETUSEPALETTE(bool usePalette) Removed in 2016 with release 3.7.1
+ SCI_GETUSEPALETTE → bool Removed in 2016 with release 3.7.1
+ Scintilla no longer supports palette mode. The last version to support palettes was 2.29. + Any calls to these methods must be removed.

+

Previous versions of Scintilla allowed indicators to be stored in bits of each style byte. This was deprecated in 2007 and removed in 2014 with release 3.4.3. All uses of style byte indicators should be replaced with standard indicators.

@@ -7669,21 +8416,23 @@ EM_SETTARGETDEVICE

Building Scintilla

To build Scintilla or SciTE, see the README file present in both the Scintilla and SciTE - directories. For Windows, GCC 4.7 or Microsoft Visual C++ 2010 can be used - for building. For GTK+, GCC 4.1 or newer should be used. GTK+ 2.8+ and 3.x are - supported. The version of GTK+ installed should be detected automatically. + directories. + The compiler must support C++17. + For Windows, GCC 7.1 or Microsoft Visual C++ 2017.5 can be used + for building. For GTK+, GCC 7.1 or newer should be used. GTK+ 2.24 and 3.x are + supported with glib 2.22+. The version of GTK+ installed should be detected automatically. When both GTK+ 2 and GTK+ 3 are present, building for GTK+ 3.x requires defining GTK3 on the command line.

Static linking

On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to - link Scintilla directly into your application .EXE or .DLL file, then the - STATIC_BUILD preprocessor symbol should be defined and - Scintilla_RegisterClasses called. STATIC_BUILD prevents compiling the - DllMain function which will conflict with any DllMain defined in your - code. Scintilla_RegisterClasses takes the HINSTANCE of your + link Scintilla directly into your application .EXE or .DLL file, then you can link to the static library + bin/libscintilla.lib (or .a if using GCC) and call Scintilla_RegisterClasses. + Scintilla_RegisterClasses takes the HINSTANCE of your application and ensures that the "Scintilla" window class is registered.

+

When producing a stand-alone Scintilla DLL, the ScintillaDLL.cxx file should be compiled and + linked in to provide DllMain and Scintilla_RegisterClasses.

Ensuring lexers are linked into Scintilla

diff --git a/scintilla/doc/ScintillaDownload.html b/scintilla/doc/ScintillaDownload.html index 48b88dc4..c144792e 100644 --- a/scintilla/doc/ScintillaDownload.html +++ b/scintilla/doc/ScintillaDownload.html @@ -6,6 +6,7 @@ + Download Scintilla @@ -25,9 +26,9 @@ @@ -41,7 +42,7 @@ containing very few restrictions.

- Release 3.5.6 + Release 4.1.4

Source Code @@ -49,8 +50,8 @@ The source code package contains all of the source code for Scintilla but no binary executable code and is available in
    -
  • zip format (1450K) commonly used on Windows
  • -
  • tgz format (1300K) commonly used on Linux and compatible operating systems
  • +
  • zip format (1700K) commonly used on Windows
  • +
  • tgz format (1500K) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html index 87bf61d8..7e7190bc 100644 --- a/scintilla/doc/ScintillaHistory.html +++ b/scintilla/doc/ScintillaHistory.html @@ -6,6 +6,7 @@ + Scintilla and SciTE @@ -110,6 +111,8 @@

+ + @@ -472,6 +475,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- + Windows   - + GTK+/Linux   Willy Devaux David Clain Brendon Yenson
Philipp
Vamsi Potluru Praveen AmbekarStefan Küng
Jiří TechetJonathan HuntSerg StetsukJordan Jueckstock
Yury DubinskySam HocevarLuyomiMatt Gilarde
Mark CJohannes SasongkofstirlitzRobin Haberkorn
Pavel SountsovDirk LorenzenKasper B. GraversenChris Mayo
Van de BuggerTse Kit YamSmartShare SystemsMorten Brørup
Alexey DenisovJustin DaileyoirfeodentA-R-C-A
Roberto RossiKenny LiuIain Clarkedesto
John FlatnessThorsten KaniBernhard M. WiedemannBaldur Karlsson
Martin KleusbergJannickZufu LiuSimon Sobisch
Georger AraújoTobias KühneDimitar RadevLiang Bai
Gunter KönigsmannNicholai BenalalUnifaceRaghda Morsy
Giuseppe CorbelliAndreas RönnquistHenrik HankLuke Rasmussen
maboroshinGokul KrishnanJohn Horiganjj5
Jad AltahanAndrea Ricchi

@@ -484,7 +553,1818 @@

- Release 3.5.6 + Release 4.1.4 +

+
    +
  • + Released 7 March 2019. +
  • +
  • + Calltips implemented on Qt. + Bug #1548. +
  • +
  • + Block caret in overtype mode SCI_SETCARETSTYLE(caretStyle | CARETSTYLE_OVERSTRIKE_BLOCK). + Feature #1217. +
  • +
  • + SciTE supports changing caret style via caret.style property. + Feature #1624. +
  • +
  • + Lexer added for .NET's Common Intermediate Language CIL. + Feature #1265. +
  • +
  • + The C++ lexer, with styling.within.preprocessor on, now interprets "(" in preprocessor "#if(" + as an operator instead of part of the directive. This improves folding as well which could become + unbalanced. +
  • +
  • + Fix raw strings in Nim. + Feature #1253. +
  • +
  • + Fix inconsistency with dot styling in Nim. + Feature #1260. +
  • +
  • + Enhance the styling of backticks in Nim. + Feature #1261. +
  • +
  • + Enhance raw string identifier styling in Nim. + Feature #1262. +
  • +
  • + Fix fold behaviour with comments in Nim. + Feature #1254. +
  • +
  • + Fix TCL lexer recognizing '"' after "," inside a bracketed substitution. + Bug #1947. +
  • +
  • + Fix garbage text from SCI_MOVESELECTEDLINESUP and SCI_MOVESELECTEDLINESDOWN + for rectangular or thin selection by performing no action. + Bug #2078. +
  • +
  • + Ensure container notified if Insert pressed when caret off-screen. + Bug #2083. +
  • +
  • + Fix memory leak when checking running instance on GTK. + Feature #1267. +
  • +
  • + Platform layer font cache removed on Win32 as there is a platform-independent cache. +
  • +
  • + SciTE for GTK easier to build on macOS. + Bug #2084. +
  • +
+

+ Release 4.1.3 +

+
    +
  • + Released 10 January 2019. +
  • +
  • + Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they + can be a significant performance cost. +
  • +
  • + Improve efficiency of idle wrapping by wrapping in blocks as large as possible while + still remaining responsive. +
  • +
  • + Updated case conversion and character categories to Unicode 11. +
  • +
  • + Errorlist lexer recognizes negative line numbers as some programs show whole-file + errors occurring on line -1. + SciTE's parsing of diagnostics also updated to handle this case. +
  • +
  • + Added "nim" lexer (SCLEX_NIM) for the Nim language which was previously called Nimrod. + For compatibility, the old "nimrod" lexer is still present but is deprecated and will be removed at the + next major version. + Feature #1242. +
  • +
  • + The Bash lexer implements substyles for multiple sets of keywords and supports SCI_PROPERTYNAMES. + Bug #2054. +
  • +
  • + The C++ lexer interprets continued preprocessor lines correctly by reading all of + the logical line. + Bug #2062. +
  • +
  • + The C++ lexer interprets preprocessor arithmetic expressions containing multiplicative and additive + operators correctly by following operator precedence rules. + Bug #2069. +
  • +
  • + The EDIFACT lexer handles message groups as well as messages. + Feature #1247. +
  • +
  • + For SciTE's Find in Files, allow case-sensitivity and whole-word options when running + a user defined command. + Bug #2053. +
  • +
  • + Notify with SC_UPDATE_SELECTION when user performs a multiple selection add. +
  • +
  • + On macOS 10.14 Cocoa, fix incorrect horizontal offset. + Bug #2022. +
  • +
  • + On Cocoa, fix a crash that occurred when entering a dead key diacritic then a character + that can not take that diacritic, such as option+e (acute accent) followed by g. + Bug #2061. +
  • +
  • + On Cocoa, use dark info bar background when system is set to Dark Appearance. + Bug #2055. +
  • +
  • + Fixed a crash on Cocoa in bidirectional mode where some patterns of invalid UTF-8 + caused failures to create Unicode strings. +
  • +
  • + SCI_MARKERADD returns -1 for invalid lines as documented instead of 0. + Bug #2051. +
  • +
  • + Improve performance of text insertion when Unicode line indexing off. +
  • +
  • + For Qt on Windows, stop specifying -std:c++latest as that is no longer needed + to enable C++17 with MSVC 2017 and Qt 5.12 and it caused duplicate flag warnings. +
  • +
  • + On Linux, enable Lua to access dynamic libraries. + Bug #2058. +
  • +
+

+ Release 4.1.2 +

+
    +
  • + Released 2 October 2018. +
  • +
  • + C++ lexer fixes evaluation of "#elif". + Bug #2045. +
  • +
  • + Markdown lexer fixes highlighting of non-ASCII characters in links. +
  • +
  • + SciTE on Win32 drops menukey feature, makes Del key work again in find and replace strips + and disables F5 while command running. + Bug #2044. +
  • +
+

+ Release 4.1.1 +

+
    +
  • + Released 9 September 2018. +
  • +
  • + Optional indexing of line starts in UTF-8 documents by UTF-32 code points and UTF-16 code units added. + This can improve performance for clients that provide UTF-32 or UTF-16 interfaces or that need to interoperate + with UTF-32 or UTF-16 components. +
  • +
  • + Lexers added for SAS and Stata. + Feature #1185. +
  • +
  • + Shell folder folds "if", "do", and "case". + Feature #1144. +
  • +
  • + SciTE's menukey feature implemented on Windows. +
  • +
  • + For SciTE on Windows, user defined strip lists are now scrollable. + Cursor no longer flickers in edit and combo boxes. + Focus in and out events occur for combo boxes. +
  • +
  • + Fix a leak in the bidirectional code on Win32. +
  • +
  • + Fix crash on Win32 when switching technology to default after setting bidirectional mode. +
  • +
  • + Fix margin cursor on Cocoa to point more accurately. +
  • +
  • + Fix SciTE crash on GTK+ when using director interface. +
  • +
+

+ Release 4.1.0 +

+
    +
  • + Released 19 June 2018. +
  • +
  • + Experimental and incomplete support added for bidirectional text on Windows using DirectWrite and Cocoa for + UTF-8 documents by calling SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R). + This allows documents that contain Arabic or Hebrew to be edited more easily in a way that is similar + to other editors. +
  • +
  • + INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types added. + INDIC_GRADIENT starts with a specified colour and alpha at top of line and fades + to fully transparent at bottom. + INDIC_GRADIENTCENTRE starts with a specified colour and alpha at centre of line and fades + to fully transparent at top and bottom. +
  • +
  • + Wrap indent mode SC_WRAPINDENT_DEEPINDENT added which indents two tabs from previous line. +
  • +
  • + Indicators are drawn for line end characters when displayed. +
  • +
  • + Most invalid bytes in DBCS encodings are displayed as blobs to make problems clear + and ensure something is shown. +
  • +
  • + On Cocoa, invalid text in DBCS encodings will be interpreted through the + single-byte MacRoman encoding as that will accept any byte. +
  • +
  • + Diff lexer adds styles for diffs containing patches. +
  • +
  • + Crashes fixed on macOS for invalid DBCS characters when dragging text, + changing case of text, case-insensitive searching, and retrieving text as UTF-8. +
  • +
  • + Regular expression crash fixed on macOS when linking to libstdc++. +
  • +
  • + SciTE on GTK+, when running in single-instance mode, now forwards all command line arguments + to the already running instance. + This allows "SciTE filename -goto:line" to work. +
  • +
+

+ Release 4.0.5 +

+
    +
  • + Released 10 May 2018. +
  • +
  • + Add experimental SC_DOCUMENTOPTION_TEXT_LARGE option to accommodate documents larger than + 2 GigaBytes. +
  • +
  • + Additional print option SC_PRINT_SCREENCOLOURS prints with the same colours used on screen + including line numbers. +
  • +
  • + SciTE can read settings in EditorConfig format when enabled with editor.config.enable property. +
  • +
  • + EDIFACT lexer adds property lexer.edifact.highlight.un.all to highlight all UN* segments. + Feature #1166. +
  • +
  • + Fortran folder understands "change team" and "endteam". + Feature #1216. +
  • +
  • + Set the last X chosen when SCI_REPLACESEL called to ensure macros work + when text insertion followed by caret up or down. +
  • +
  • + Bugs fixed in regular expression searches in Scintilla where some matches did not occur in an + effort to avoid infinite loops when replacing on empty matches like "^" and "$". + Applications should always handle empty matches in a way that avoids infinite loops, commonly + by incrementing the search position after replacing an empty match. + SciTE fixes a bug where replacing "^" always matched on the first line even when it was an + "in selection" replace and the selection started after the line start. +
  • +
  • + Bug fixed in SciTE where invalid numeric properties could crash. +
  • +
  • + Runtime warnings fixed with SciTE on GTK after using Find in Files. +
  • +
  • + SciTE on Windows find and replace strips place caret at end of text after search. +
  • +
  • + Bug fixed with SciTE on macOS where corner debris appeared in the margin when scrolling. + Fixed by not completely hiding the status bar so the curved corner is no longer part of the + scrolling region. + By default, 4 pixels of the status bar remain visible and this can be changed with + the statusbar.minimum.height property or turned off if the debris are not a problem by + setting the property to 0. +
  • +
+

+ Release 4.0.4 +

+
    +
  • + Released 10 April 2018. +
  • +
  • + On Win32, the standard makefiles build a libscintilla static library as well as the existing dynamic libraries. + The statically linked version of SciTE, Sc1, links to this static library. A new file, ScintillaDLL.cxx, provides + the DllMain function required for a stand-alone Scintilla DLL. Build and project files should include this + file when producing a DLL and omit it when producing a static library or linking Scintilla statically. + The STATIC_BUILD preprocessor symbol is no longer used. +
  • +
  • + On Win32, Direct2D support is no longer automatically detected during build. + DISABLE_D2D may still be defined to remove Direct2D features. +
  • +
  • + In some cases, invalid UTF-8 is handled in a way that is a little friendlier. + For example, when copying to the clipboard on Windows, an invalid lead byte will be copied as the + equivalent ISO 8859-1 character and will not hide the following byte. + Feature #1211. +
  • +
  • + Lexer added for the Maxima computer algebra language. + Feature #1210. +
  • +
  • + Fix hang in Lua lexer when lexing a label upto the terminating "::". + Bug #1999. +
  • +
  • + Lua lexer matches identifier chains with dots and colons. + Bug #1952. +
  • +
  • + For rectangular selections, pressing Home or End now moves the caret to the Home or End + position instead of the limit of the rectangular selection. +
  • +
  • + Fix move-extends-selection mode for rectangular and line selections. +
  • +
  • + On GTK+, change lifetime of selection widget to avoid runtime warnings. +
  • +
  • + Fix building on Mingw/MSYS to perform file copies and deletions. + Bug #1993. +
  • +
  • + SciTE can match a wider variety of file patterns where '*' is in the middle of + the pattern and where there are multiple '*'. + A '?' matches any single character. +
  • +
  • + SciTE on Windows can execute Python scripts directly by name when on path. + Feature #1209. +
  • +
  • + SciTE on Windows Find in Files checks for cancel after every 10,000 lines read so + can be stopped on huge files. +
  • +
  • + SciTE remembers entered values in lists in more cases for find, replace and find in files. + Bug #1715. +
  • +
+

+ Release 4.0.3 +

+
    +
  • + Released 12 February 2018. +
  • +
  • + Features from C++14 and C++17 are used more often, with build files now specifying + c++17, gnu++17, c++1z, or std:c++latest (MSVC). + Requires Microsoft Visual C++ 2017.5, GCC 7, Xcode 9.2 or Clang 4.0 or newer. +
  • +
  • + SCI_CREATEDOCUMENT adds a bytes argument to allocate memory for an initial size. + SCI_CREATELOADER and SCI_CREATEDOCUMENT add a documentOption argument to + allow choosing different document capabilities. +
  • +
  • + Add SC_DOCUMENTOPTION_STYLES_NONE option to stop allocating memory for styles. +
  • +
  • + Add SCI_GETMOVEEXTENDSSELECTION to allow applications to add more + complex selection commands. +
  • +
  • + SciTE property bookmark.symbol allows choosing symbol used for bookmarks. + Feature #1208. +
  • +
  • + Improve VHDL lexer's handling of character literals and escape characters in strings. +
  • +
  • + Fix double tap word selection on Windows 10 1709 Fall Creators Update. + Bug #1983. +
  • +
  • + Fix closing autocompletion lists on Cocoa for macOS 10.13 where the window + was emptying but staying visible. + Bug #1981. +
  • +
  • + Fix drawing failure on Cocoa with animated find indicator in large files with macOS 10.12 + by disabling animation. +
  • +
  • + SciTE on GTK+ installs its desktop file as non-executable and supports the common + LDLIBS make variable. + Bug #1989, + Bug #1990. +
  • +
  • + SciTE shows correct column number when caret in virtual space. + Bug #1991. +
  • +
  • + SciTE preserves selection positions when saving with strip.trailing.spaces + and virtual space turned on. + Bug #1992. +
  • +
+

+ Release 4.0.2 +

+
    +
  • + Released 26 October 2017. +
  • +
  • + Fix HTML lexer handling of Django so that nesting a {{ }} or {% %} + Django tag inside of a {# #} Django comment does not break highlighting of rest of file +
  • +
  • + The Matlab folder now treats "while" as a fold start. + Bug #1985. +
  • +
  • + Fix failure on Cocoa with animated find indicator in large files with macOS 10.13 + by disabling animation on 10.13. +
  • +
  • + Fix Cocoa hang when Scintilla loaded from SMB share on macOS 10.13. + Bug #1979. +
  • +
+

+ Release 4.0.1 +

+
    +
  • + Released 23 October 2017. +
  • +
  • + The ILoader interface is defined in its own header ILoader.h as it is not + related to lexing so doesn't belong in ILexer.h. +
  • +
  • + The Scintilla namespace is always active for internal symbols and for the lexer interfaces + ILexer4 and IDocument. +
  • +
  • + The Baan lexer checks that matches to 3rd set of keywords are function calls and leaves as identifiers if not. + Baan lexer and folder support #context_on / #context_off preprocessor feature. +
  • +
  • + The C++ lexer improved preprocessor conformance.
    + Default value of 0 for undefined preprocessor symbols.
    + #define A is treated as #define A 1.
    + "defined A" removes "A" before replacing "defined" with value. + Bug #1966. +
  • +
  • + The Python folder treats triple-quoted f-strings like triple-quoted strings. + Bug #1977. +
  • +
  • + The SQL lexer uses sql.backslash.escapes for double quoted strings. + Bug #1968. +
  • +
  • + Minor undefined behaviour fixed. + Bug #1978. +
  • +
  • + On Cocoa, improve scrolling on macOS 10.12. + Bug #1885. +
  • +
  • + On Cocoa, fix line selection by clicking in the margin when scrolled. + Bug #1971. +
  • +
+

+ Release 4.0.0 +

+
    +
  • + Released 16 August 2017. +
  • +
  • + This is an unstable release with changes to interfaces used for lexers and platform access. + Some more changes may occur to internal and external interfaces before stability is regained with 4.1.0. +
  • +
  • + Uses C++14 features. Requires Microsoft Visual C++ 2017, GCC 7, and Clang 4.0 or newer. +
  • +
  • + Support dropped for GTK+ versions before 2.24. +
  • +
  • + The lexer interfaces ILexer and ILexerWithSubStyles, along with additional style metadata methods, were merged into ILexer4. + Most lexers will need to be updated to match the new interfaces. +
  • +
  • + The IDocumentWithLineEnd interface was merged into IDocument. +
  • +
  • + The platform layer interface has changed with unused methods removed, a new mechanism for + reporting events, removal of methods that take individual keyboard modifiers, and removal of old timer methods. +
  • +
  • + Style metadata may be retrieved from lexers that support this through the SCI_GETNAMEDSTYLES, SCI_NAMEOFSTYLE, + SCI_TAGSOFSTYLE, and SCI_DESCRIPTIONOFSTYLE APIs. +
  • +
  • + The Cocoa platform layer uses Automatic Reference Counting (ARC). +
  • +
  • + The default encoding in Scintilla is UTF-8. +
  • +
  • + An SCN_AUTOCSELECTIONCHANGE notification is sent when items are highlighted in an autocompletion or user list. +
  • +
  • + The data parameter to ILoader::AddData made const. + Bug #1955. +
  • +
  • + SciTE's embedded Lua interpreter updated to Lua 5.3. +
  • +
  • + SciTE allows event handlers to be arbitrary callables, not just functions. + Feature #1190. +
  • +
  • + SciTE allows user.shortcuts to be defined with symbolic Scintilla messages like + 'Ctrl+L|SCI_LINEDELETE|'. +
  • +
  • + The Matlab lexer treats 'end' as a number rather than a keyword when used as a index. + This also stops incorrect folding. + Bug #1951. +
  • +
  • + The Matlab folder implements "fold", "fold.comment", and "fold.compact" properties. + Bug #1965. +
  • +
  • + The Rust lexer recognizes 'usize' numeric literal suffixes. + Bug #1919. +
  • +
  • + Ensure redraw when application changes overtype mode so caret change visible even when not blinking. + Notify application with SC_UPDATE_SELECTION when overtype changed - previously + sent SC_UPDATE_CONTENT. +
  • +
  • + Fix drawing failure when in wrap mode for delete to start/end of line which + affects later lines but did not redraw them. + Also fixed drawing for wrap mode on GTK+ 2.x. + Bug #1949. +
  • +
  • + On GTK+ fix drawing problems including incorrect scrollbar redrawing and flickering of text. + Bug #1876. +
  • +
  • + On Linux, both for GTK+ and Qt, the default modifier key for rectangular selection is now Alt. + This is the same as Windows and macOS. + This was changed from Ctrl as window managers are less likely to intercept Alt+Drag for + moving windows than in the past. +
  • +
  • + On Cocoa, fix doCommandBySelector but avoid double effect of 'delete' + key. + Bug #1958. +
  • +
  • + On Qt, the updateUi signal includes the 'updated' flags. + No updateUi signal is sent for focus in events. + These changes make Qt behave more like the other platforms. +
  • +
  • + On Qt, dropping files on Scintilla now fires the SCN_URIDROPPED notification + instead of inserting text. +
  • +
  • + On Qt, focus changes send the focusChanged signal. + Bug #1957. +
  • +
  • + On Qt, mouse tracking is reenabled when the window is reshown. + Bug #1948. +
  • +
  • + On Windows, the DirectWrite modes SC_TECHNOLOGY_DIRECTWRITEDC and + SC_TECHNOLOGY_DIRECTWRITERETAIN are no longer provisional. +
  • +
  • + SciTE on macOS fixes a crash when platform-specific and platform-independent + session restoration clashed. + Bug #1960. +
  • +
  • + SciTE on GTK+ implements find.close.on.find. + Bug #1152, + Bug #1254, + Bug #1762, + Feature #849. +
  • +
+

+ Release 3.7.6 +

+
    +
  • + Released 8 August 2017. +
  • +
  • + This is the first release of the + long term branch + which avoids using features from C++14 or later in order to support older systems. +
  • +
  • + The Baan lexer correctly highlights numbers when followed by an operator. +
  • +
  • + On Cocoa, fix a bug with retrieving encoded bytes. +
  • +
+

+ Release 3.7.5 +

+
    +
  • + Released 26 May 2017. +
  • +
  • + This is the final release of SciTE 3.x. +
  • +
  • + Support dropped for Microsoft Visual C++ 2013 due to increased use of C++11 features. +
  • +
  • + Added a caret line frame as an alternative visual for highlighting the caret line. +
  • +
  • + Added "Reverse Selected Lines" feature. +
  • +
  • + SciTE adds "Select All Bookmarks" command. +
  • +
  • + SciTE adds a save.path.suggestion setting to suggest a file name when saving an + unnamed buffer. +
  • +
  • + Updated case conversion and character categories to Unicode 9. +
  • +
  • + The Baan lexer recognizes numeric literals in a more compliant manner including + hexadecimal numbers and exponentials. +
  • +
  • + The Bash lexer recognizes strings in lists in more cases. + Bug #1944. +
  • +
  • + The Fortran lexer recognizes a preprocessor line after a line continuation &. + Bug #1935. +
  • +
  • + The Fortran folder can fold comments. + Bug #1936. +
  • +
  • + The PowerShell lexer recognizes escaped quotes in strings. + Bug #1929. +
  • +
  • + The Python lexer recognizes identifiers more accurately when they include non-ASCII characters. +
  • +
  • + The Python folder treats comments at the end of the file as separate from the preceding structure. +
  • +
  • + The YAML lexer recognizes comments in more situations and styles a + "..." line like a "---" line. + Bug #1931. +
  • +
  • + Update scroll bar when annotations added, removed, or visibility changed. + Feature #1187. +
  • +
  • + Canceling modes with the Esc key preserves a rectangular selection. + Bug #1940. +
  • +
  • + Builds are made with a sorted list of lexers to be more reproducible. + Bug #1946. +
  • +
  • + On Cocoa, a leak of mouse tracking areas was fixed. +
  • +
  • + On Cocoa, the autocompletion is 4 pixels wider to avoid text truncation. +
  • +
  • + On Windows, stop drawing a focus rectangle on the autocompletion list and + raise the default list length to 9 items. +
  • +
  • + SciTE examines at most 1 MB of a file to automatically determine indentation + for indent.auto to avoid a lengthy pause when loading very large files. +
  • +
  • + SciTE user interface uses lighter colours and fewer 3D elements to match current desktop environments. +
  • +
  • + SciTE sets buffer dirty and shows message when file deleted if load.on.activate on. +
  • +
  • + SciTE on Windows Find strip Find button works in incremental no-close mode. + Bug #1926. +
  • +
+

+ Release 3.7.4 +

+
    +
  • + Released 21 March 2017. +
  • +
  • + Requires a C++11 compiler. GCC 4.8 and MSVC 2015 are supported. +
  • +
  • + Support dropped for Windows NT 4. +
  • +
  • + Accessibility support may be queried with SCI_GETACCESSIBILITY. + On GTK+, accessibility may be disabled by calling SCI_SETACCESSIBILITY. +
  • +
  • + Lexer added for "indent" language which is styled as plain text but folded by indentation level. +
  • +
  • + The Progress ABL lexer handles nested comments where comment starts or ends + are adjacent like "/*/*" or "*/*/". +
  • +
  • + In the Python lexer, improve f-string support. + Add support for multiline expressions in triple quoted f-strings. + Handle nested "()", "[]", and "{}" in f-string expressions and terminate expression colouring at ":" or "!". + End f-string if ending quote is seen in a "{}" expression. + Fix terminating single quoted f-string at EOL. + Bug #1918. +
  • +
  • + The VHDL folder folds an "entity" on the first line of the file. +
  • +
  • + For IMEs, do not clear selected text when there is no composition text to show. +
  • +
  • + Fix to crash with fold tags where line inserted at start. +
  • +
  • + Fix to stream selection mode when moving caret up or down. + Bug #1905. +
  • +
  • + Drawing fixes for fold tags include fully drawing lines and not overlapping some + drawing and ensuring edges and mark underlines are visible. +
  • +
  • + Fix Cocoa failure to display accented character chooser for European + languages by partially reverting a change made to prevent a crash with + Chinese input by special-casing the Cangjie input source. + Bug #1881. +
  • +
  • + Fix potential problems with IME on Cocoa when document contains invalid + UTF-8. +
  • +
  • + Fix crash on Cocoa with OS X 10.9 due to accessibility API not available. + Bug #1915. +
  • +
  • + Improved speed of accessibility code on GTK+ by using additional memory + as a cache. + Bug #1910. +
  • +
  • + Fix crash in accessibility code on GTK+ < 3.3.6 caused by previous bug fix. + Bug #1907. +
  • +
  • + Fix to prevent double scrolling on GTK+ with X11. + Bug #1901. +
  • +
  • + SciTE on GTK+ adds an "accessibility" property to allow disabling accessibility + on GTK+ as an optimization. +
  • +
  • + SciTE on GTK+ has changed file chooser behaviour for some actions: + overwriting an existing file shows a warning; + the default session file name "SciTE.session" is shown and a "*.session" filter is applied; + appropriate filters are applied when exporting; + the current file name is displayed in "Save As" even when that file no longer exists. +
  • +
  • + SciTE fixed a bug where, on GTK+, when the output pane had focus, menu commands + performed by mouse were sent instead to the edit pane. +
  • +
  • + SciTE on Windows 8+ further restricts the paths searched for DLLs to the application + and system directories which may prevent some binary planting attacks. +
  • +
  • + Fix failure to load Direct2D on Windows when used on old versions of Windows. + Bug #1653. +
  • +
+

+ Release 3.7.3 +

+
    +
  • + Released 19 February 2017. +
  • +
  • + Display block caret over the character at the end of a selection to be similar + to other editors. +
  • +
  • + In SciTE can choose colours for fold markers. + Feature #1172. +
  • +
  • + In SciTE can hide buffer numbers in tabs. + Feature #1173. +
  • +
  • + The Diff lexer recognizes deleted lines that start with "--- ". +
  • +
  • + The Lua lexer requires the first line to start with "#!" to be treated as a shebang comment, + not just "#". + Bug #1900. +
  • +
  • + The Matlab lexer requires block comment start and end to be alone on a line. + Bug #1902. +
  • +
  • + The Python lexer supports f-strings with new styles, allows Unicode identifiers, + and no longer allows @1 to be a decorator. + Bug #1848. +
  • +
  • + Fix folding inconsistency when fold header added above a folded part. + Avoid unnecessary unfolding when a deletion does not include a line end. + Bug #1896. +
  • +
  • + Fix finalization crash on Cocoa. + Bug #1909. +
  • +
  • + SciTE on GTK+ can have a wide divider between the panes with the + split.wide property. +
  • +
  • + Fix display of autocompletion lists and calltips on GTK+ 3.22 on Wayland. + Newer APIs used on GTK+ 3.22 as older APIs were deprecated. +
  • +
  • + Fix crash in accessibility code on GTK+ due to signal receipt after destruction. + Bug #1907. +
  • +
  • + Make trackpad scrolling work on Wayland. + Bug #1901. +
  • +
+

+ Release 3.7.2 +

+
    +
  • + Released 30 December 2016. +
  • +
  • + Minimize redrawing for SCI_SETSELECTIONN* APIs. + Bug #1888. +
  • +
  • + Use more precision to allow selecting individual lines in files with + more than 16.7 million lines. +
  • +
  • + For Qt 5, define QT_WS_MAC or QT_WS_X11 on those platforms. + Bug #1887. +
  • +
  • + For Cocoa, fix crash on view destruction with macOS 10.12.2. + Bug #1891. +
  • +
  • + Fix crash on GTK+ <3.8 due to incorrect lifetime of accessibility object. + More accurate reporting of attribute ranges and deletion lengths for accessibility. +
  • +
  • + In SciTE, if a Lua script causes a Scintilla failure exception, display error + message in output pane instead of exiting. + Bug #1773. +
  • +
+

+ Release 3.7.1 +

+
    +
  • + Released 4 December 2016. +
  • +
  • + The Scintilla namespace is no longer applied to struct definitions in Scintilla.h even + when SCI_NAMESPACE defined. + Client code should not define SCI_NAMESPACE. +
  • +
  • + Structure names in Scintilla.h without prefixes are deprecated and will now only + be usable with INCLUDE_DEPRECATED_FEATURES defined.
    + Use the newer names with the "Sci_" prefix:
    + CharacterRange → Sci_CharacterRange
    + TextRange → Sci_TextRange
    + TextToFind → Sci_TextToFind
    + RangeToFormat → Sci_RangeToFormat
    + NotifyHeader → Sci_NotifyHeader +
  • +
  • + Previously deprecated features SC_CP_DBCS, SCI_SETUSEPALETTE. and SCI_GETUSEPALETTE + have been removed and can no longer be used in client code. +
  • +
  • + Single phase drawing SC_PHASES_ONE is deprecated along with the + SCI_SETTWOPHASEDRAW and SCI_GETTWOPHASEDRAW messages. +
  • +
  • + Accessibility support allowing screen readers to work added on GTK+ and Cocoa. +
  • +
  • + Textual tags may be displayed to the right on folded lines with SCI_TOGGLEFOLDSHOWTEXT. + This is commonly something like "{ ... }" or "<tr>...</tr>". + It is displayed with the STYLE_FOLDDISPLAYTEXT style and may have a box drawn around it + with SCI_FOLDDISPLAYTEXTSETSTYLE. +
  • +
  • + A mouse right-click over the margin may send an SCN_MARGINRIGHTCLICK event. + This only occurs when popup menus are turned off. + SCI_USEPOPUP now has three states: SC_POPUP_NEVER, SC_POPUP_ALL, or SC_POPUP_TEXT. +
  • +
  • + INDIC_POINT and INDIC_POINTCHARACTER indicators added to display small arrows + underneath positions or characters. +
  • +
  • + Added alternate appearance for visible tabs which looks like a horizontal line. + Controlled with SCI_SETTABDRAWMODE. + Feature #1165. +
  • +
  • + On Cocoa, a modulemap file is included to allow Scintilla to be treated as a module. + This makes it easier to use Scintilla from the Swift language. +
  • +
  • + Baan folder accommodates sections and lexer fixes definition of SCE_BAAN_FUNCDEF. +
  • +
  • + EDIFACT lexer and folder added. + Feature #1166. +
  • +
  • + JSON folder fixed where it didn't resume folding with the correct fold level. +
  • +
  • + Matlab folder based on syntax instead of indentation so more accurate. + Bug #1692. +
  • +
  • + YAML lexer fixed style of references and keywords when followed by a comment. + Bug #1872. +
  • +
  • + Margin click to select line now clears rectangular and additional selections. +
  • +
  • + Fixed a NULL access bug on GTK+ where the scrollbars could be used during destruction. + Bug #1873. +
  • +
  • + A potential bug on GTK+ fixed where asynchronous clipboard could be delivered after its + target Scintilla instance was destroyed. +
  • +
  • + Cocoa IME made more compliant with documented behaviour to avoid bugs that caused + huge allocations. + Bug #1881. +
  • +
  • + On Win32 fix EM_SETSEL to match Microsoft documentation.. + Bug #1886. +
  • +
  • + SciTE on GTK+ allows localizing tool bar tool tips. + Feature #1167. +
  • +
  • + SciTE on Windows restores focus to edit pane after closing user strip. +
  • +
  • + SciTE measures files larger that 2 GB which allows it to refuse to open huge files more consistently + and to show better warning messages. +
  • +
+

+ Release 3.7.0 +

+
    +
  • + Released 16 October 2016. +
  • +
  • + Word selection, navigation, and manipulation is now performed on characters instead of bytes + leading to more natural behaviour for multi-byte encodings like UTF-8. + For UTF-8 characters 0x80 and above, classification into word; punctuation; space; or line-end + is based on the Unicode general category of the character and is not customizable. + Bug #1832. +
  • +
  • + Two enums changed in Scintilla.iface which may lead to changed bindings. + There were 2 FontQuality enums and the first is now PhasesDraw. + The prefix for FoldAction was SC_FOLDACTION and is now SC_FOLDACTION_ + which is similar to other enums. + These changes do not affect the standard C/C++ binding. +
  • +
  • + EDGE_MULTILINE and SCI_MULTIEDGEADDLINE added to allow displaying multiple + vertical edges simultaneously. +
  • +
  • + The number of margins can be changed with SCI_SETMARGINS. +
  • +
  • + Margin type SC_MARGIN_COLOUR added so that the application may + choose any colour for a margin with SCI_SETMARGINBACKN. +
  • +
  • + On Win32, mouse wheel scrolling can be restricted to only occur when the mouse is + within the window. +
  • +
  • + The WordList class in lexlib used by lexers adds an InListAbridged method for + matching keywords that have particular prefixes and/or suffixes. +
  • +
  • + The Baan lexer was changed significantly with more lexical states, keyword sets, + and support for abridged keywords. +
  • +
  • + The CoffeeScript lexer styles interpolated code in strings. + Bug #1865. +
  • +
  • + The Progress lexer "progress" has been replaced with a new lexer "abl" + (Advanced Business Language) + with a different set of lexical states and more functionality. + The lexical state prefix has changed from SCE_4GL_ to SCE_ABL_. + Feature #1143. +
  • +
  • + The PowerShell lexer understands the grave accent escape character. + Bug #1868. +
  • +
  • + The YAML lexer recognizes inline comments. + Bug #1660. +
  • +
  • + SciTE on Windows can retain coloured selection when inactive with + selection.always.visible property. +
  • +
  • + SciTE on Windows adds a state to close.on.find to close the find strip when + a match is found. +
  • +
  • + Fix caret position after left or right movement with rectangular selection. + Bug #1861. +
  • +
  • + In SciTE, optional prefix argument added to scite.ConstantName method. + Bug #1860. +
  • +
  • + On Cocoa, include ILexer.h in the public headers of the framework. + Bug #1855. +
  • +
  • + On Cocoa, allow subclass of SCIContentView to set cursor. + Bug #1863. +
  • +
  • + On Cocoa, recognize the numeric keypad '+', '-', and '/' keys as + SCK_ADD, SCK_SUBTRACT, and SCK_DIVIDE. + Bug #1867. +
  • +
  • + On GTK+ 3.21+ fix incorrect font size in auto-completion list. + Bug #1859. +
  • +
  • + Fix SciTE crash when command.mode ends with comma. + Bug #1857. +
  • +
  • + SciTE on Windows has a full size toolbar icon for "Close". +
  • +
+

+ Release 3.6.7 +

+
    +
  • + Released 4 September 2016. +
  • +
  • + C++11 range-based for loops used in SciTE so GCC 4.6 is now the minimum supported version. +
  • +
  • + SC_CHARSET_DEFAULT now means code page 1252 on Windows unless a code page is set. + This prevents unexpected behaviour and crashes on East Asian systems where default locales are commonly DBCS. + Projects which want to default to DBCS code pages in East Asian locales should set the code page and + character set explicitly. +
  • +
  • + SCVS_NOWRAPLINESTART option stops left arrow from wrapping to the previous line. + Most commonly wanted when virtual space is used. + Bug #1648. +
  • +
  • + The C++ lexer can fold on #else and #elif with the fold.cpp.preprocessor.at.else property. + Bug #210. +
  • +
  • + The errorlist lexer detects warnings from Visual C++ which do not contain line numbers. +
  • +
  • + The HTML lexer no longer treats "<?" inside a string in a script as potentially starting an XML document. + Bug #767. +
  • +
  • + The HTML lexer fixes a problem resuming at a script start where the starting state continued + past where it should. + Bug #1849. +
  • +
  • + When inserting spaces for virtual space and the position is in indentation and tabs are enabled + for indentation then use tabs. + Bug #1850. +
  • +
  • + Fix fold expand when some child text not styled. + Caused by fixes for Bug #1799. + Bug #1842. +
  • +
  • + Fix key binding bug on Cocoa for control+. + Bug #1854. +
  • +
  • + Fix scroll bar size warnings on GTK+ caused by #1831. + Bug #1851. +
  • +
  • + Small fixes for GTK+ makefile. + Bug #1844. + Bug #1845. + Bug #1846. +
  • +
  • + Fix SciTE indentation after code like "void function () {}". +
  • +
  • + Fix SciTE global regex replace of "^" with something which missed the line after empty + lines with LF line ends. + Bug #1839. +
  • +
  • + Fix SciTE on GTK+ 3.20 bug where toggle buttons on find and replace strips + did not show active state. + Bug #1853. +
  • +
+

+ Release 3.6.6 +

+
    +
  • + Released 24 May 2016. +
  • +
  • + C++ 11 <regex> support built by default. Can be disabled by defining NO_CXX11_REGEX. +
  • +
  • + SciTE_USERHOME environment variable allows separate location for writeable properties files. + Feature #965. +
  • +
  • + GObject introspection supports notify and command events. +
  • +
  • + The Progress lexer now allows comments preceded by a tab. +
  • +
  • + Scripts reading Scintilla.iface file include comments for enu and lex definitions. + Bug #1829. +
  • +
  • + Fix crashes on GTK+ if idle work active when destroyed. + Bug #1827. +
  • +
  • + Fixed bugs when used on GTK+ 3.20. + Bug #1825. + Bug #1831. +
  • +
  • + Fix SciTE search field background with dark theme on GTK+ 2.x. + Bug #1826. +
  • +
  • + Fixed bug on Win32 that allowed resizing autocompletion from bottom when it was + located above the caret. +
  • +
  • + On Win32, when using a screen reader and selecting text using Shift+Arrow, + fix bug when scrolling made the caret stay at the same screen location + so the screen reader did not speak the added or removed selection. +
  • +
+

+ Release 3.6.5 +

+
    +
  • + Released 26 April 2016. +
  • +
  • + JSON lexer added. + Feature #1140. +
  • +
  • + The C++ lexer fixes a bug with multi-line strings with line continuation where the string style + overflowed after an edit. + Bug #1824. +
  • +
  • + The Python lexer treats '@' as an operator except when it is the first visible character on a line. + This is for Python 3.5. +
  • +
  • + The Rust lexer allows '?' as an operator. + Feature #1146. +
  • +
  • + Doubled size of compiled regex buffer. + Bug #1822. +
  • +
  • + For GTK+, the Super modifier key can be used in key bindings. + Feature #1142. +
  • +
  • + For GTK+, fix some crashes when using multiple threads. +
  • +
  • + Platform layer font cache removed on GTK+ as platform-independent caches are used. + This avoids the use of thread locking and initialization of threads so any GTK+ + applications that rely on Scintilla initializing threads will have to do that themselves. +
  • +
  • + SciTE bug fixed with exported HTML where extra line shown. + Bug #1816. +
  • +
  • + SciTE on Windows fixes bugs with pop-up menus in the find and replace strips. + For the replace strip, menu choices change the state. + For the find strip, menu choices are reflected in the appearance of their corresponding buttons. +
  • +
  • + SciTE on Windows on high DPI displays fixes the height of edit boxes in user strips. +
  • +
+

+ Release 3.6.4 +

+
    +
  • + Released 13 March 2016. +
  • +
  • + SciTE allows setting the autocompletion type separator character. +
  • +
  • + The C++ folder folds code on '(' and ')' to allow multi-line calls to be folded. + Feature #1138. +
  • +
  • + For the HTML lexer, limit the extent of Mako line comments to finish before + the line end characters. +
  • +
  • + Folds unfolded when two fold regions are merged by either deleting an intervening line + or changing its fold level by adding characters. + This was fixed both in Scintilla and in SciTE's equivalent code. + Bug #1799.
    +
  • +
  • + The Progress lexer supports hexadecimal numeric literals, + single-line comments, abbreviated keywords and + extends nested comments to unlimited levels. +
  • +
  • + Ruby lexer treats alternate hash key syntax "key:" as a symbol. + Bug #1810. +
  • +
  • + Rust lexer handles bracketed Unicode string escapes like "\u{123abc}". + Bug #1809. +
  • +
  • + For GTK+ on Windows fix 64-bit build which was broken in 3.6.3. +
  • +
  • + For Qt, release builds have assertions turned off. +
  • +
  • + For Qt on Windows, fix compilation failure for Qt 4.x. +
  • +
  • + IME target range displayed on Qt for OS X. +
  • +
  • + On Windows, make clipboard operations more robust by retrying OpenClipboard if it fails + as this may occur when another application has opened the clipboard. +
  • +
  • + On Windows back out change that removed use of def file to ensure + Scintilla_DirectFunction exported without name mangling. + Bug #1813. +
  • +
  • + On GTK+ and Qt over Win32 in Korean fix bug caused by last release's word input change. +
  • +
  • + For SciTE, more descriptive error messages are displayed when there are problems loading the + Lua startup script. + Feature #1139. +
  • +
+

+ Release 3.6.3 +

+
    +
  • + Released 18 January 2016. +
  • +
  • + Allow painting without first styling all visible text then styling in the background + using idle-time. This helps performance when scrolling down in very large documents. + Can also incrementally style after the visible area to the end of the document so that + the document is already styled when the user scrolls to it. +
  • +
  • + Support GObject introspection on GTK+. +
  • +
  • + SciTE supports pasting to each selection with the selection.multipaste setting. + Feature #1123. +
  • +
  • + SciTE can optionally display a read-only indicator on tabs and in the Buffers menu. +
  • +
  • + Bash lexer flags incomplete here doc delimiters as syntax errors. + Bug #1789.
    + Support added for using '#' in non-comment ways as is possible with zsh. + Bug #1794.
    + Recognize more characters as here-doc delimiters. + Bug #1778. +
  • +
  • + Errorlist lexer highlights warning messages from the Microsoft linker. +
  • +
  • + Errorlist lexer fixes bug with final line in escape sequence recognition mode. +
  • +
  • + Lua lexer includes '&' and '|' bitwise operators for Lua 5.3. + Bug #1790. +
  • +
  • + Perl lexer updated for Perl 5.20 and 5.22.
    + Allow '_' for subroutine prototypes. + Bug #1791.
    + Double-diamond operator <<>>.
    + Hexadecimal floating point literals.
    + Repetition in list assignment. + Bug #1793.
    + Highlight changed subroutine prototype syntax for Perl 5.20. + Bug #1797.
    + Fix module ::-syntax when special characters such as 'x' are used.
    + Added ' and " detection as prefix chars for x repetition operator. + Bug #1800. +
  • +
  • + Visual Prolog lexer recognizes numbers more accurately and allows non-ASCII verbatim + quoting characters. + Feature #1130. +
  • +
  • + Send SCN_UPDATEUI with SC_UPDATE_SELECTION when the application changes multiple + selection. +
  • +
  • + Expand folded areas before deleting fold header line. + Bug #1796. +
  • +
  • + Treat Unicode line ends like common line ends when maintaining fold state. +
  • +
  • + Highlight whole run for hover indicator when wrapped. + Bug #1784. +
  • +
  • + On Cocoa, fix crash when autocompletion list closed during scroll bounce-back. + Bug #1788. +
  • +
  • + On Windows, fix non-BMP input through WM_CHAR and allow WM_UNICHAR to work + with non-BMP characters and on non-Unicode documents. + Bug #1779. +
  • +
  • + On Windows using DirectWrite, for ligatures and other character clusters, + display caret and selections part-way through clusters so that the caret doesn't stick + to the end of the cluster making it easier to understand editing actions. +
  • +
  • + On Windows, Scintilla no longer uses a .DEF file during linking as it duplicates + source code directives. +
  • +
  • + On GTK+ and Qt, Korean input by word fixed. +
  • +
  • + On GTK+, Qt, and Win32 block IME input when document is read-only or any selected text + is protected. +
  • +
  • + On GTK+ on OS X, fix warning during destruction. + Bug #1777. +
  • +
  • + Fix SciTE crashes when using LPEG lexers. +
  • +
+

+ Release 3.6.2 +

+
    +
  • + Released 6 November 2015. +
  • +
  • + Whitespace may be made visible just in indentation. +
  • +
  • + Whitespace dots are centred when larger than 1 pixel. +
  • +
  • + The Scintilla framework on Cocoa now contains version numbers. +
  • +
  • + SciTE's standard properties collect values from all active .properties file to produce the Language menu + and the file types pull-down in the File open dialog. +
  • +
  • + The single executable version of SciTE, Sc1, uses 'module' statements within its embedded + properties. This makes it act more like the full distribution allowing languages to be turned on + and off by setting imports.include and imports.exclude. + The default imports.exclude property adds eiffel, erlang, ps, and pov so these languages are + turned off by default. +
  • +
  • + SciTE adds an output.blank.margin.left property to allow setting the output pane + margin to a different width than the edit pane. +
  • +
  • + CoffeeScript lexer highlights ranges correctly. + Bug #1765. +
  • +
  • + Markdown lexer treats line starts consistently to always highlight *foo* or similar at line start. + Bug #1766. +
  • +
  • + Optimize marker redrawing by only drawing affected lines when markers shown in the text. +
  • +
  • + On Cocoa, timers and idling now work in modal dialogs. This also stops some crashes. +
  • +
  • + On Cocoa, fix crashes when deleting a ScintillaView. These crashes could occur when scrolling + at the time the ScintillaView was deleted although there may have been other cases. +
  • +
  • + On GTK+ 2.x, fix height of lines in autocompletion lists. + Bug #1774. +
  • +
  • + Fix bug with SCI_LINEENDDISPLAY where the caret moved to the next document line instead of the + end of the display line. + Bug #1772. +
  • +
  • + Report error (SC_STATUS_FAILURE) when negative length passed to SCI_SETSTYLING. + Bug #1768. +
  • +
  • + When SC_MARK_UNDERLINE is not assigned to a margin, stop drawing the whole line. +
  • +
  • + When reverting an untitled document in SciTE, just clear it with no message about a file. + Bug #1764. +
  • +
  • + SciTE on GTK+ allows use of Ctrl+A (Select All) inside find and replace strips. + Bug #1769. +
  • +
+

+ Release 3.6.1 +

+
    +
  • + Released 15 September 2015. +
  • +
  • + The oldest version of GTK+ supported now is 2.18 and for glib it is 2.22. +
  • +
  • + On GTK+, SC_CHARSET_OEM866 added to allow editing Russian files encoded in code page 866. + Feature #1019. +
  • +
  • + On Windows, reconversion is performed when requested by the IME. +
  • +
  • + CoffeeScript lexer adds lexical class for instance properties and fixes some cases of regex highlighting. + Bug #1749. +
  • +
  • + The errorlist lexer understands some ANSI escape sequences to change foreground colour and intensity. + This is sufficient to colour diagnostic output from gcc and clang when -fdiagnostics-color set. +
  • +
  • + The errorlist lexer allows the line number to be 0 in GCC errors as some tools report whole file + errors as line 0. +
  • +
  • + MySql lexer fixes empty comments /**/ so the comment state does not continue. +
  • +
  • + VHDL folder supports "protected" keyword. +
  • +
  • + Treat CRLF line end as two characters in SCI_COUNTCHARACTERS. + Bug #1757. +
  • +
  • + On GTK+ 3.x, fix height of lines in autocompletion lists to match the font. + Switch from deprecated style calls to CSS styling. + Removed setting list colours on GTK+ 3.16+ as no longer appears needed. +
  • +
  • + On GTK+, avoid "Invalid rectangle passed" warning messages by never reporting the client + rectangle with a negative width or height. + Bug #1743. +
  • +
  • + On Cocoa, copy Sci_Position.h into the framework so clients can build. +
  • +
  • + On Cocoa fix bug with drag and drop that could lead to crashes. + Bug #1751. +
  • +
  • + Fix SciTE disk exhaustion bug by reporting failures when writing files. + Bug #1760. +
  • +
  • + Fix find strip in SciTE on Windows XP to be visible. +
  • +
  • + SciTE on Windows changes the way it detects that a tool has finished executing to ensure all output data + from the process is read. +
  • +
  • + SciTE on Windows improves the time taken to read output from tools that produce a large amount + of output by a factor of around 10. +
  • +
  • + On GTK+ the keyboard command for View | End of Line was changed to Ctrl+Shift+N + to avoid clash with Search | Selection Add Next. + Bug #1750. +
  • +
+

+ Release 3.6.0 +

+
    +
  • + Released 3 August 2015. +
  • +
  • + External interfaces use the Sci_Position and Sci_PositionU typedefs instead of int and unsigned int + to allow for changes to a 64-bit interface on 64-bit platforms in the future. + Applications and external lexers should start using the new type names so that + they will be compatible when the 64-bit change occurs. + There is also Sci_PositionCR (long) for use in the Sci_CharacterRange struct which will + also eventually become 64-bit. +
  • +
  • + Multiple selection now works over more key commands. + The new multiple-selection handling commands include horizontal movement and selection commands, + line up and down movement and selection commands, word and line deletion commands, and + line end insertion. + This change in behaviours is conditional on setting the SCI_SETADDITIONALSELECTIONTYPING property. +
  • +
  • + Autocompletion lists send an SCN_AUTOCCOMPLETED notification after the text has been inserted. + Feature #1109. +
  • +
  • + The case mode style attribute can now be SC_CASE_CAMEL. +
  • +
  • + The Python lexer supports substyles for identifiers. +
  • +
  • + SciTE adds support for substyles. +
  • +
  • + SciTE's Export as RTF and Copy as RTF commands support UTF-8. +
  • +
  • + SciTE can display autocompletion on all IME input with ime.autocomplete property. +
  • +
  • + SciTE properties files now discard trailing white space on variable names. +
  • +
  • + Calling SCI_SETIDENTIFIERS resets styling to ensure any added identifier are highlighted. +
  • +
  • + Avoid candidate box randomly popping up away from edit pane with (especially + Japanese) IME input. +
  • +
  • + On Cocoa fix problems with positioning of autocompletion lists near screen edge + or under dock. Cancel autocompletion when window moved. + Bug #1740. +
  • +
  • + Fix drawing problem when control characters are in a hidden style as they then + have a zero width rectangle to draw but modify that rectangle in a way that + clears some pixels. +
  • +
  • + Report error when attempt to resize buffer to more than 2GB with SC_STATUS_FAILURE. +
  • +
  • + Fix bug on GTK+ with scroll bars leaking. + Bug #1742. +
  • +
  • + LexOthers.cxx file split into one file per lexer: LexBatch, LexDiff, + LexErrorList, LexMake, LexNull, and LexProps. +
  • +
  • + SciTE exporters handle styles > 127 correctly now. +
  • +
  • + SciTE on Windows can scale window element sizes based on the system DPI setting. +
  • +
  • + SciTE implements find.in.files.close.on.find on all platforms, not just Windows. +
  • +
+

+ Release 3.5.7 +

+
    +
  • + Released 20 June 2015. +
  • +
  • + Added SCI_MULTIPLESELECTADDNEXT to add the next occurrence of the main selection within the + target to the set of selections as main. If the current selection is empty then select word around caret. + SCI_MULTIPLESELECTADDEACH adds each occurrence of the main selection within the + target to the set of selections. +
  • +
  • + SciTE adds "Selection Add Next" and "Selection Add Each" commands to the Search menu. +
  • +
  • + Added SCI_ISRANGEWORD to determine if the parameters are at the start and end of a word. +
  • +
  • + Added SCI_TARGETWHOLEDOCUMENT to set the target to the whole document. +
  • +
  • + Verilog lexer recognizes protected regions and the folder folds protected regions. +
  • +
  • + A performance problem with markers when deleting many lines was fixed. + Bug #1733. +
  • +
  • + On Cocoa fix crash when ScintillaView destroyed if no autocompletion ever displayed. + Bug #1728. +
  • +
  • + On Cocoa fix crash in drag and drop. +
  • +
  • + On GTK+ 3.4+, when there are both horizontal and vertical scrollbars, draw the lower-right corner + so that it does not appear black when text selected. + Bug #1611. +
  • +
  • + Fixed most calls deprecated in GTK+ 3.16. Does not fix style override calls + as they are more complex. +
  • +
  • + SciTE on GTK+ 3.x uses a different technique for highlighting the search strip when there is + no match which is more compatible with future and past versions and different themes. +
  • +
+

+ Release 3.5.6

  • @@ -499,15 +2379,15 @@
  • C++ lexer fixes empty backquoted string. - Bug #1711. + Bug #1711.
  • C++ lexer fixes #undef directive. - Bug #1719. + Bug #1719.
  • Fortran folder fixes handling of "selecttype" and "selectcase". - Bug #1724. + Bug #1724.
  • Verilog folder folds interface definitions. @@ -518,19 +2398,19 @@
  • Fix bug when drawing text margins in buffered mode which would use default encoding instead of chosen encoding. - Bug #1703. + Bug #1703.
  • Fix bug with Korean Hanja conversions in DBCS encoding on Windows.
  • Fix for reading a UTF-16 file in SciTE where a non-BMP character is split over a read buffer boundary. - Bug #1710. + Bug #1710.
  • Fix bug on GTK+ 2.x for Windows where there was an ABI difference between compiler version. - Bug #1726. + Bug #1726.
  • Fix undo bug on Cocoa that could lose data.. @@ -543,15 +2423,15 @@
  • SciTE does not report twice that a search string can not be found when "Replace" pressed. - Bug #1716. + Bug #1716.
  • SciTE on GTK+ 3.x disables arrow in search combo when no entries. - Bug #1717. + Bug #1717.

- Release 3.5.5 + Release 3.5.5

  • @@ -564,7 +2444,7 @@
  • The wxWidgets-specific ascent member of Font has been removed which breaks compatibility with current wxStyledTextCtrl. - Bug #1682. + Bug #1682.
  • IME on Qt supports multiple carets and behaves more like other platforms. @@ -578,7 +2458,7 @@
  • TCL lexer reverts change to string handling. - Bug #1642. + Bug #1642.
  • Verilog lexer fixes bugs with macro styling. @@ -594,28 +2474,28 @@
  • Fix leak on Cocoa with autocompletion lists. - Bug #1706. + Bug #1706.
  • Fix potential crash on Cocoa with drag and drop. - Bug #1709. + Bug #1709.
  • Fix bug on Windows when compiling with MinGW-w64 which caused text to not be drawn when in wrap mode. - Bug #1705. + Bug #1705.
  • Fix SciTE bug with missing file open filters and add hex to excluded set of properties files so that its settings don't appear. - Bug #1707. + Bug #1707.
  • Fix SciTE bug where files without extensions like "makefile" were not highlighted correctly.

- Release 3.5.4 + Release 3.5.4

  • @@ -649,18 +2529,18 @@
  • Rust lexer accepts new 'is'/'us' integer suffixes instead of 'i'/'u'. - Bug #1098. + Bug #1098.
  • Ruby folder can fold multiline comments. - Bug #1697. + Bug #1697.
  • SQL lexer fixes a bug with the q-quote operator.
  • TCL lexer fixes a bug with some strings. - Bug #1642. + Bug #1642.
  • Verilog lexer handles escaped identifiers that begin with \ and end with space like \reset* . @@ -678,14 +2558,14 @@
  • Fix adaptive scrolling speed for GTK+ on OS X with GTK Quartz backend (as opposed to X11 backend). - Bug #1696. + Bug #1696.
  • Fix position of autocompletion and calltips on Cocoa when there were two screens stacked vertically.
  • Fix crash in SciTE when saving large files in background when closing application. - Bug #1691. + Bug #1691.
  • Fix decoding of MSVC warnings in SciTE so that files in the C:\Program Files (x86)\ directory can be opened. @@ -696,7 +2576,7 @@

- Release 3.5.3 + Release 3.5.3

- Release 3.5.2 + Release 3.5.2

  • @@ -787,7 +2667,7 @@
  • ANNOTATION_INDENTED added which is similar to ANNOTATION_BOXED in terms of positioning but does not show a border. - Feature #1086. + Feature #1086.
  • Allow platform overrides for drawing tab arrows, wrap markers, and line markers. @@ -796,23 +2676,23 @@
  • CoffeeScript lexer fixes "/*" to not be a comment. - Bug #1420. + Bug #1420.
  • VHDL folder fixes "block" keyword. - Bug #1664. + Bug #1664.
  • Prevent caret blinking when holding down Delete key. - Bug #1657. + Bug #1657.
  • On Windows, allow right click selection in popup menu. - Feature #1080. + Feature #1080.
  • On Windows, only call ShowCaret in GDI mode as it interferes with caret drawing when using Direct2D. - Bug #1643. + Bug #1643.
  • On Windows, another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITEDC added @@ -822,22 +2702,22 @@
  • On Windows, avoid processing mouse move events where the mouse has not moved as these can cause unexpected dwell start notifications. - Bug #1670. + Bug #1670.
  • For GTK+ on Windows, avoid extra space when pasting from external application.
  • On GTK+ 2.x allow Scintilla to be used inside tool tips by changing when preedit window created. - Bug #1662. + Bug #1662.
  • Support MinGW compilation under Linux. - Feature #1077. + Feature #1077.

- Release 3.5.1 + Release 3.5.1

  • @@ -845,22 +2725,22 @@
  • BibTeX lexer added. - Feature #1071. + Feature #1071.
  • SQL lexer supports the q-quote operator as SCE_SQL_QOPERATOR(24).
  • VHDL lexer supports block comments. - Bug #1527. + Bug #1527.
  • VHDL folder fixes case where "component" used before name. - Bug #613. + Bug #613.
  • Restore fractional pixel tab positioning which was truncated to whole pixels in 3.5.0. - Bug #1652. + Bug #1652.
  • Allow choice between windowed and inline IME on some platforms. @@ -868,14 +2748,14 @@
  • On GTK+ cache autocomplete window to avoid platform bug where windows were sometimes lost. - Bug #1649. + Bug #1649.
  • On GTK+ size autocomplete window more accurately.
  • On Windows only unregister windows classes registered. - Bug #1639. + Bug #1639.
  • On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added @@ -884,14 +2764,14 @@
  • On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy. - Bug #1636. + Bug #1636.
  • SciTE session files remember the scroll position.

- Release 3.5.0 + Release 3.5.0

  • @@ -906,8 +2786,8 @@ as required. This saves power as there are fewer wake ups. On recent releases of OS X Cocoa and Windows, coalescing timers are used to further save power. - Bug #1086. - Bug #1532. + Bug #1086. + Bug #1532.
  • Explicit tab stops may be set for each line. @@ -925,24 +2805,24 @@
  • HTML lexer fixes a crash with SGML after a Mako comment. - Bug #1622. + Bug #1622.
  • KiXtart lexer adds a block comment state. - Feature #1053. + Feature #1053.
  • Matlab lexer fixes transpose operations like "X{1}'". - Bug #1629. + Bug #1629.
  • Ruby lexer fixes bugs with the syntax of symbols including allowing a symbol to end with '?'. - Bug #1627. + Bug #1627.
  • Rust lexer supports byte string literals, naked CR can be escaped in strings, and files starting with "#![" are not treated as starting with a hashbang comment. - Feature #1063. + Feature #1063.
  • Bug fixed where style data was stale when deleting a rectangular selection. @@ -952,34 +2832,34 @@
  • Bug fixed where selection not redrawn after SCI_DELWORDRIGHT. - Bug #1633. + Bug #1633.
  • Change the function prototypes to be complete for functions exported as "C". - Bug #1618. + Bug #1618.
  • Fix a memory leak on GTK+ with autocompletion lists. - Bug #1638. + Bug #1638.
  • On GTK+, use the full character width for the overstrike caret for multibyte characters.
  • On Qt, set list icon size to largest icon. Add padding on OS X. - Bug #1634. + Bug #1634.
  • On Qt, fix building on FreeBSD 9.2. - Bug #1635. + Bug #1635.
  • On Qt, add a get_character method on the document. - Feature #1064. + Feature #1064.
  • On Qt, add SCI_* for methods to ScintillaConstants.py. - Feature #1065. + Feature #1065.
  • SciTE on GTK+ crash fixed with Insert Abbreviation command. @@ -990,11 +2870,11 @@
  • Fix SciTE bug where toggle bookmark did not work after multiple lines with bookmarks merged. - Bug #1617. + Bug #1617.

- Release 3.4.4 + Release 3.4.4

  • @@ -1011,7 +2891,7 @@
  • C++ lexer fixes crash for "#define x(". - Bug #1614. + Bug #1614.
  • C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW. @@ -1024,15 +2904,15 @@
  • TCL lexer fixes names of keyword sets. - Bug #1615. + Bug #1615.
  • Shell lexer fixes fold matching problem caused by "<<<". - Bug #1605. + Bug #1605.
  • Fix bug where indicators were not removed when fold highlighting on. - Bug #1604. + Bug #1604.
  • Fix bug on Cocoa where emoji were treated as being zero width. @@ -1062,19 +2942,19 @@
  • Fix crash in SciTE when stream comment performed at line end. - Bug #1610. + Bug #1610.
  • For SciTE on Windows, display error message when common dialogs fail. - Bug #156. + Bug #156.
  • - For SciTE on GTK+ fix bug with initialisation of toggle buttons in find and replace strips. - Bug #1612. + For SciTE on GTK+ fix bug with initialization of toggle buttons in find and replace strips. + Bug #1612.

- Release 3.4.3 + Release 3.4.3

  • @@ -1085,7 +2965,7 @@

- Release 3.4.2 + Release 3.4.2

  • @@ -1097,7 +2977,7 @@
  • DMIS lexer added. DMIS is a language for coordinate measuring machines. - Feature #1049. + Feature #1049.
  • Line state may be displayed in the line number margin to aid in debugging lexing and folding with @@ -1108,7 +2988,7 @@ Some macros with arguments can be understood and these may be predefined in keyword set 4 (keywords5 for SciTE) with syntax similar to CHECKVERSION(x)=(x<3). - Feature #1051. + Feature #1051.
  • C++ lexer can highlight task marker keywords in comments as SCE_C_TASKMARKER. @@ -1118,7 +2998,7 @@
  • C++ lexer supports Go back quoted raw string literals with lexer.cpp.backquoted.strings option. - Feature #1047. + Feature #1047.
  • SciTE performs word and search match highlighting as an idle task to improve interactivity @@ -1126,22 +3006,22 @@
  • Bug fixed on Cocoa where previous caret lines were visible. - Bug #1593. + Bug #1593.
  • Bug fixed where caret remained invisible when period set to 0. - Bug #1592. + Bug #1592.
  • Fixed display flashing when scrolling with GTK+ 3.10. - Bug #1567. + Bug #1567.
  • Fixed calls and constants deprecated in GTK+ 3.10.
  • Fixed bug on Windows where WM_GETTEXT did not provide data in UTF-16 for Unicode window. - Bug #685. + Bug #685.
  • For SciTE, protect access to variables used by threads with a mutex to prevent data races. @@ -1157,7 +3037,7 @@
  • For SciTE on Windows, fix bug where invoking help resubmitted the running program. - Bug #272. + Bug #272.
  • SciTE's highlight current word feature no longer matches the selection when it contains space. @@ -1168,7 +3048,7 @@

- Release 3.4.1 + Release 3.4.1

  • @@ -1179,20 +3059,20 @@
  • Bug fixed where cursor down failed on wrapped lines. - Bug #1585. + Bug #1585.
  • Caret positioning changed a little to appear inside characters less often by rounding the caret position to the pixel grid instead of truncating. - Bug #1588. + Bug #1588.
  • Bug fixed where automatic indentation wrong when caret in virtual space. - Bug #1586. + Bug #1586.
  • Bug fixed on Windows where WM_LBUTTONDBLCLK was no longer sent to window. - Bug #1587. + Bug #1587.
  • Bug fixed with SciTE on Windows XP where black stripes appeared inside the find and @@ -1200,11 +3080,11 @@
  • Crash fixed in SciTE with recursive properties files. - Bug #1507. + Bug #1507.
  • Bug fixed with SciTE where Ctrl+E before an unmatched end brace jumps to file start. - Bug #315. + Bug #315.
  • Fixed scrolling on Cocoa to avoid display glitches and be smoother. @@ -1214,14 +3094,14 @@

- Release 3.4.0 + Release 3.4.0

  • Released 22 March 2014.
  • - The Unicode line ends and substyles features added as provisional in 3.2.5 are now finalised. + The Unicode line ends and substyles features added as provisional in 3.2.5 are now finalized. There are now no provisional features.
  • @@ -1245,21 +3125,21 @@
  • Fix Coffeescript lexer for keyword style extending past end of word. Also fixes styling 0...myArray.length all as a number. - Bug #1583. + Bug #1583.
  • Fix crashes and other bugs in Fortran folder by removing folding of do-label constructs.
  • Deleting a whole line deletes the annotations on that line instead of the annotations on the next line. - Bug #1577. + Bug #1577.
  • Changed position of tall calltips to prefer lower half of screen to cut off end instead of start.
  • Fix Qt bug where double click treated as triple click. - Bug #1575. + Bug #1575.
  • On Qt, selecting an item in an autocompletion list that is not currently visible positions it at the top. @@ -1276,7 +3156,7 @@

- Release 3.3.9 + Release 3.3.9

  • @@ -1284,11 +3164,11 @@
  • Fix 3.3.8 bug where external lexers became inaccessible. - Bug #1574. + Bug #1574.

- Release 3.3.8 + Release 3.3.8

  • @@ -1307,29 +3187,29 @@
  • Basic lexer highlights hex, octal, and binary numbers in FreeBASIC which use the prefixes &h, &o and &b respectively. - Feature #1041. + Feature #1041.
  • C++ lexer fixes bug where keyword followed immediately by quoted string continued keyword style. - Bug #1564. + Bug #1564.
  • Matlab lexer treats '!' differently for Matlab and Octave languages. - Bug #1571. + Bug #1571.
  • Rust lexer improved with nested comments, more compliant doc-comment detection, octal literals, NUL characters treated as valid, and highlighting of raw string literals and float literals fixed. - Feature #1038. - Bug #1570. + Feature #1038. + Bug #1570.
  • On Qt expose the EOLMode on the document object.
  • Fix hotspot clicking where area was off by half a character width. - Bug #1562. + Bug #1562.
  • Tweaked scroll positioning by either 2 pixels or 1 pixel when caret is at left or right of view @@ -1361,11 +3241,11 @@
  • SciTE displays a warning message when asked to open a directory. - Bug #1568. + Bug #1568.

- Release 3.3.7 + Release 3.3.7

  • @@ -1373,15 +3253,15 @@
  • Lexer added for DMAP language. - Feature #1026. + Feature #1026.
  • Basic lexer supports multiline comments in FreeBASIC. - Feature #1023. + Feature #1023.
  • Bash lexer allows '#' inside words.. - Bug #1553. + Bug #1553.
  • C++ lexer recognizes C++11 user-defined literals and applies lexical class SCE_C_USERLITERAL. @@ -1392,32 +3272,32 @@
  • C++ lexer fixes bug with #include statements without " or > terminating filename. - Bug #1538. + Bug #1538.
  • C++ lexer fixes split of Doxygen keywords @code{.fileExtension} and @param[in,out]. - Bug #1551. + Bug #1551.
  • C++ lexer styles Doxygen keywords at end of document.
  • Cmake lexer fixes bug with empty comments. - Bug #1550. + Bug #1550.
  • Fortran folder improved. Treats "else" as fold header. - Feature #962. + Feature #962.
  • Fix bug with adjacent instances of the same indicator with different values where only the first was drawn. - Bug #1560. + Bug #1560.
  • For DirectWrite, use the GDI ClearType gamma value for SC_EFF_QUALITY_LCD_OPTIMIZED as this results in text that is similar in colour intensity to GDI. For the duller default DirectWrite ClearType text appearance, use SC_EFF_QUALITY_DEFAULT. - Feature #887. + Feature #887.
  • Fix another problem with drawing on Windows with Direct2D when returning from lock screen. @@ -1431,26 +3311,26 @@
  • On Cocoa, apply font quality setting to line numbers. - Bug #1544. + Bug #1544.
  • On Cocoa, clicking in margin now sets focus. - Bug #1542. + Bug #1542.
  • On Cocoa, correct cursor displayed in margin after showing dialog.
  • On Cocoa, multipaste mode now works. - Bug #1541. + Bug #1541.
  • On GTK+, chain up to superclass finalize so that all finalization is performed. - Bug #1549. + Bug #1549.
  • On GTK+, fix horizontal scroll bar range to not be double the needed width. - Bug #1546. + Bug #1546.
  • On OS X GTK+, report control key as SCI_META for mouse down events. @@ -1464,19 +3344,19 @@
  • SciTE fix for multiple message boxes when failing to save a file with save.on.deactivate. - Bug #1540. + Bug #1540.
  • SciTE on GTK+ fixes SIGCHLD handling so that Lua scripts can determine the exit status of processes they start. - Bug #1557. + Bug #1557.
  • SciTE on Windows XP fixes bad display of find and replace values when using strips.

- Release 3.3.6 + Release 3.3.6

  • @@ -1491,7 +3371,7 @@
  • Lexer added for Rust language. - Feature #1024. + Feature #1024.
  • Avoid false matches in errorlist lexer which is used for the SciTE output pane @@ -1499,19 +3379,19 @@
  • Perl lexer fixes bugs with multi-byte characters, including in HEREDOCs and PODs. - Bug #1528. + Bug #1528.
  • SQL folder folds 'create view' statements. - Feature #1020. + Feature #1020.
  • Visual Prolog lexer updated with better support for string literals and Unicode. - Feature #1025. + Feature #1025.
  • For SCI_SETIDENTIFIERS, \t, \r, and \n are allowed as well as space between identifiers. - Bug #1521. + Bug #1521.
  • Gaining and losing focus is now reported as a notification with the code set to SCN_FOCUSIN @@ -1543,18 +3423,18 @@
  • On Cocoa, make drag and drop work when destination view is empty. - Bug #1534. + Bug #1534.
  • On Cocoa, drag image fixed when view scrolled.
  • On Cocoa, SCI_POSITIONFROMPOINTCLOSE fixed when view scrolled. - Feature #1021. + Feature #1021.
  • On Cocoa, don't send selection change notification when scrolling. - Bug #1522. + Bug #1522.
  • On Qt, turn off idle events on destruction to prevent repeatedly calling idle. @@ -1577,11 +3457,11 @@
  • Fix SciTE bug with buffers becoming read-only. - Bug #1525. + Bug #1525.
  • Fix linking SciTE on non-Linux Unix systems with GNU toolchain by linking to libdl. - Bug #1523. + Bug #1523.
  • On Windows, SciTE's Incremental Search displays match failures by changing the background colour @@ -1593,7 +3473,7 @@

- Release 3.3.5 + Release 3.3.5

  • @@ -1608,27 +3488,27 @@
  • Option to allow mouse selection to switch to rectangular by pressing Alt after start of gesture. - Feature #1007. + Feature #1007.
  • Lexer added for KVIrc script. - Feature #1008. + Feature #1008.
  • Bash lexer fixed quoted HereDoc delimiters. - Bug #1500. + Bug #1500.
  • MS SQL lexer fixed ';' to appear as an operator. - Bug #1509. + Bug #1509.
  • Structured Text lexer fixed styling of enumeration members. - Bug #1508. + Bug #1508.
  • Fixed bug with horizontal caret position when margin changed. - Bug #1512. + Bug #1512.
  • Fixed bug on Cocoa where coordinates were relative to text subview instead of whole view. @@ -1637,12 +3517,12 @@ Ensure selection redrawn correctly in two cases. When switching from stream to rectangular selection with Alt+Shift+Up. When reducing the range of an additional selection by moving mouse up. - Feature #1007. + Feature #1007.
  • Copy and paste of rectangular selections compatible with Borland Delphi IDE on Windows. - Feature #1002. - Bug #1513. + Feature #1002. + Bug #1513.
  • Initialize extended styles to the default style. @@ -1658,22 +3538,22 @@
  • Fixed SciTE failure to save initial buffer in single buffer mode. - Bug #1339. + Bug #1339.
  • Fixed compilation problem with Visual C++ in non-English locales. - Bug #1506. + Bug #1506.
  • Disable Direct2D when compiling with MinGW gcc on Windows because of changes in the recent MinGW release.
  • SciTE crash fixed for negative line.margin.width. - Bug #1504. + Bug #1504.
  • SciTE fix for infinite dialog boxes when failing to automatically save a file. - Bug #1503. + Bug #1503.
  • SciTE settings buffered.draw, two.phase.draw, and technology are applied to the @@ -1681,7 +3561,7 @@

- Release 3.3.4 + Release 3.3.4

  • @@ -1690,7 +3570,7 @@
  • Handling of UTF-8 and DBCS text in lexers improved with methods ForwardBytes and GetRelativeCharacter added to StyleContext. - Bug #1483. + Bug #1483.
  • For Unicode text, case-insensitive searching and making text upper or lower case is now @@ -1717,28 +3597,28 @@
  • CoffeeScript lexer fixes a bug with comment blocks. - Bug #1495 + Bug #1495
  • ECL lexer regular expression code fixed. - Bug #1491. + Bug #1491.
  • - errorlist lexer only recognises Perl diagnostics when there is a filename between + errorlist lexer only recognizes Perl diagnostics when there is a filename between "at" and "line". Had been triggering for MSVC errors containing "at line".
  • Haskell lexer fixed to avoid unnecessary full redraws. Don't highlight CPP inside comments when styling.within.preprocessor is on. - Bug #1459. + Bug #1459.
  • Lua lexer fixes bug in labels with UTF-8 text. - Bug #1483. + Bug #1483.
  • Perl lexer fixes bug in string interpolation with UTF-8 text. - Bug #1483. + Bug #1483.
  • Fixed bugs with case conversion when the result was longer or shorter than the original text. @@ -1760,7 +3640,7 @@
  • Minor memory leak fixed. - Bug #1487. + Bug #1487.
  • On Cocoa, fixed insertText: method which was broken when implementing a newer protocol. @@ -1778,11 +3658,11 @@
  • Fixed SciTE on GTK+ bug where a tool command could be performed using the keyboard while one was already running leading to confusion and crashes. - Bug #1486. + Bug #1486.
  • Fixed SciTE bug in Copy as RTF which was limited to first 32 styles. - Bug #1011. + Bug #1011.
  • Fixed SciTE on Windows user strip height when the system text scaling factor is 125% or 150%. @@ -1792,7 +3672,7 @@
  • Visual C++ 2013 supported. - Bug #1492. + Bug #1492.
  • Python scripts used for building and maintenance improved and moved into scripts directory. @@ -1806,7 +3686,7 @@

- Release 3.3.3 + Release 3.3.3

- Release 3.3.2 + Release 3.3.2

  • @@ -1853,28 +3733,28 @@
  • On Cocoa, implement font quality setting. - Feature #988. + Feature #988.
  • On Cocoa, implement automatic enabling of commands and added clear command. - Feature #987. + Feature #987.
  • C++ lexer adds style for preprocessor doc comment. - Feature #990. + Feature #990.
  • Haskell lexer and folder improved. Separate mode for literate Haskell "literatehaskell" SCLEX_LITERATEHASKELL. - Bug #1459 . + Bug #1459 .
  • LaTeX lexer bug fixed for Unicode character following '\'. - Bug #1468 . + Bug #1468 .
  • - PowerShell lexer recognises here strings and doccomment keywords. + PowerShell lexer recognizes here strings and doccomment keywords. #region folding added. - Feature #985. + Feature #985.
  • Fix multi-typing when two carets are located in virtual space on one line so that spaces @@ -1891,7 +3771,7 @@
  • Fix crash on Cocoa when view deallocated. - Bug #1466. + Bug #1466.
  • Fix Qt window positioning to not assume the top right of a monitor is at 0, 0. @@ -1901,7 +3781,7 @@
  • Qt now supports Qt 5.0. - Bug #1448. + Bug #1448.
  • Fix drawing on Windows with Direct2D when returning from lock screen. @@ -1921,7 +3801,7 @@

- Release 3.3.1 + Release 3.3.1

  • @@ -1929,21 +3809,21 @@
  • Autocompletion lists can now appear in priority order or be sorted by Scintilla. - Feature #981. + Feature #981.
  • Most lexers now lex an extra NUL byte at the end of the document which makes it more likely they will classify keywords at document end correctly. - Bug #574, - Bug #588. + Bug #574, + Bug #588.
  • Haskell lexer improved in several ways. - Bug #1459. + Bug #1459.
  • - Matlab/Octave lexer recognises block comments and ... comments. - Bug #1414. + Matlab/Octave lexer recognizes block comments and ... comments. + Bug #1414.
  • Ruby lexer crash fixed with keyword at start of document. @@ -1971,7 +3851,7 @@

- Release 3.3.0 + Release 3.3.0

  • @@ -1991,33 +3871,33 @@ If the whole range can not be displayed, priority is given to one end.
  • - C++ lexer no longer recognises raw (R"") strings when the first character after " + C++ lexer no longer recognizes raw (R"") strings when the first character after " is invalid. - Bug #1454. + Bug #1454.
  • - HTML lexer recognises JavaScript RegEx literals in more contexts. - Bug #1412. + HTML lexer recognizes JavaScript RegEx literals in more contexts. + Bug #1412.
  • Fixed automatic display of folded text when return pressed at end of fold header and first folded line was blank. - Bug #1455. + Bug #1455.
  • SCI_VISIBLEFROMDOCLINE fixed to never return a line beyond the document end.
  • SCI_LINESCROLL fixed for a negative column offset. - Bug #1450. + Bug #1450.
  • On GTK+, fix tab markers so visible if indent markers are visible. - Bug #1453. + Bug #1453.

- Release 3.2.5 + Release 3.2.5

  • @@ -2035,27 +3915,27 @@
  • The C++ lexer understands the #undef directive when determining preprocessor definitions. - Feature #978. + Feature #978.
  • - The errorlist lexer recognises gcc include path diagnostics that appear before an error. + The errorlist lexer recognizes gcc include path diagnostics that appear before an error.
  • Folding implemented for GetText (PO) translation language. - Bug #1437. + Bug #1437.
  • HTML lexer does not interrupt comment style for processing instructions. - Bug #1447. + Bug #1447.
  • Fix SciTE forgetting caret x-position when switching documents. - Bug #1442. + Bug #1442.
  • Fixed bug where vertical scrollbar thumb appeared at beginning of document when scrollbar shown. - Bug #1446. + Bug #1446.
  • Fixed brace-highlighting bug on OS X 10.8 where matching brace is on a different line. @@ -2070,7 +3950,7 @@

- Release 3.2.4 + Release 3.2.4

  • @@ -2078,7 +3958,7 @@
  • Caret line highlight can optionally remain visible when window does not have focus. - Feature #964. + Feature #964.
  • Delegate mechanism for notifications added on Cocoa. @@ -2086,34 +3966,34 @@
  • NUL characters in selection are copied to clipboard as spaces to avoid truncating at the NUL. - Bug #1289. + Bug #1289.
  • C++ lexer fixes problem with showing inactive sections when preprocessor lines contain trailing comment. - Bug #1413. + Bug #1413.
  • C++ lexer fixes problem with JavaScript regular expressions with '/' in character ranges. - Bug #1415. + Bug #1415.
  • LaTeX folder added. - Feature #970. + Feature #970.
  • LaTeX lexer improves styling of math environments. - Feature #970. + Feature #970.
  • MySQL lexer implements hidden commands.
  • Only produce a single undo step when autocompleting a single word. - Bug #1421. + Bug #1421.
  • Fixed crash when printing lines longer than 8000 characters. - Bug #1430. + Bug #1430.
  • Fixed problem in character movement extends selection mode where reversing @@ -2122,7 +4002,7 @@
  • Memory issues fixed on Cocoa, involving object ownership, lifetime of timers, and images held by the info bar. - Bug #1436. + Bug #1436.
  • Cocoa key binding for Alt+Delete changed to delete previous word to be more compatible with @@ -2130,7 +4010,7 @@
  • Fixed crash on Cocoa with scrollbar when there is no scrolling possible. - Bug #1416. + Bug #1416.
  • On Cocoa with retina display fixed positioning of autocompletion lists. @@ -2138,23 +4018,23 @@
  • Fixed SciTE on Windows failure to run a batch file with a name containing a space by quoting the path in the properties file. - Bug #1423. + Bug #1423.
  • Fixed scaling bug when printing on GTK+. - Bug #1427. + Bug #1427.
  • SciTE on GTK toolbar.detachable feature removed.
  • Fixed some background saving bugs in SciTE. - Bug #1366. - Bug #1339. + Bug #1366. + Bug #1339.

- Release 3.2.3 + Release 3.2.3

  • @@ -2179,7 +4059,7 @@ Bug #3515392.
  • - For C/C++, recognise exponent in floating point hexadecimal literals. + For C/C++, recognize exponent in floating point hexadecimal literals. Bug #3576454.
  • @@ -2236,7 +4116,7 @@

- Release 3.2.2 + Release 3.2.2

  • @@ -2345,11 +4225,11 @@
  • Added ncurses platform definitions. Implementation is maintained separately as - Scinterm. + Scinterm.

- Release 3.2.1 + Release 3.2.1

  • @@ -2465,7 +4345,7 @@

- Release 3.2.0 + Release 3.2.0

  • @@ -2555,7 +4435,7 @@

- Release 3.1.0 + Release 3.1.0

  • @@ -2647,7 +4527,7 @@

- Release 3.0.4 + Release 3.0.4

  • @@ -2807,7 +4687,7 @@

- Release 3.0.3 + Release 3.0.3

  • @@ -2923,7 +4803,7 @@

- Release 3.0.2 + Release 3.0.2

  • @@ -2936,7 +4816,7 @@ Printing implemented in SciTE on GTK+ 3.x.
  • - ILoader interface for background loading finalised and documented. + ILoader interface for background loading finalized and documented.
  • CoffeeScript lexer added. @@ -2987,7 +4867,7 @@

- Release 3.0.1 + Release 3.0.1

  • @@ -3018,7 +4898,7 @@ as this avoids faint lines at lexeme boundaries.
  • - Ensure pixmaps allocated before painting as there was a crash when Scintilla drew without common initialisation calls. + Ensure pixmaps allocated before painting as there was a crash when Scintilla drew without common initialization calls. Bug #3432354.
  • @@ -3033,12 +4913,12 @@ Fixed leak of document objects in SciTE.
  • - Recognise URL characters '?' and '%' for Open Selected command in SciTE. + Recognize URL characters '?' and '%' for Open Selected command in SciTE. Bug #3429409.

- Release 3.0.0 + Release 3.0.0

  • @@ -3108,7 +4988,7 @@

- Release 2.29 + Release 2.29

  • @@ -3128,7 +5008,7 @@ avenue, baan, escript, lot, metapost, and mmixal.
  • - C++ lexer fixed a bug with raw strings being recognised too easily. + C++ lexer fixed a bug with raw strings being recognized too easily. Bug #3388122.
  • @@ -3189,7 +5069,7 @@

- Release 2.28 + Release 2.28

  • @@ -3233,7 +5113,7 @@ Bug #3014850.
  • - Mako template language block syntax extended and ## comments recognised. + Mako template language block syntax extended and ## comments recognized. Feature #3325178. Bug #3318818.
  • @@ -3290,7 +5170,7 @@

- Release 2.27 + Release 2.27

  • @@ -3401,7 +5281,7 @@

- Release 2.26 + Release 2.26

  • @@ -3438,7 +5318,7 @@ Batch file lexer allows braces '(' or ')' inside variable names.
  • - The cpp lexer only recognises Vala triple quoted strings when lexer.cpp.triplequoted.strings property is set. + The cpp lexer only recognizes Vala triple quoted strings when lexer.cpp.triplequoted.strings property is set. Bug #3239234.
  • @@ -3535,7 +5415,7 @@

- Release 2.25 + Release 2.25

  • @@ -3572,7 +5452,7 @@ LPeg lexer support‎ improved in SciTE.
  • - SciTE on Windows-64 fixes for menu localisation and Lua scripts. + SciTE on Windows-64 fixes for menu localization and Lua scripts. Bug #3204502.
  • @@ -3595,7 +5475,7 @@

- Release 2.24 + Release 2.24

  • @@ -3702,7 +5582,7 @@

- Release 2.23 + Release 2.23

  • @@ -3726,7 +5606,7 @@ Performance improved when creating large rectangular selections.
  • - PHP folder recognises #region and #endregion comments. + PHP folder recognizes #region and #endregion comments. Feature #3101624.
  • @@ -3735,7 +5615,7 @@ Feature #3098071.
  • - SQL folder recognises case statements and understands the fold.at.else property. + SQL folder recognizes case statements and understands the fold.at.else property. Bug #3104091. Bug #3107362.
  • @@ -3759,7 +5639,7 @@

- Release 2.22 + Release 2.22

  • @@ -3829,7 +5709,7 @@ Bug #3058924.
  • - JavaScript lexer recognise regexes following return keyword.‎ + JavaScript lexer recognize regexes following return keyword.‎ Bug #3062287.
  • @@ -3865,7 +5745,7 @@

- Release 2.21 + Release 2.21

  • @@ -3963,7 +5843,7 @@

- Release 2.20 + Release 2.20

  • @@ -4084,7 +5964,7 @@

- Release 2.12 + Release 2.12

  • @@ -4118,7 +5998,7 @@ SciTE HTML exports take the Use Monospaced Font setting into account.
  • - SciTE window title "[n of m]" localised. + SciTE window title "[n of m]" localized.
  • When new line inserted at start of line, markers are moved down. @@ -4172,7 +6052,7 @@

- Release 2.11 + Release 2.11

  • @@ -4191,7 +6071,7 @@

- Release 2.10 + Release 2.10

  • @@ -4281,7 +6161,7 @@

- Release 2.03 + Release 2.03

  • @@ -4291,8 +6171,8 @@ Added SCI_SETFIRSTVISIBLELINE to match SCI_GETFIRSTVISIBLELINE.
  • - Erlang lexer extended set of numeric bases recognised; separate style for module:function_name; detects - built-in functions, known module attributes, and known preprocessor instructions; recognises EDoc and EDoc macros; + Erlang lexer extended set of numeric bases recognized; separate style for module:function_name; detects + built-in functions, known module attributes, and known preprocessor instructions; recognizes EDoc and EDoc macros; separates types of comments. Bug #2942448.
  • @@ -4327,7 +6207,7 @@

- Release 2.02 + Release 2.02

  • @@ -4489,7 +6369,7 @@

- Release 2.01 + Release 2.01

  • @@ -4518,7 +6398,7 @@

- Release 2.0 + Release 2.0

  • @@ -4535,7 +6415,7 @@ SciTE on GTK+ path bar is now optional and defaults to off.
  • - MagikSF lexer recognises numbers correctly. + MagikSF lexer recognizes numbers correctly.
  • Folding of Python comments and blank lines improved. Bug #210240. @@ -4577,7 +6457,7 @@

- Release 1.79 + Release 1.79

  • @@ -4663,7 +6543,7 @@ Unit test script for Scintilla on Windows included with source code.
  • - User defined menu items are now localised when there is a matching translation. + User defined menu items are now localized when there is a matching translation.
  • Width of icon column of autocompletion lists on GTK+ made more consistent. @@ -4682,7 +6562,7 @@

- Release 1.78 + Release 1.78

  • @@ -4786,7 +6666,7 @@ Bug #2671749.
  • - SciTE on GTK+ crash fixed on startup when child process exits before initialisation complete. + SciTE on GTK+ crash fixed on startup when child process exits before initialization complete. Bug #2716987.
  • @@ -4806,7 +6686,7 @@

- Release 1.77 + Release 1.77

  • @@ -4932,7 +6812,7 @@

- Release 1.76 + Release 1.76

  • @@ -4997,7 +6877,7 @@

- Release 1.75 + Release 1.75

  • @@ -5070,7 +6950,7 @@ Bash lexer handles octal literals.
  • - C++/JavaScript lexer recognises regex literals in more situations. + C++/JavaScript lexer recognizes regex literals in more situations.
  • Haskell lexer fixed for quoted strings. @@ -5081,7 +6961,7 @@ ASP problem fixed where </ is used inside a comment.
  • - Error messages from Lua 5.1 are recognised. + Error messages from Lua 5.1 are recognized.
  • Folding implemented for Metapost. @@ -5138,7 +7018,7 @@

- Release 1.74 + Release 1.74

  • @@ -5232,7 +7112,7 @@

- Release 1.73 + Release 1.73

  • @@ -5245,7 +7125,7 @@ Style changes may be made during text modification events.
  • - Regular expressions recognise \d, \D, \s, \S, \w, \W, and \xHH. + Regular expressions recognize \d, \D, \s, \S, \w, \W, and \xHH.
  • Support for cmake language added. @@ -5269,7 +7149,7 @@ SciTE on GTK+ removed GTK+ 1.x compatible file dialog code.
  • - SciTE on GTK+ recognises key names KeypadMultiply and KeypadDivide. + SciTE on GTK+ recognizes key names KeypadMultiply and KeypadDivide.
  • Background colour of line wrapping visual flag changed to STYLE_DEFAULT. @@ -5350,7 +7230,7 @@

- Release 1.72 + Release 1.72

  • @@ -5441,7 +7321,7 @@

- Release 1.71 + Release 1.71

  • @@ -5494,7 +7374,7 @@

- Release 1.70 + Release 1.70

  • @@ -5506,7 +7386,7 @@ when no similar character is available a '?' may be inserted.
  • - On GTK+, the internationalised IM (Input Method) feature is used for all typed input for all character sets. + On GTK+, the internationalized IM (Input Method) feature is used for all typed input for all character sets.
  • Scintilla has new margin types SC_MARGIN_BACK and SC_MARGIN_FORE that use the default @@ -5528,7 +7408,7 @@

- Release 1.69 + Release 1.69

  • @@ -5547,7 +7427,7 @@ Support for Spice language.
  • - On GTK+ autocompletion lists are optimised and use correct selection colours. + On GTK+ autocompletion lists are optimized and use correct selection colours.
  • On GTK+ the URI data type is preferred in drag and drop so that applications @@ -5618,7 +7498,7 @@

- Release 1.68 + Release 1.68

  • @@ -5713,7 +7593,7 @@

- Release 1.67 + Release 1.67

  • @@ -5739,7 +7619,7 @@ Bash lexer handles here documents better.
  • - JavaScript lexing recognises regular expressions more accurately and includes flag + JavaScript lexing recognizes regular expressions more accurately and includes flag characters in the regular expression style. This is both in JavaScript files and when JavaScript is embedded in HTML.
  • @@ -5857,7 +7737,7 @@

- Release 1.66 + Release 1.66

  • @@ -5875,7 +7755,7 @@ An initial ">" on a line is ignored when Enter pressed.
  • - C++ lexer recognises keywords within line doc comments. It continues styles over line + C++ lexer recognizes keywords within line doc comments. It continues styles over line end characters more consistently so that eolfilled style can be used for preprocessor lines and line comments.
  • @@ -5933,7 +7813,7 @@

- Release 1.65 + Release 1.65

  • @@ -5965,7 +7845,7 @@
  • Perl lexer handles here docs better; disambiguates barewords, quote-like delimiters, and repetition operators; - handles Pods after __END__; recognises numbers better; and handles some typeglob special variables. + handles Pods after __END__; recognizes numbers better; and handles some typeglob special variables.
  • Lisp adds more lexical states. @@ -5974,7 +7854,7 @@ PHP allows spaces after <<<.
  • - TADS3 has a simpler set of states and recognises identifiers. + TADS3 has a simpler set of states and recognizes identifiers.
  • Avenue elseif folds better. @@ -5984,7 +7864,7 @@ styles from '+' and '-' as they indicate file names in diffs.
  • - SciTE error recogniser handles file paths in extra explanatory lines from MSVC + SciTE error recognizer handles file paths in extra explanatory lines from MSVC and in '+++' and '---' lines from diff.
  • @@ -5994,7 +7874,7 @@
  • SciTE on Windows uses correct font for dialogs and better font for tab bar - allowing better localisation + allowing better localization
  • When Windows is used with a secondary monitor before the primary @@ -6023,7 +7903,7 @@

- Release 1.64 + Release 1.64

  • @@ -6072,7 +7952,7 @@
  • Perl can fold POD and package sections. POD verbatim section style. - Globbing syntax recognised better. + Globbing syntax recognized better.
  • Context menu moved slightly on GTK+ so that it will be under the mouse and will @@ -6120,7 +8000,7 @@

- Release 1.63 + Release 1.63

  • @@ -6170,7 +8050,7 @@ SQL lexer gains second set of keywords.
  • - Errorlist lexer recognises Borland Delphi error messages. + Errorlist lexer recognizes Borland Delphi error messages.
  • Method added for determining number of visual lines occupied by a document @@ -6304,7 +8184,7 @@

- Release 1.62 + Release 1.62

  • @@ -6412,7 +8292,7 @@ PHP lexer handles 'e' in numerical literals.
  • - PowerBasic lexer updated for macros and optimised. + PowerBasic lexer updated for macros and optimized.
  • Properties file folder changed to leave lines before a header at the base level @@ -6449,7 +8329,7 @@ Other Lua scripting bugs fixed.
  • - SciTE on Windows localisation of menu accelerators changed to be compatible + SciTE on Windows localization of menu accelerators changed to be compatible with alternative UI themes.
  • @@ -6521,7 +8401,7 @@

- Release 1.61 + Release 1.61

  • @@ -6557,7 +8437,7 @@ AutoIt3 lexer updated.
  • - Perl lexer recognises regular expression use better. + Perl lexer recognizes regular expression use better.
  • Errorlist lexer understands Lua tracebacks and copes with findstr @@ -6604,7 +8484,7 @@

- Release 1.60 + Release 1.60

  • @@ -6645,7 +8525,7 @@ correctly in more circumstances.
  • - PHP recognises variables within strings. + PHP recognizes variables within strings.
  • NSIS has properties "nsis.uservars" and "nsis.ignorecase". @@ -6711,7 +8591,7 @@
  • Key bindings for command.shortcut implemented in a way that doesn't break - when the menus are localised. + when the menus are localized.
  • Drawing of background on GTK+ faster as theme drawing disabled. @@ -6774,7 +8654,7 @@

- Release 1.59 + Release 1.59

  • @@ -6856,7 +8736,7 @@

- Release 1.58 + Release 1.58

  • @@ -6897,9 +8777,9 @@ Replace in Selection performed.
  • - Localisation files may contain a translation.encoding setting which is used + Localization files may contain a translation.encoding setting which is used on GTK+ 2 to automatically reencode the translation to UTF-8 so it will be - the localised text will be displayed correctly. + the localized text will be displayed correctly.
  • SciTE on GTK+ implements check.if.already.open. @@ -6944,7 +8824,7 @@

- Release 1.57 + Release 1.57

  • @@ -7019,7 +8899,7 @@

- Release 1.56 + Release 1.56

  • @@ -7107,7 +8987,7 @@

- Release 1.55 + Release 1.55

  • @@ -7204,7 +9084,7 @@

- Release 1.54 + Release 1.54

  • @@ -7290,7 +9170,7 @@

- Release 1.53 + Release 1.53

  • @@ -7361,7 +9241,7 @@

- Release 1.52 + Release 1.52

  • @@ -7443,7 +9323,7 @@ CSS lexer improved.
  • - Interface to platform layer changed - Surface initialisation now requires + Interface to platform layer changed - Surface initialization now requires a WindowID parameter.
  • @@ -7498,7 +9378,7 @@

- Release 1.51 + Release 1.51

  • @@ -7590,7 +9470,7 @@

- Release 1.50 + Release 1.50

  • @@ -7633,7 +9513,7 @@ the subject of the Open Selected Filename command.
  • - The localisation file name can be changed with the locale.properties property. + The localization file name can be changed with the locale.properties property.
  • On Windows, SciTE can pipe the result of a string expression into a command line tool. @@ -7706,7 +9586,7 @@

- Release 1.49 + Release 1.49

  • @@ -7732,7 +9612,7 @@ and block comments.
  • - Errorlist lexer recognises PHP error messages. + Errorlist lexer recognizes PHP error messages.
  • Variant of the C++ lexer with case insensitive keywords @@ -7764,7 +9644,7 @@ SciTE Save All command saves all buffers.
  • - SciTE localisation compares keys case insensitively to make translations more flexible. + SciTE localization compares keys case insensitively to make translations more flexible.
  • SciTE detects a utf-8 coding cookie "coding: utf-8" in first two @@ -7804,7 +9684,7 @@

- Release 1.48 + Release 1.48

  • @@ -7832,10 +9712,10 @@ independent of the colours chosen for the lexical class of that whitespace.
  • - Per line data optimised by using an exponential allocation scheme. + Per line data optimized by using an exponential allocation scheme.
  • - SciTE API file loading optimised. + SciTE API file loading optimized.
  • SciTE for GTK+ subsystem 2 documented. The exit status of commands @@ -7909,7 +9789,7 @@

- Release 1.47 + Release 1.47

  • @@ -7942,7 +9822,7 @@ SciTE in scite/boundscheck.
  • - SciTE automatically recognises Unicode files based + SciTE automatically recognizes Unicode files based on their Byte Order Marks and switches to Unicode mode. On Windows, where SciTE supports Unicode display, this allows display of non European characters. @@ -8040,7 +9920,7 @@

- Release 1.46 + Release 1.46

  • @@ -8156,7 +10036,7 @@

- Release 1.45 + Release 1.45

  • @@ -8187,10 +10067,10 @@ insertion point.
  • - On Windows with a wheel mouse, page-at-a-time mode is recognised. + On Windows with a wheel mouse, page-at-a-time mode is recognized.
  • - Read-only mode added to SciTE with a property to initialise it and another property, + Read-only mode added to SciTE with a property to initialize it and another property, $(ReadOnly) available to show this mode in the status bar.
  • @@ -8243,12 +10123,12 @@
  • In SciTE, indentation and tab settings stored with buffers so maintained correctly as buffers selected. - The properties used to initialise these settings can now be set separately for different + The properties used to initialize these settings can now be set separately for different file patterns.
  • Thread safety improved on Windows with a critical section protecting the font - cache and initialisation of globals performed within Scintilla_RegisterClasses. + cache and initialization of globals performed within Scintilla_RegisterClasses. New Scintilla_ReleaseResources call provided to allow explicit freeing of resources when statically bound into another application. Resources automatically freed in DLL version. The window classes are now unregistered as part of resource @@ -8262,7 +10142,7 @@

- Release 1.44 + Release 1.44

  • @@ -8312,7 +10192,7 @@

- Release 1.43 + Release 1.43

  • @@ -8388,14 +10268,14 @@

- Release 1.42 + Release 1.42

  • Released on 24 December 2001.
  • - Better localisation support including context menus and most messages. + Better localization support including context menus and most messages. Translations of the SciTE user interface available for Bulgarian, French, German, Italian, Russian, and Turkish.
  • @@ -8503,10 +10383,10 @@ modifications.
  • - Horizontal scrolling and display of long lines optimised. + Horizontal scrolling and display of long lines optimized.
  • - Cursor setting in Scintilla on GTK+ optimised. + Cursor setting in Scintilla on GTK+ optimized.
  • Experimental changeable style attribute. @@ -8522,7 +10402,7 @@

- Release 1.41 + Release 1.41

  • @@ -8588,7 +10468,7 @@ menu.language property rather than being hardcoded.
  • - The user interface of SciTE can be localised to a particular language by editing + The user interface of SciTE can be localized to a particular language by editing a locale.properties file.
  • @@ -8609,7 +10489,7 @@

- Release 1.40 + Release 1.40

  • @@ -8698,7 +10578,7 @@

- Release 1.39 + Release 1.39

  • @@ -8866,7 +10746,7 @@

- Release 1.38 + Release 1.38

  • @@ -8919,7 +10799,7 @@ Regular expression '^' and '$' work more often allowing insertion of text at start or end of line with a replace command. Backslash quoted control characters \a, \b, \f, \t, and \v - recognised within sets. + recognized within sets.
  • Session files for SciTE. @@ -8951,7 +10831,7 @@

- Release 1.37 + Release 1.37

  • @@ -8989,7 +10869,7 @@ Option in both Scintilla and SciTE to treat both left and right margin as equally important when repositioning visible area in response to caret movement. Default is to prefer visible area positioning which - minimises the horizontal scroll position thus favouring the left margin. + minimizes the horizontal scroll position thus favouring the left margin.
  • Caret line highlighting. @@ -9076,7 +10956,7 @@ led to that range becoming permanently invisible.
  • - Bug fixed in Batch lexer where comments were not recognised. + Bug fixed in Batch lexer where comments were not recognized.
  • Bug fixed with undo actions coalescing into steps incorrectly. @@ -9114,7 +10994,7 @@

- Release 1.36 + Release 1.36

  • @@ -9215,7 +11095,7 @@

- Release 1.35 + Release 1.35

  • @@ -9317,7 +11197,7 @@

- Release 1.34 + Release 1.34

  • @@ -9374,7 +11254,7 @@

- Release 1.33 + Release 1.33

  • @@ -9411,7 +11291,7 @@
  • Changes to Python lexer to allow 'as' as a context sensitive keyword and the - string forms starting with u, r, and ur to be recognised. + string forms starting with u, r, and ur to be recognized.
  • SCN_POSCHANGED notification now working and SCN_PAINTED notification added. @@ -9470,7 +11350,7 @@

- Release 1.32 + Release 1.32

  • @@ -9482,7 +11362,7 @@

- Release 1.31 + Release 1.31

  • @@ -9597,7 +11477,7 @@

- Release 1.30 + Release 1.30

  • @@ -9613,7 +11493,7 @@ use the old APIs.
  • - "if" and "import" statements in SciTE properties files allows modularisation into + "if" and "import" statements in SciTE properties files allows modularization into language-specific properties files and choices based upon platform. This means that SciTE is delivered with 9 language-specific properties files as well as the standard SciTEGlobal.properties file. @@ -9629,7 +11509,7 @@ a dark background) and to force black on white printing.
  • - Option for printing magnified or miniaturised from screen settings. + Option for printing magnified or miniaturized from screen settings.
  • In SciTE, Ctrl+F3 and Ctrl+Shift+F3 find the selection in the forwards and backwards @@ -9657,7 +11537,7 @@
  • When saving a file, the SciTE option save.deletes.first deletes it before doing the save. - This allows saving with a different capitalisation on Windows. + This allows saving with a different capitalization on Windows.
  • When use tabs option is off pressing the tab key inserts spaces. @@ -9667,7 +11547,7 @@

- Release 1.28 + Release 1.28

  • @@ -9685,7 +11565,7 @@

- Release 1.27 + Release 1.27

  • @@ -9714,7 +11594,7 @@

- Release 1.26 + Release 1.26

  • @@ -9779,12 +11659,12 @@ Bug fixed with hiding fold margin by setting fold.margin.width to 0.
  • - Bugs fixed with file name confusion on Windows when long and short names used, or different capitalisations, + Bugs fixed with file name confusion on Windows when long and short names used, or different capitalizations, or relative paths.

- Release 1.25 + Release 1.25

  • @@ -9852,7 +11732,7 @@

- Release 1.24 + Release 1.24

  • @@ -9878,7 +11758,7 @@ Fixed bugs relating to null fonts.
  • - Fixed bugs where recolourisation was not done sometimes when required. + Fixed bugs where recolourization was not done sometimes when required.
  • Fixed compilation problems with SVector.h. @@ -9888,7 +11768,7 @@

- Release 1.23 + Release 1.23

  • @@ -9960,7 +11840,7 @@

- Release 1.22 + Release 1.22

  • @@ -9981,7 +11861,7 @@ Optional macro recording support.
  • - User properties file (SciTEUser.properties) allows for customisation by the user + User properties file (SciTEUser.properties) allows for customization by the user that is not overwritten with each installation of SciTE.
  • @@ -10039,7 +11919,7 @@ is more likely to show the same text as when the file was previously visible.
  • - Document reference count now initialised correctly. + Document reference count now initialized correctly.
  • Setting a null document pointer creates an empty document. @@ -10060,7 +11940,7 @@

- Release 1.21 + Release 1.21

  • @@ -10096,7 +11976,7 @@

- Release 1.2 + Release 1.2

  • @@ -10131,7 +12011,7 @@

- Release 1.15 + Release 1.15

  • @@ -10169,7 +12049,7 @@ File open filter remembered in SciTE on Windows.
  • - New mechanism using style numbers 32 to 36 standardises the setting of styles for brace + New mechanism using style numbers 32 to 36 standardizes the setting of styles for brace highlighting, brace badlighting, line numbers, control characters and the default style.
  • @@ -10178,7 +12058,7 @@

- Release 1.14 + Release 1.14

  • @@ -10189,7 +12069,7 @@

- Release 1.13 + Release 1.13

  • @@ -10217,7 +12097,7 @@

- Release 1.12 + Release 1.12

  • @@ -10229,7 +12109,7 @@

- Release 1.11 + Release 1.11

  • @@ -10249,7 +12129,7 @@

- Release 1.1 + Release 1.1

  • @@ -10306,7 +12186,7 @@

- Release 1.02 + Release 1.02

  • @@ -10333,7 +12213,7 @@

- Release 1.01 + Release 1.01

  • @@ -10357,7 +12237,7 @@

- Release 1.0 + Release 1.0

  • @@ -10379,7 +12259,7 @@

- Beta release 0.93 + Beta release 0.93

  • @@ -10390,7 +12270,7 @@

- Beta release 0.92 + Beta release 0.92

  • @@ -10410,7 +12290,7 @@

- Beta release 0.91 + Beta release 0.91

  • @@ -10419,19 +12299,19 @@

- Beta release 0.90 + Beta release 0.90

  • Released on 29 April 1999, containing working GTK+/Linux version.
  • - The Java, C++ and Python lexers recognise operators as distinct from default allowing them + The Java, C++ and Python lexers recognize operators as distinct from default allowing them to be highlighted.

- Beta release 0.82 + Beta release 0.82

  • @@ -10440,7 +12320,7 @@

- Beta release 0.81 + Beta release 0.81

  • @@ -10448,7 +12328,7 @@
  • Static linking supported and Tidy.EXE, a statically linked version of Tide.EXE. Changes to - compiler flags in the makefiles to optimise for size. + compiler flags in the makefiles to optimize for size.
  • Scintilla supports a 'savepoint' in the undo stack which can be set by the container when diff --git a/scintilla/doc/ScintillaRelated.html b/scintilla/doc/ScintillaRelated.html index 956f8055..213ada01 100644 --- a/scintilla/doc/ScintillaRelated.html +++ b/scintilla/doc/ScintillaRelated.html @@ -6,6 +6,7 @@ + Scintilla and SciTE Related Sites @@ -37,7 +38,7 @@ is a port to MorphOS.

    - Wx::Scintilla + Wx::Scintilla is a Perl Binding for Scintilla on wxWidgets.

    @@ -49,7 +50,7 @@ these programs, using all the typical GObject conventions.

    - Editawy + Editawy is an ActiveX Control wrapper that support all Scintilla functions and additional high level functions.

    @@ -75,7 +76,7 @@ is an encapsulation of Scintilla for use within the .NET framework.

    - QScintilla + QScintilla is a port of Scintilla to the Qt platform. It has a similar license to Qt: GPL for use in free software and commercial for use in close-source applications.

    @@ -127,7 +128,24 @@ Projects using Scintilla

    - SciTECO + Textilosaurus + is simple cross-platform UTF-8 text editor based on Qt and Scintilla. +

    +

    + BowPad + is a small and fast text editor with a modern ribbon user interface (Windows7 or later). +

    +

    + ZeroBrane Studio Lua IDE + is a lightweight Lua IDE with code completion, syntax highlighting, live + coding, remote debugger, and code analyzer (Windows, OSX, and Linux). +

    +

    + XML Validator Buddy + is an XML/JSON editor and XML validator for Windows. +

    +

    + SciTECO is an advanced TECO dialect and interactive screen editor based on Scintilla.

    @@ -153,7 +171,7 @@ is a cross-platform, visual database design, sql coding and administration tool.

    - LIVEditor + LIVEditor is for web front end coders editing html/css/js code.

    @@ -161,8 +179,8 @@ is a wxWidgets-based Perl IDE.

    - CoderStudio - is an IDE for Assembly programming similar to Visual Studio 6.0. + CoderStudio + is an IDE for plain C and Assembly programming similar to Visual Studio.

    Enterprise Architect @@ -170,14 +188,14 @@

    The CodeAssistor Editor - is a small and simple MacOSX source code editor. + is a small and simple source code editor for MacOSX, Windows, and GTK/Linux.

    PBEditor is a text editor for PowerBuilder.

    - CrypTool + CrypTool is an application for applying and analyzing cryptographic algorithms.

    @@ -190,34 +208,22 @@ is a simple programming language with a Visual Basic like syntax.

    - LispIDE + LispIDE is a basic Lisp editor for Windows 2000, XP and Vista.

    - FlexEdit - is Free Text/Hex Editor for Windows. -

    -

    - File Workbench: + File Workbench: a file manager / text editor environment with Squirrel scripting.

    Kephra is a free, easy and comfortable cross-platform editor written in Perl.

    -

    - TOP - is an interface to HP's NonStop servers which run a proprietary OS. -

    UniversalIndentGUI is a cross platform GUI for several code formatters, beautifiers and indenters like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on.

    -

    - TrackBack - watches and backs up every change made in your source code. -

    Elementary Reports is designed to reduce the time to compose detailed and professional primary school reports. @@ -233,12 +239,12 @@ class diagrams.

    - The ExtendScript Toolkit + The ExtendScript Toolkit is a development and debugging tool for JavaScript scripts included with Adobe CS3 Suites.

    - TortoiseSVN + TortoiseSVN is a Windows GUI client for the Subversion source control software.

    @@ -263,7 +269,7 @@ is a graphical user interface for changing SciTE properties files.

    - Scintilla Lister + Scintilla Lister is a plugin for Total Commander allowing viewing all documents with syntax highlighting inside Total Commander.

    @@ -279,7 +285,7 @@ Code::Blocks is an open source, cross platform free C++ IDE.

    - + Notepad++ is a free source code editor under Windows.

    @@ -291,7 +297,7 @@ LSW DotNet-Lab is a development environment for the .NET platform.

    - + GLIntercept is an OpenGL function call interceptor that uses SciTE as a run-time shader editor.

    @@ -308,7 +314,7 @@ PyCrash Viewer can examine crash dumps of Python programs.

    - + MPT series Wire Analyzers use Scintilla and SciTE.

    @@ -330,18 +336,14 @@ is a user-friendly source code editor easily extended using Python.

    - + Venis IX, the Visual Environment for NSIS (Nullsoft Scriptable Install System).

    - Eric3 + Eric3 is a Python IDE written using PyQt and QScintilla.

    -

    - SciTE|Flash - is a free Scintilla-based ActionScript editor for Windows. -

    CPPIDE is part of some commercial high-school oriented programming course software. @@ -358,26 +360,18 @@ wxBasic is an open source Basic interpreter that uses the wxWidgets toolkit. A small IDE is under construction.

    -

    - FreeRIDE will be a - cross-platform IDE for the Ruby programming language. -

    Visual MinGW is an IDE for the MinGW compiler system.This runs on Windows with gcc.

    - The Wing IDE is a + The Wing IDE is a complete integrated development environment for the Python programming language. Available on Intel based Linux and Windows and on MacOS X through XDarwin.

    - LuaIDE - is an IDE for Lua on Windows. -

    -

    - Sphere + Sphere is 2D RPG engine with a development environment.

    @@ -398,20 +392,10 @@ is a Python debugger that can run on one Windows machine debugging a Python program running on either the same or another machine.

    -

    - pyeditor and wxEditor - are scriptable editors implemented in Python. pyeditor is based on GTK+ and - the pyscintilla wrapper. wxEditor is based on wxWidgets, wxPython and - wxStyledTextControl. -

    PyCrust is an interactive Python shell based on wxPython.

    -

    - Black Adder is a - Qt based development environment for Python and Ruby. -

    Komodo is a cross-platform multi-language development environment built @@ -424,16 +408,16 @@ will be of interest to others wanting to control SciTE.

    - Anjuta + Anjuta is an open source C/C++ IDE for Linux/GNOME.

    - A version of SciTE for Win32 enhanced + A version of SciTE for Win32 enhanced with a tab control to allow easy movement between buffers. Go to the "Goodies" area on this site.

    - + Suneido is an integrated application platform currently available for Win32 that includes an object-oriented language, client-server database, and user interface and reporting frameworks.

    @@ -448,18 +432,22 @@ wxStyledTextCtrl used as its editor.

    - PythonWin, a Win32 IDE for Python, uses + PythonWin, a Win32 IDE for Python, uses Scintilla for both its editing and interactive windows.

    Editing Components

    +

    + CodeMirror + is a versatile text editor implemented in JavaScript for the browser. +

    UniCodeEditor is a Unicode aware syntax editor control for Delphi and C++ Builder.

    - GtkSourceView + GtkSourceView is a text widget that extends the standard GTK+ 2.x text widget and improves it by implementing syntax highlighting and other features typical of a source editor.

    @@ -468,7 +456,7 @@ is a free source code editing component implemented in Ruby.

    - SyntaxEditor + SyntaxEditor is a commercial native .Net source code editing component.

    @@ -478,7 +466,7 @@

    GTK+, the GIMP Toolkit, contains a rich text editing widget.
    - Gedit is an editor for GTK+/GNOME.
    + Gedit is an editor for GTK+/GNOME.
    + + + + + + + + +
    + Scintilla icon + + Scintilla +
    +

    + Language Types +

    +

    + Scintilla contains lexers for various types of languages: +

      +
    • Programming languages like C++, Java, and Python.
    • +
    • Assembler languages are low-level programming languages which may additionally include instructions and registers.
    • +
    • Markup languages like HTML, TeX, and Markdown.
    • +
    • Data languages like EDIFACT and YAML.
    • +
    +

    +

    + Some languages can be used in different ways. JavaScript is a programming language but also + the basis of JSON data files. Similarly, + Lisp s expressions can be used for both source code and data. +

    +

    + Each language type has common elements such as identifiers in programming languages. + These common elements should be identified so that languages can be displayed with common + styles for these elements. + Style tags are used for this purpose in Scintilla. +

    +

    + Style Tags +

    +

    + Every style has a list of tags where a tag is a lower-case word containing only the common ASCII letters 'a'-'z' + such as "comment" or "operator". +

    +

    + Tags are ordered from most important to least important. +

    +

    + While applications may assign visual attributes for tag lists in many different ways, one reasonable technique is to + apply tag-specific attributes in reverse order so that earlier and more important tags override less important tags. + For example, the tag list "error comment documentation keyword" with + a set of tag attributes
    + { comment=fore:green,back:very-light-green,font:Serif documentation=fore:light-green error=strikethrough keyword=bold }
    + could be rendered as
    + bold,fore:light-green,back:very-light-green,font:Serif,strikethrough. +

    +

    + Alternative renderings could check for multi-tag combinations like + { comment.documentation=fore:light-green comment.line=dark-green comment=green }. +

    +

    + Commonly, a tag list will contain an optional embedded language; optional statuses; a base type; and a set of type modifiers:
    + embedded-language? status* base-type modifiers* +

    +

    Embedded language

    +

    + The embedded language may be a source (client | server) followed by a language name + (javascript | php | python | basic). + This may be extended in the future with other programming languages and style-definition languages like CSS. +

    +

    Status

    +

    + The statuses may be (error | unused | predefined | inactive).
    + The error status is used for lexical statuses that indicate errors in the source code such as unterminated quoted strings.
    + The unused status may indicate a gap in the lexical states, possibly because an old lexical class is no longer used or an upcoming lexical class may fill that position.
    + The predefined status indicates a style in the range 32.39 that is used for non-lexical purposes in Scintilla.
    + The inactive status is used for text that is not currently interpreted such as C++ code that is contained within a '#if 0' preprocessor block. +

    +

    Basic Types

    +

    + The basic types for programming languages are (default | operator | keyword | identifier | literal | comment | preprocessor | label).
    + The default type is commonly used for spaces and tabs between tokens although it may cover other characters in some languages. +

    +

    + Assembler languages add (instruction | register). to the basic types from programming languages.
    +

    +

    + The basic types for markup languages are (default | tag | attribute | comment | preprocessor).
    +

    +

    + The basic types for data languages are (default | key | data | comment).
    +

    +

    Comments

    +

    + Programming languages may differentiate between line and stream comments and treat documentation comments as distinct from other comments. + Documentation comments may be marked up with documentation keywords.
    + The additional attributes commonly used are (line | documentation | keyword | taskmarker). +

    +

    Literals

    +

    + Programming and assembler languages contain a rich set of literals including numbers like 7 and 3.89e23; "string\n"; and nullptr + and differentiating between these is often wanted.
    + The common literal types are (numeric | boolean | string | regex | date | time | uuid | nil | compound).
    + Numeric literal types are subdivided into (integer | real).
    + String literal types may add (perhaps multiple) further attributes from (heredoc | character | escapesequence | interpolated | multiline | raw).
    +

    +

    + An escape sequence within an interpolated heredoc may thus be literal string heredoc escapesequence. +

    +

    + List of known tags +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    attributeMarkup attribute
    basicEmbedded Basic
    booleanTrue or false literal
    characterSingle character literal as opposed to a string literal
    clientScript executed on client
    commentThe standard comment type in a language: may be stream or line
    compoundLiteral containing multiple subliterals such as a tuple or complex number
    dataA value in a data file
    dateLiteral representing a data such as '19/November/1975'
    defaultStarting state commonly also used for white space
    documentationComment that can be extracted into documentation
    errorState indicating an invalid or erroneous element
    escapesequenceParts of a string that are not literal such as '\t' for tab in C
    heredocLengthy text literal marked by a word at both ends
    identifierName that identifies an object or class of object
    inactiveCode that is not currently interpreted
    instructionMnemonic in assembler languages like 'addc'
    integerNumeric literal with no fraction or exponent like '738'
    interpolatedString that can contain expressions
    javascriptEmbedded Javascript
    keyElement which allows finding associated data
    keywordReserved word with special meaning like 'while'
    labelDestination for jumps in programming and assembler languages
    lineDifferentiates between stream comments and line comments in languages that have both
    literalFixed value in source code
    multilineDifferentiates between single line and multiline elements, commonly strings
    nilLiteral for the null pointer such as nullptr in C++ or NULL in C
    numericLiteral number like '16'
    operatorPunctuation character such as '&' or '['
    phpEmbedded PHP
    predefinedStyle in the range 32.39 that is used for non-lexical purposes
    preprocessorElement that is recognized in an early stage of translation
    pythonEmbedded Python
    rawString type that avoids interpretation: may be used for regular expressions in languages without a specific regex type
    realNumeric literal which may have a fraction or exponent like '3.84e-15'
    regexRegular expression literal like '^[a-z]+'
    registerCPU register in assembler languages
    serverScript executed on server
    stringSequence of characters
    tagMarkup tag like '<br />'
    taskmarkerWord in comment that marks future work like 'FIXME'
    timeLiteral representing a time such as '9:34:31'
    unusedStyle that is not currently used
    uuidUniversally unique identifier often used in interface definition files which may look like '{098f2470-bae0-11cd-b579-08002b30bfeb}'
    +

    + Extension +

    +

    + Each element in this scheme may be extended in the future. This may be done by revising this document to provide a common approach to new features. + Individual lexers may also choose to expose unique language features through new tags. +

    +

    + Translation +

    +

    + Tags could be exposed directly in user interfaces or configuration languages. + However, an application may also translate these to match its naming schema. + Capitalization and punctuation could be different (like Here-Doc instead of heredoc), + terminology changed ("constant" instead of "literal"), + or human language changed from English to Chinese or Spanish. +

    +

    + Starting from a common set of tags makes these modifications tractable. +

    +

    + Open issues +

    +

    + The C++ lexer (for example) has inactive states and dynamically allocated substyles. + These should be exposed through the metadata mechanism but are not currently. +

    + + diff --git a/scintilla/doc/annotations.png b/scintilla/doc/annotations.png index 9d9b2470..23e5feb2 100644 Binary files a/scintilla/doc/annotations.png and b/scintilla/doc/annotations.png differ diff --git a/scintilla/doc/index.html b/scintilla/doc/index.html index 45a1e3c8..ec0858dc 100644 --- a/scintilla/doc/index.html +++ b/scintilla/doc/index.html @@ -9,7 +9,8 @@ - + +