Skip to content

Commit

Permalink
Merge pull request mirror#5 from mirror/master
Browse files Browse the repository at this point in the history
Sync official latest rel-4-1-3
  • Loading branch information
halx99 committed Jan 14, 2019
2 parents 5a19128 + ce09cc3 commit e570625
Show file tree
Hide file tree
Showing 32 changed files with 195 additions and 84 deletions.
1 change: 0 additions & 1 deletion cocoa/ScintillaCocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <cstddef>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <ctime>

Expand Down
4 changes: 2 additions & 2 deletions cocoa/ScintillaFramework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.1.2</string>
<string>4.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4.1.2</string>
<string>4.1.3</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
7 changes: 7 additions & 0 deletions cocoa/ScintillaView.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ extern NSString *const SCIUpdateUINotification;
- (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.
*/
Expand Down
25 changes: 24 additions & 1 deletion cocoa/ScintillaView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ @interface ScintillaView()
}
}

@implementation SCIScrollView
- (void) tile {
[super tile];

#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;
Expand Down Expand Up @@ -1379,7 +1394,15 @@ - (instancetype) initWithFrame: (NSRect) frame {
// 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];
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];
Expand Down
7 changes: 7 additions & 0 deletions cppcheck.suppress
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ useInitializationList
// produces same result on empty collections
useStlAlgorithm

// cppcheck 1.86 seems to be misunderstanding flow control in the large switch statement
knownConditionTrueFalse:scintilla/src/Editor.cxx

// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor

Expand All @@ -26,6 +29,7 @@ passedByValue
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:scintilla/lexers/LexA68k.cxx
useInitializationList:scintilla/lexers/LexAsm.cxx
shadowVar:scintilla/lexers/LexAU3.cxx
useInitializationList:scintilla/lexers/LexBasic.cxx
uninitMemberVar:scintilla/lexers/LexBash.cxx
variableScope:scintilla/lexers/LexBash.cxx
Expand All @@ -46,7 +50,9 @@ variableScope:scintilla/lexers/LexNimrod.cxx
variableScope:scintilla/lexers/LexNsis.cxx
variableScope:scintilla/lexers/LexOpal.cxx
variableScope:scintilla/lexers/LexPB.cxx
shadowVar:scintilla/lexers/LexPowerPro.cxx
variableScope:scintilla/lexers/LexProgress.cxx
redundantAssignment:scintilla/lexers/LexRegistry.cxx
variableScope:scintilla/lexers/LexRuby.cxx
uninitMemberVar:scintilla/lexers/LexRuby.cxx
variableScope:scintilla/lexers/LexSpecman.cxx
Expand All @@ -55,6 +61,7 @@ invalidscanf:scintilla/lexers/LexTCMD.cxx
knownConditionTrueFalse:scintilla/lexers/LexTCMD.cxx
variableScope:scintilla/lexers/LexTeX.cxx
knownConditionTrueFalse:scintilla/lexers/LexVerilog.cxx
shadowVar:scintilla/lexers/LexVHDL.cxx
variableScope:scintilla/lexers/LexVHDL.cxx
unreadVariable:scintilla/lexers/LexVisualProlog.cxx

Expand Down
10 changes: 5 additions & 5 deletions doc/ScintillaDownload.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/scintilla412.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla413.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla412.tgz">
<a href="https://www.scintilla.org/scintilla413.tgz">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
Expand All @@ -42,16 +42,16 @@ <h2>
containing very few restrictions.
</p>
<h3>
Release 4.1.2
Release 4.1.3
</h3>
<h4>
Source Code
</h4>
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/scintilla412.zip">zip format</a> (1600K) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla412.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla413.zip">zip format</a> (1600K) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla413.tgz">tgz format</a> (1400K) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
Expand Down
28 changes: 28 additions & 0 deletions doc/ScintillaHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,29 @@ <h3>
Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scite414.zip">Release 4.1.4</a>
</h3>
<ul>
<li>
Released 10 January 2019.
</li>
<li>
Fix raw strings in nim.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1253/">Feature #1253</a>.
</li>
<li>
Fix fold behaviour with comments in nim.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1254/">Feature #1254</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/scite413.zip">Release 4.1.3</a>
</h3>
<ul>
<li>
Released 10 January 2019.
</li>
<li>
Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they
can be a significant performance cost.
Expand All @@ -566,6 +585,11 @@ <h3>
<li>
Updated case conversion and character categories to Unicode 11.
</li>
<li>
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.
</li>
<li>
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
Expand Down Expand Up @@ -599,6 +623,10 @@ <h3>
Notify with SC_UPDATE_SELECTION when user performs a multiple selection add.
</li>
<li>
On macOS 10.14 Cocoa, fix incorrect horizontal offset.
<a href="https://sourceforge.net/p/scintilla/bugs/2022/">Bug #2022</a>.
</li>
<li>
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.
<a href="https://sourceforge.net/p/scintilla/bugs/2061/">Bug #2061</a>.
Expand Down
9 changes: 4 additions & 5 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20181002" />
<meta name="Date.Modified" content="20190110" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
#versionlist {
Expand Down Expand Up @@ -56,8 +56,8 @@
GTK+, and OS X</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 4.1.2<br />
Site last modified October 2 2018</font>
<font color="#FFCC99" size="3"> Release version 4.1.3<br />
Site last modified January 10 2019</font>
</td>
<td width="20%">
&nbsp;
Expand All @@ -72,11 +72,10 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 4.1.3 is compatible with macOS 10.14, improves performance, and adds a new lexer for Nim which will replace the "nimrod" lexer.</li>
<li>Version 4.1.2 is a minor release.</li>
<li>Version 4.1.1 adds optional indexing of line starts in UTF-8 documents by UTF-32 code points and UTF-16 code units.</li>
<li>Version 4.1.0 adds experimental support for bidirectional text as used by Arabic and Hebrew on Win32 and Cocoa.</li>
<li>Version 4.0.5 adds experimental support for documents larger than 2 GigaBytes.</li>
<li>Version 4.0.4 adds a lexer for Maxima.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
Expand Down
1 change: 0 additions & 1 deletion gtk/ScintillaGTK.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <ctime>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion gtk/ScintillaGTKAccessible.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ AtkObject *ScintillaGTKAccessible::WidgetGetAccessibleImpl(GtkWidget *widget, At
if (parent_atk_type == 0) {
AtkObject *parent_obj = GTK_WIDGET_CLASS(widget_parent_class)->get_accessible(widget);
if (parent_obj) {
GType parent_atk_type = G_OBJECT_TYPE(parent_obj);
parent_atk_type = G_OBJECT_TYPE(parent_obj);

// Figure out whether accessibility is enabled by looking at the type of the accessible
// object which would be created for the parent type of ScintillaObject.
Expand Down
41 changes: 20 additions & 21 deletions lexers/LexErrorList.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,30 @@

using namespace Scintilla;

static bool strstart(const char *haystack, const char *needle) {
namespace {

bool strstart(const char *haystack, const char *needle) noexcept {
return strncmp(haystack, needle, strlen(needle)) == 0;
}

static bool Is0To9(char ch) {
constexpr bool Is0To9(char ch) noexcept {
return (ch >= '0') && (ch <= '9');
}

static bool Is1To9(char ch) {
constexpr bool Is1To9(char ch) noexcept {
return (ch >= '1') && (ch <= '9');
}

static bool IsAlphabetic(int ch) {
bool IsAlphabetic(int ch) {
return IsASCII(ch) && isalpha(ch);
}

static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}

static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) {
if (lineBuffer[0] == '>') {
// Command or return status
return SCE_ERR_CMD;
Expand Down Expand Up @@ -175,7 +177,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
canBeCtags = false;
}
} else if (state == stGccStart) { // <filename>:
state = Is0To9(ch) ? stGccDigit : stUnrecognized;
state = ((ch == '-') || Is0To9(ch)) ? stGccDigit : stUnrecognized;
} else if (state == stGccDigit) { // <filename>:<line>
if (ch == ':') {
state = stGccColumn; // :9.*: is GCC
Expand Down Expand Up @@ -206,14 +208,13 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi
} else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
// Possibly Delphi.. don't test against chNext as it's one of the strings below.
char word[512];
Sci_PositionU j, chPos;
unsigned numstep;
chPos = 0;
if (ch == ' ')
numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
else
numstep = 2; // otherwise add 2.
for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
Sci_PositionU chPos = 0;
for (Sci_PositionU j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
word[chPos++] = lineBuffer[j];
word[chPos] = 0;
if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
Expand Down Expand Up @@ -268,13 +269,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLi

#define CSI "\033["

namespace {

bool SequenceEnd(int ch) {
constexpr bool SequenceEnd(int ch) noexcept {
return (ch == 0) || ((ch >= '@') && (ch <= '~'));
}

int StyleFromSequence(const char *seq) {
int StyleFromSequence(const char *seq) noexcept {
int bold = 0;
int colour = 0;
while (!SequenceEnd(*seq)) {
Expand All @@ -301,17 +300,15 @@ int StyleFromSequence(const char *seq) {
return SCE_ERR_ES_BLACK + bold * 8 + colour;
}

}

static void ColouriseErrorListLine(
void ColouriseErrorListLine(
char *lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU endPos,
Accessor &styler,
bool valueSeparate,
bool escapeSequences) {
Sci_Position startValue = -1;
int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
const int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue);
if (escapeSequences && strstr(lineBuffer, CSI)) {
const Sci_Position startPos = endPos - lengthLine;
const char *linePortion = lineBuffer;
Expand Down Expand Up @@ -354,7 +351,7 @@ static void ColouriseErrorListLine(
}
}

static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
char lineBuffer[10000];
styler.StartAt(startPos);
styler.StartSegment(startPos);
Expand Down Expand Up @@ -386,8 +383,10 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i
}
}

static const char *const emptyWordListDesc[] = {
0
const char *const emptyWordListDesc[] = {
nullptr
};

}

LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);

0 comments on commit e570625

Please sign in to comment.