Merge branch 'scintilla-update-335'

This commit is contained in:
Colomban Wendling 2013-09-18 15:23:06 +02:00
commit 798849b64c
57 changed files with 1082 additions and 703 deletions

2
NEWS
View File

@ -7,7 +7,7 @@ Geany 1.24 (unreleased)
* Fix custom GTK styles under KDE (#3607935).
Editor
* Update Scintilla to version 3.3.3.
* Update Scintilla to version 3.3.5.
Filetypes
* Extend list of recognized keywords for SQL

View File

@ -3,6 +3,13 @@
// Copyright 2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CONVERTER_H
#define CONVERTER_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
typedef GIConv ConverterHandle;
const ConverterHandle iconvhBad = (ConverterHandle)(-1);
// Since various versions of iconv can not agree on whether the src argument
@ -68,3 +75,9 @@ public:
}
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -3,9 +3,9 @@
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <math.h>
@ -46,6 +46,8 @@
#define IS_WIDGET_FOCUSSED(w) (GTK_WIDGET_HAS_FOCUS(w))
#endif
static const double kPi = 3.14159265358979323846;
// The Pango version guard for pango_units_from_double and pango_units_to_double
// is more complex than simply implementing these here.
@ -739,7 +741,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi
}
static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) {
double degrees = M_PI / 180.0;
double degrees = kPi / 180.0;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
cairo_new_sub_path(context);
@ -820,7 +822,7 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) {
PenColour(back);
cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5,
Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*M_PI);
Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*kPi);
cairo_fill_preserve(context);
PenColour(fore);
cairo_stroke(context);
@ -1051,8 +1053,10 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
}
}
if (positionsCalculated < 1 ) {
// Either Latin1 or DBCS conversion failed so treat as Latin1.
// Either 8-bit or DBCS conversion failed so treat as 8-bit.
SetConverter(PFont(font_)->characterSet);
const bool rtlCheck = PFont(font_)->characterSet == SC_CHARSET_HEBREW ||
PFont(font_)->characterSet == SC_CHARSET_ARABIC;
std::string utfForm = UTF8FromIconv(conv, s, len);
if (utfForm.empty()) {
utfForm = UTF8FromLatin1(s, len);
@ -1060,13 +1064,23 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
pango_layout_set_text(layout, utfForm.c_str(), utfForm.length());
int i = 0;
int clusterStart = 0;
// Each Latin1 input character may take 1 or 2 bytes in UTF-8
// Each 8-bit input character may take 1 or 2 bytes in UTF-8
// and groups of up to 3 may be represented as ligatures.
ClusterIterator iti(layout, utfForm.length());
while (!iti.finished) {
iti.Next();
int clusterEnd = iti.curIndex;
int ligatureLength = g_utf8_strlen(utfForm.c_str() + clusterStart, clusterEnd - clusterStart);
if (rtlCheck && ((clusterEnd <= clusterStart) || (ligatureLength == 0) || (ligatureLength > 3))) {
// Something has gone wrong: exit quickly but pretend all the characters are equally spaced:
int widthLayout = 0;
pango_layout_get_size(layout, &widthLayout, NULL);
XYPOSITION widthTotal = doubleFromPangoUnits(widthLayout);
for (int bytePos=0;bytePos<lenPositions; bytePos++) {
positions[bytePos] = widthTotal / lenPositions * (bytePos + 1);
}
return;
}
PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3);
for (int charInLig=0; charInLig<ligatureLength; charInLig++) {
positions[i++] = iti.position - (ligatureLength - 1 - charInLig) * iti.distance / ligatureLength;

View File

@ -3,14 +3,14 @@
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <new>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <time.h>
#include <assert.h>
#include <new>
#include <string>
#include <vector>
#include <map>
@ -1096,7 +1096,7 @@ PRectangle ScintillaGTK::GetClientRectangle() {
PRectangle rc = wMain.GetClientPosition();
if (verticalScrollBarVisible)
rc.right -= verticalScrollBarWidth;
if (horizontalScrollBarVisible && (wrapState == eWrapNone))
if (horizontalScrollBarVisible && !Wrapping())
rc.bottom -= horizontalScrollBarHeight;
// Move to origin
rc.right -= rc.left;
@ -1676,7 +1676,7 @@ void ScintillaGTK::Resize(int width, int height) {
// These allocations should never produce negative sizes as they would wrap around to huge
// unsigned numbers inside GTK+ causing warnings.
bool showSBHorizontal = horizontalScrollBarVisible && (wrapState == eWrapNone);
bool showSBHorizontal = horizontalScrollBarVisible && !Wrapping();
GtkAllocation alloc;
if (showSBHorizontal) {
@ -1845,7 +1845,7 @@ gint ScintillaGTK::MouseRelease(GtkWidget *widget, GdkEventButton *event) {
// If mouse released on scroll bar then the position is relative to the
// scrollbar, not the drawing window so just repeat the most recent point.
pt = sciThis->ptMouseLast;
sciThis->ButtonUp(pt, event->time, (event->state & 4) != 0);
sciThis->ButtonUp(pt, event->time, (event->state & GDK_CONTROL_MASK) != 0);
}
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
@ -1962,7 +1962,10 @@ gint ScintillaGTK::Motion(GtkWidget *widget, GdkEventMotion *event) {
//Platform::DebugPrintf("Move %x %x %d %c %d %d\n",
// sciThis,event->window,event->time,event->is_hint? 'h' :'.', x, y);
Point pt(x, y);
sciThis->ButtonMove(pt);
int modifiers = ((event->state & GDK_SHIFT_MASK) != 0 ? SCI_SHIFT : 0) |
((event->state & GDK_CONTROL_MASK) != 0 ? SCI_CTRL : 0) |
((event->state & modifierTranslated(sciThis->rectangularSelectionModifier)) != 0 ? SCI_ALT : 0);
sciThis->ButtonMoveWithModifiers(pt, modifiers);
} catch (...) {
sciThis->errorStatus = SC_STATUS_FAILURE;
}

View File

@ -122,6 +122,7 @@
#define SCLEX_VISUALPROLOG 107
#define SCLEX_LITERATEHASKELL 108
#define SCLEX_STTXT 109
#define SCLEX_KVIRC 110
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -1647,6 +1648,19 @@
#define SCE_STTXT_DATETIME 16
#define SCE_STTXT_VARS 17
#define SCE_STTXT_PRAGMAS 18
#define SCE_KVIRC_DEFAULT 0
#define SCE_KVIRC_COMMENT 1
#define SCE_KVIRC_COMMENTBLOCK 2
#define SCE_KVIRC_STRING 3
#define SCE_KVIRC_WORD 4
#define SCE_KVIRC_KEYWORD 5
#define SCE_KVIRC_FUNCTION_KEYWORD 6
#define SCE_KVIRC_FUNCTION 7
#define SCE_KVIRC_VARIABLE 8
#define SCE_KVIRC_NUMBER 9
#define SCE_KVIRC_OPERATOR 10
#define SCE_KVIRC_STRING_FUNCTION 11
#define SCE_KVIRC_STRING_VARIABLE 12
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -673,6 +673,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_PARAUPEXTEND 2416
#define SCI_POSITIONBEFORE 2417
#define SCI_POSITIONAFTER 2418
#define SCI_POSITIONRELATIVE 2670
#define SCI_COPYRANGE 2419
#define SCI_COPYTEXT 2420
#define SC_SEL_STREAM 0
@ -801,6 +802,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ADDUNDOACTION 2560
#define SCI_CHARPOSITIONFROMPOINT 2561
#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562
#define SCI_SETMOUSESELECTIONRECTANGULARSWITCH 2668
#define SCI_GETMOUSESELECTIONRECTANGULARSWITCH 2669
#define SCI_SETMULTIPLESELECTION 2563
#define SCI_GETMULTIPLESELECTION 2564
#define SCI_SETADDITIONALSELECTIONTYPING 2565
@ -877,6 +880,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_VCHOMEDISPLAYEXTEND 2653
#define SCI_GETCARETLINEVISIBLEALWAYS 2654
#define SCI_SETCARETLINEVISIBLEALWAYS 2655
#define SCI_SETREPRESENTATION 2665
#define SCI_GETREPRESENTATION 2666
#define SCI_CLEARREPRESENTATION 2667
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001

View File

@ -1756,6 +1756,10 @@ fun position PositionBefore=2417(position pos,)
# page into account. Maximum value returned is the last position in the document.
fun position PositionAfter=2418(position pos,)
# Given a valid document position, return a position that differs in a number
# of characters. Returned value is always between 0 and last position in document.
fun position PositionRelative=2670(position pos, int relative)
# Copy a range of text to the clipboard. Positions are clipped into the document.
fun void CopyRange=2419(position start, position end)
@ -2127,6 +2131,12 @@ fun position CharPositionFromPoint=2561(int x, int y)
# Return INVALID_POSITION if not close to text.
fun position CharPositionFromPointClose=2562(int x, int y)
# Set whether switching to rectangular mode while selecting with the mouse is allowed.
set void SetMouseSelectionRectangularSwitch=2668(bool mouseSelectionRectangularSwitch,)
# Whether switching to rectangular mode while selecting with the mouse is allowed.
get bool GetMouseSelectionRectangularSwitch=2669(,)
# Set whether multiple selections can be made
set void SetMultipleSelection=2563(bool multipleSelection,)
@ -2326,6 +2336,15 @@ get bool GetCaretLineVisibleAlways=2654(,)
# Sets the caret line to always visible.
set void SetCaretLineVisibleAlways=2655(bool alwaysVisible,)
# Set the way a character is drawn.
set void SetRepresentation=2665(string encodedCharacter, string representation)
# Set the way a character is drawn.
get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
# Remove a character representation.
fun void ClearRepresentation=2667(string encodedCharacter,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -2580,6 +2599,7 @@ val SCLEX_OSCRIPT=106
val SCLEX_VISUALPROLOG=107
val SCLEX_LITERATEHASKELL=108
val SCLEX_STTXT=109
val SCLEX_KVIRC=110
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -4305,6 +4325,21 @@ val SCE_STTXT_IDENTIFIER=15
val SCE_STTXT_DATETIME=16
val SCE_STTXT_VARS=17
val SCE_STTXT_PRAGMAS=18
# Lexical states for SCLEX_KVIRC
lex KVIrc=SCLEX_KVIRC SCLEX_KVIRC_
val SCE_KVIRC_DEFAULT=0
val SCE_KVIRC_COMMENT=1
val SCE_KVIRC_COMMENTBLOCK=2
val SCE_KVIRC_STRING=3
val SCE_KVIRC_WORD=4
val SCE_KVIRC_KEYWORD=5
val SCE_KVIRC_FUNCTION_KEYWORD=6
val SCE_KVIRC_FUNCTION=7
val SCE_KVIRC_VARIABLE=8
val SCE_KVIRC_NUMBER=9
val SCE_KVIRC_OPERATOR=10
val SCE_KVIRC_STRING_FUNCTION=11
val SCE_KVIRC_STRING_VARIABLE=12
# Events

View File

@ -511,5 +511,5 @@ static inline bool IsWordCharacter(int ch) {
}
static inline bool IsWordStartCharacter(int ch) {
return (isascii(ch) && isalpha(ch)) || ch == '_';
return (IsASCII(ch) && isalpha(ch)) || ch == '_';
}

View File

@ -344,7 +344,7 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle,
if (sc.state == SCE_ASM_DEFAULT) {
if (sc.ch == ';'){
sc.SetState(SCE_ASM_COMMENT);
} else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) {
} else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) {
sc.SetState(SCE_ASM_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_ASM_IDENTIFIER);

View File

@ -44,13 +44,13 @@ inline bool isCOBOLoperator(char ch)
inline bool isCOBOLwordchar(char ch)
{
return isascii(ch) && (isalnum(ch) || ch == '-');
return IsASCII(ch) && (isalnum(ch) || ch == '-');
}
inline bool isCOBOLwordstart(char ch)
{
return isascii(ch) && isalnum(ch);
return IsASCII(ch) && isalnum(ch);
}
static int CountBits(int nBits)
@ -90,6 +90,8 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k
WordList& c_keywords = *keywordlists[2];
char s[100];
s[0] = '\0';
s[1] = '\0';
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
@ -205,7 +207,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
}
if (state == SCE_C_DEFAULT) {
if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) {
if (isCOBOLwordstart(ch) || (ch == '$' && IsASCII(chNext) && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
} else if (column == 6 && ch == '*') {

View File

@ -41,15 +41,15 @@ using namespace Scintilla;
// Underscore, letter, digit and universal alphas from C99 Appendix D.
static bool IsWordStart(int ch) {
return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch);
return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsWord(int ch) {
return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch);
return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsDoxygen(int ch) {
if (isascii(ch) && islower(ch))
if (IsASCII(ch) && islower(ch))
return true;
if (ch == '$' || ch == '@' || ch == '\\' ||
ch == '&' || ch == '#' || ch == '<' || ch == '>' ||
@ -267,7 +267,7 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID
break;
case SCE_D_NUMBER:
// We accept almost anything because of hex. and number suffixes
if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) {
if (IsASCII(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) {
continue;
} else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) {
// Don't parse 0..2 as number.

View File

@ -123,29 +123,29 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle,
(sc.atLineStart || IsASpaceChar(sc.chPrev)) &&
(sc.atLineEnd || IsASpaceChar(sc.chNext))) {
sc.SetState(SCE_FORTH_COMMENT_ML);
} else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) {
} else if ( (sc.ch == '$' && (IsASCII(sc.chNext) && isxdigit(sc.chNext))) ) {
// number starting with $ is a hex number
sc.SetState(SCE_FORTH_NUMBER);
while(sc.More() && isascii(sc.chNext) && isxdigit(sc.chNext))
while(sc.More() && IsASCII(sc.chNext) && isxdigit(sc.chNext))
sc.Forward();
} else if ( (sc.ch == '%' && (isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) {
} else if ( (sc.ch == '%' && (IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) {
// number starting with % is binary
sc.SetState(SCE_FORTH_NUMBER);
while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))
while(sc.More() && IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))
sc.Forward();
} else if ( isascii(sc.ch) &&
(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) )
} else if ( IsASCII(sc.ch) &&
(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && IsASCII(sc.chNext) && isxdigit(sc.chNext)) )
){
sc.SetState(SCE_FORTH_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_FORTH_IDENTIFIER);
} else if (sc.ch == '{') {
sc.SetState(SCE_FORTH_LOCALE);
} else if (sc.ch == ':' && isascii(sc.chNext) && isspace(sc.chNext)) {
} else if (sc.ch == ':' && IsASCII(sc.chNext) && isspace(sc.chNext)) {
// highlight word definitions e.g. : GCD ( n n -- n ) ..... ;
// ^ ^^^
sc.SetState(SCE_FORTH_DEFWORD);
while(sc.More() && isascii(sc.chNext) && isspace(sc.chNext))
while(sc.More() && IsASCII(sc.chNext) && isspace(sc.chNext))
sc.Forward();
} else if (sc.ch == ';' &&
(sc.atLineStart || IsASpaceChar(sc.chPrev)) &&

View File

@ -43,7 +43,7 @@ static inline bool IsAWordStart(const int ch) {
}
inline bool IsOperator(int ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
@ -446,12 +446,12 @@ static int StateForScript(script_type scriptLanguage) {
}
static inline bool issgmlwordchar(int ch) {
return !isascii(ch) ||
return !IsASCII(ch) ||
(isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[');
}
static inline bool IsPhpWordStart(int ch) {
return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
return (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
}
static inline bool IsPhpWordChar(int ch) {
@ -1233,7 +1233,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 2, StateToPrint);
}
state = SCE_H_SGML_COMMENT;
} else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
} else if (IsASCII(ch) && isalpha(ch) && (chPrev == '%')) {
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_ENTITY;
} else if (ch == '#') {
@ -1312,6 +1312,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_COMMENT;
}
break;
case SCE_H_SGML_DOUBLESTRING:
if (ch == '\"') {
styler.ColourTo(i, StateToPrint);
@ -1351,7 +1352,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_SGML_SPECIAL:
if (!(isascii(ch) && isupper(ch))) {
if (!(IsASCII(ch) && isupper(ch))) {
styler.ColourTo(i - 1, StateToPrint);
if (isalnum(ch)) {
state = SCE_H_SGML_ERROR;
@ -1364,7 +1365,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (ch == ';') {
styler.ColourTo(i, StateToPrint);
state = SCE_H_SGML_DEFAULT;
} else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
} else if (!(IsASCII(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
styler.ColourTo(i, SCE_H_SGML_ERROR);
state = SCE_H_SGML_DEFAULT;
}
@ -1374,9 +1375,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
}
if (ch != '#' && !(isascii(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway...
if (ch != '#' && !(IsASCII(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway...
&& ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML
if (!isascii(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style
if (!IsASCII(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style
styler.ColourTo(i-1, SCE_H_TAGUNKNOWN);
else
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
@ -1702,7 +1703,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HJ_REGEX:
if (ch == '\r' || ch == '\n' || ch == '/') {
if (ch == '/') {
while (isascii(chNext) && islower(chNext)) { // gobble regex flags
while (IsASCII(chNext) && islower(chNext)) { // gobble regex flags
i++;
ch = chNext;
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));

View File

@ -99,7 +99,7 @@ static bool latexIsBlankAndNL(int ch) {
}
static bool latexIsLetter(int ch) {
return isascii(ch) && isalpha(ch);
return IsASCII(ch) && isalpha(ch);
}
static bool latexIsTagValid(int &i, int l, Accessor &styler) {
@ -224,7 +224,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
styler.ColourTo(i + 1, SCE_L_SHORTCMD);
if (chNext == '(') {
mode = 1;
@ -340,7 +340,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
if (chNext == ')') {
mode = 0;
state = SCE_L_DEFAULT;
@ -382,7 +382,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
if (chNext == ']') {
mode = 0;
state = SCE_L_DEFAULT;

View File

@ -33,7 +33,7 @@ using namespace Scintilla;
#define SCE_LISP_MACRO_DISPATCH 31
static inline bool isLispoperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}')
return true;
@ -41,7 +41,7 @@ static inline bool isLispoperator(char ch) {
}
static inline bool isLispwordstart(char ch) {
return isascii(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
return IsASCII(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
ch != '\n' && ch != '\r' && ch != '\"';
}
@ -142,7 +142,7 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
}
}
} else if (state == SCE_LISP_MACRO_DISPATCH) {
if (!(isascii(ch) && isdigit(ch))) {
if (!(IsASCII(ch) && isdigit(ch))) {
if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) {
state = SCE_LISP_DEFAULT;
} else {

View File

@ -180,6 +180,8 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
bUserVars = true;
char s[100];
s[0] = '\0';
s[1] = '\0';
WordList &Functions = *keywordLists[0];
WordList &Variables = *keywordLists[1];

View File

@ -40,7 +40,7 @@ static bool Is1To9(char ch) {
}
static bool IsAlphabetic(int ch) {
return isascii(ch) && isalpha(ch);
return IsASCII(ch) && isalpha(ch);
}
static inline bool AtEOL(Accessor &styler, unsigned int i) {

View File

@ -1626,7 +1626,7 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
else if (styler.Match(i, "=head"))
podHeading = PodHeadingLevel(i, styler);
} else if (style == SCE_PL_DATASECTION) {
if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
if (ch == '=' && IsASCII(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1;

View File

@ -385,7 +385,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
base_n_number = false;
sc.SetState(SCE_P_NUMBER);
}
} else if ((isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
} else if ((IsASCII(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
sc.SetState(SCE_P_OPERATOR);
} else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);

View File

@ -37,7 +37,7 @@ static inline bool IsAWordStart(const int ch) {
}
static inline bool IsAnOperator(const int ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '-' || ch == '+' || ch == '!' || ch == '~' ||

View File

@ -150,7 +150,7 @@ static void ColouriseYAMLLine(
} else {
unsigned int i2 = i;
while ((i < lengthLine) && lineBuffer[i]) {
if (!(isascii(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
return;
}

View File

@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -8,8 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include "CharacterSet.h"

View File

@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>

View File

@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -5,8 +5,8 @@
// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef LexerNoExceptions_H
#define LexerNoExceptions_H
#ifndef LEXERNOEXCEPTIONS_H
#define LEXERNOEXCEPTIONS_H
#ifdef SCI_NAMESPACE
namespace Scintilla {

View File

@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>

View File

@ -7,8 +7,8 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include "ILexer.h"

View File

@ -7,8 +7,8 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <algorithm>
@ -103,7 +103,7 @@ void WordList::Clear() {
#ifdef _MSC_VER
static bool cmpWords(const char *a, const char *b) {
return strcmp(a, b) == -1;
return strcmp(a, b) < 0;
}
#else

View File

@ -31,9 +31,9 @@ diff --git b/scintilla/src/Catalogue.cxx a/scintilla/src/Catalogue.cxx
index 84d003e..37b2a3c 100644
+++ scintilla/src/Catalogue.cxx
--- scintilla/src/Catalogue.cxx
@@ -81,110 +81,47 @@ int Scintilla_LinkLexers() {
@@ -81,111 +81,47 @@ int Scintilla_LinkLexers() {
//++Autogenerated -- run src/LexGen.py to regenerate
//++Autogenerated -- run scripts/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\)
- LINK_LEXER(lmA68k);
LINK_LEXER(lmAbaqus);
@ -80,6 +80,7 @@ index 84d003e..37b2a3c 100644
LINK_LEXER(lmHTML);
- LINK_LEXER(lmInno);
- LINK_LEXER(lmKix);
- LINK_LEXER(lmKVIrc);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
- LINK_LEXER(lmLiterateHaskell);

View File

@ -10,9 +10,9 @@
#include <stdio.h>
#include <assert.h>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include "Platform.h"

View File

@ -2,7 +2,7 @@
// Encoding: UTF-8
/** @file CaseConvert.cxx
** Case fold characters and convert them to upper or lower case.
** Tables automatically regenerated by scripts/GenerateCharacterCategory.py
** Tables automatically regenerated by scripts/GenerateCaseConvert.py
** Should only be rarely regenerated for new versions of Unicode.
**/
// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
@ -232,132 +232,132 @@ const char *complexCaseConversions =
// Original | Folded | Upper | Lower |
//++Autogenerated -- start of section automatically generated
//**2 \(\*\n\)
"µ|μ|Μ||"
"ß|ss|SS||"
"İ|i̇||i̇|"
"ı||I||"
"ʼn|ʼn|ʼN||"
"ſ|s|S||"
"Dž|dž|DŽ|dž|"
"Lj|lj|LJ|lj|"
"Nj|nj|NJ|nj|"
"ǰ|ǰ|J̌||"
"Dz|dz|DZ|dz|"
"ͅ|ι|Ι||"
"ΐ|ΐ|Ϊ́||"
"ΰ|ΰ|Ϋ́||"
"ς|σ||"
"ϐ|β|Β||"
"ϑ|θ|Θ||"
"ϕ|φ|Φ||"
"ϖ|π|Π||"
"ϰ|κ|Κ||"
"ϱ|ρ|Ρ||"
"ϴ|θ||θ|"
"ϵ|ε|Ε||"
"և|եւ|ԵՒ||"
"ẖ|ẖ|H̱||"
"ẗ|ẗ|T̈||"
"ẘ|ẘ|W̊||"
"ẙ|ẙ|Y̊||"
"ẚ|aʾ|Aʾ||"
"ẛ|ṡ|Ṡ||"
"ẞ|ss||ß|"
"ὐ|ὐ|Υ̓||"
"ὒ|ὒ|Υ̓̀||"
"ὔ|ὔ|Υ̓́||"
"ὖ|ὖ|Υ̓͂||"
"ᾀ|ἀι|ἈΙ||"
"ᾁ|ἁι|ἉΙ||"
"ᾂ|ἂι|ἊΙ||"
"ᾃ|ἃι|ἋΙ||"
"ᾄ|ἄι|ἌΙ||"
"ᾅ|ἅι|ἍΙ||"
"ᾆ|ἆι|ἎΙ||"
"ᾇ|ἇι|ἏΙ||"
"ᾈ|ἀι|ἈΙ|ᾀ|"
"ᾉ|ἁι|ἉΙ|ᾁ|"
"ᾊ|ἂι|ἊΙ|ᾂ|"
"ᾋ|ἃι|ἋΙ|ᾃ|"
"ᾌ|ἄι|ἌΙ|ᾄ|"
"ᾍ|ἅι|ἍΙ|ᾅ|"
"ᾎ|ἆι|ἎΙ|ᾆ|"
"ᾏ|ἇι|ἏΙ|ᾇ|"
"ᾐ|ἠι|ἨΙ||"
"ᾑ|ἡι|ἩΙ||"
"ᾒ|ἢι|ἪΙ||"
"ᾓ|ἣι|ἫΙ||"
"ᾔ|ἤι|ἬΙ||"
"ᾕ|ἥι|ἭΙ||"
"ᾖ|ἦι|ἮΙ||"
"ᾗ|ἧι|ἯΙ||"
"ᾘ|ἠι|ἨΙ|ᾐ|"
"ᾙ|ἡι|ἩΙ|ᾑ|"
"ᾚ|ἢι|ἪΙ|ᾒ|"
"ᾛ|ἣι|ἫΙ|ᾓ|"
"ᾜ|ἤι|ἬΙ|ᾔ|"
"ᾝ|ἥι|ἭΙ|ᾕ|"
"ᾞ|ἦι|ἮΙ|ᾖ|"
"ᾟ|ἧι|ἯΙ|ᾗ|"
"ᾠ|ὠι|ὨΙ||"
"ᾡ|ὡι|ὩΙ||"
"ᾢ|ὢι|ὪΙ||"
"ᾣ|ὣι|ὫΙ||"
"ᾤ|ὤι|ὬΙ||"
"ᾥ|ὥι|ὭΙ||"
"ᾦ|ὦι|ὮΙ||"
"ᾧ|ὧι|ὯΙ||"
"ᾨ|ὠι|ὨΙ|ᾠ|"
"ᾩ|ὡι|ὩΙ|ᾡ|"
"ᾪ|ὢι|ὪΙ|ᾢ|"
"ᾫ|ὣι|ὫΙ|ᾣ|"
"ᾬ|ὤι|ὬΙ|ᾤ|"
"ᾭ|ὥι|ὭΙ|ᾥ|"
"ᾮ|ὦι|ὮΙ|ᾦ|"
"ᾯ|ὧι|ὯΙ|ᾧ|"
"ᾲ|ὰι|ᾺΙ||"
"ᾳ|αι|ΑΙ||"
"ᾴ|άι|ΆΙ||"
"ᾶ|ᾶ|Α͂||"
"ᾷ|ᾶι|Α͂Ι||"
"ᾼ|αι|ΑΙ|ᾳ|"
"|ι|Ι||"
"ῂ|ὴι|ῊΙ||"
"ῃ|ηι|ΗΙ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cc\x88\xcc\x81||"
"\xcf\x82|\xcf\x83|\xce\xa3||"
"\xcf\x90|\xce\xb2|\xce\x92||"
"\xcf\x91|\xce\xb8|\xce\x98||"
"\xcf\x95|\xcf\x86|\xce\xa6||"
"\xcf\x96|\xcf\x80|\xce\xa0||"
"\xcf\xb0|\xce\xba|\xce\x9a||"
"\xcf\xb1|\xcf\x81|\xce\xa1||"
"\xcf\xb4|\xce\xb8||\xce\xb8|"
"\xcf\xb5|\xce\xb5|\xce\x95||"
"\xd6\x87|\xd5\xa5\xd6\x82|\xd4\xb5\xd5\x92||"
"\xe1\xba\x96|h\xcc\xb1|H\xcc\xb1||"
"\xe1\xba\x97|t\xcc\x88|T\xcc\x88||"
"\xe1\xba\x98|w\xcc\x8a|W\xcc\x8a||"
"\xe1\xba\x99|y\xcc\x8a|Y\xcc\x8a||"
"\xe1\xba\x9a|a\xca\xbe|A\xca\xbe||"
"\xe1\xba\x9b|\xe1\xb9\xa1|\xe1\xb9\xa0||"
"\xe1\xba\x9e|ss||\xc3\x9f|"
"\xe1\xbd\x90|\xcf\x85\xcc\x93|\xce\xa5\xcc\x93||"
"\xe1\xbd\x92|\xcf\x85\xcc\x93\xcc\x80|\xce\xa5\xcc\x93\xcc\x80||"
"\xe1\xbd\x94|\xcf\x85\xcc\x93\xcc\x81|\xce\xa5\xcc\x93\xcc\x81||"
"\xe1\xbd\x96|\xcf\x85\xcc\x93\xcd\x82|\xce\xa5\xcc\x93\xcd\x82||"
"\xe1\xbe\x80|\xe1\xbc\x80\xce\xb9|\xe1\xbc\x88\xce\x99||"
"\xe1\xbe\x81|\xe1\xbc\x81\xce\xb9|\xe1\xbc\x89\xce\x99||"
"\xe1\xbe\x82|\xe1\xbc\x82\xce\xb9|\xe1\xbc\x8a\xce\x99||"
"\xe1\xbe\x83|\xe1\xbc\x83\xce\xb9|\xe1\xbc\x8b\xce\x99||"
"\xe1\xbe\x84|\xe1\xbc\x84\xce\xb9|\xe1\xbc\x8c\xce\x99||"
"\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89\xce\x99||"
"\xe1\xbf\x86|\xce\xb7\xcd\x82|\xce\x97\xcd\x82||"
"\xe1\xbf\x87|\xce\xb7\xcd\x82\xce\xb9|\xce\x97\xcd\x82\xce\x99||"
"\xe1\xbf\x8c|\xce\xb7\xce\xb9|\xce\x97\xce\x99|\xe1\xbf\x83|"
"\xe1\xbf\x92|\xce\xb9\xcc\x88\xcc\x80|\xce\x99\xcc\x88\xcc\x80||"
"\xe1\xbf\x93|\xce\xb9\xcc\x88\xcc\x81|\xce\x99\xcc\x88\xcc\x81||"
"\xe1\xbf\x96|\xce\xb9\xcd\x82|\xce\x99\xcd\x82||"
"\xe1\xbf\x97|\xce\xb9\xcc\x88\xcd\x82|\xce\x99\xcc\x88\xcd\x82||"
"\xe1\xbf\xa2|\xcf\x85\xcc\x88\xcc\x80|\xce\xa5\xcc\x88\xcc\x80||"
"\xe1\xbf\xa3|\xcf\x85\xcc\x88\xcc\x81|\xce\xa5\xcc\x88\xcc\x81||"
"\xe1\xbf\xa4|\xcf\x81\xcc\x93|\xce\xa1\xcc\x93||"
"\xe1\xbf\xa6|\xcf\x85\xcd\x82|\xce\xa5\xcd\x82||"
"\xe1\xbf\xa7|\xcf\x85\xcc\x88\xcd\x82|\xce\xa5\xcc\x88\xcd\x82||"
"\xe1\xbf\xb2|\xe1\xbd\xbc\xce\xb9|\xe1\xbf\xba\xce\x99||"
"\xe1\xbf\xb3|\xcf\x89\xce\xb9|\xce\xa9\xce\x99||"
"\xe1\xbf\xb4|\xcf\x8e\xce\xb9|\xce\x8f\xce\x99||"
"\xe1\xbf\xb6|\xcf\x89\xcd\x82|\xce\xa9\xcd\x82||"
"\xe1\xbf\xb7|\xcf\x89\xcd\x82\xce\xb9|\xce\xa9\xcd\x82\xce\x99||"
"\xe1\xbf\xbc|\xcf\x89\xce\xb9|\xce\xa9\xce\x99|\xe1\xbf\xb3|"
"\xe2\x84\xa6|\xcf\x89||\xcf\x89|"
"\xe2\x84\xaa|k||k|"
"\xe2\x84\xab|\xc3\xa5||\xc3\xa5|"
"\xef\xac\x80|ff|FF||"
"\xef\xac\x81|fi|FI||"
"\xef\xac\x82|fl|FL||"
"\xef\xac\x83|ffi|FFI||"
"\xef\xac\x84|ffl|FFL||"
"\xef\xac\x85|st|ST||"
"\xef\xac\x86|st|ST||"
"\xef\xac\x93|\xd5\xb4\xd5\xb6|\xd5\x84\xd5\x86||"
"\xef\xac\x94|\xd5\xb4\xd5\xa5|\xd5\x84\xd4\xb5||"
"\xef\xac\x95|\xd5\xb4\xd5\xab|\xd5\x84\xd4\xbb||"
"\xef\xac\x96|\xd5\xbe\xd5\xb6|\xd5\x8e\xd5\x86||"
"\xef\xac\x97|\xd5\xb4\xd5\xad|\xd5\x84\xd4\xbd||"
//--Autogenerated -- end of section automatically generated
;
@ -382,7 +382,7 @@ class CaseConverter : public ICaseConverter {
};
typedef std::vector<CharacterConversion> CharacterToConversion;
CharacterToConversion characterToConversion;
// The parallel arrays
// The parallel arrays
std::vector<int> characters;
std::vector<ConversionString> conversions;

View File

@ -1,5 +1,5 @@
// Scintilla source code edit control
/** @file KeyWords.cxx
/** @file Catalogue.cxx
** Colourise for particular languages.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
@ -7,8 +7,8 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
@ -60,11 +60,6 @@ void Catalogue::AddLexerModule(LexerModule *plm) {
lexerCatalogue.push_back(plm);
}
// Alternative historical name for Scintilla_LinkLexers
int wxForceScintillaLexers(void) {
return Scintilla_LinkLexers();
}
// To add or remove a lexer, add or remove its file and run LexGen.py.
// Force a reference to all of the Scintilla lexers so that the linker will
@ -79,7 +74,7 @@ int Scintilla_LinkLexers() {
// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
#define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer);
//++Autogenerated -- run src/LexGen.py to regenerate
//++Autogenerated -- run scripts/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\)
LINK_LEXER(lmAbaqus);
LINK_LEXER(lmAda);

View File

@ -5,9 +5,9 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <algorithm>

View File

@ -4,9 +4,9 @@
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <algorithm>

View File

@ -38,7 +38,7 @@ using namespace Scintilla;
#endif
static inline bool IsPunctuation(char ch) {
return isascii(ch) && ispunct(ch);
return IsASCII(ch) && ispunct(ch);
}
void LexInterface::Colourise(int start, int end) {
@ -825,7 +825,7 @@ int Document::SafeSegment(const char *text, int length, int lengthSegment) const
return length;
int lastSpaceBreak = -1;
int lastPunctuationBreak = -1;
int lastEncodingAllowedBreak = -1;
int lastEncodingAllowedBreak = 0;
for (int j=0; j < lengthSegment;) {
unsigned char ch = static_cast<unsigned char>(text[j]);
if (j > 0) {
@ -854,6 +854,15 @@ int Document::SafeSegment(const char *text, int length, int lengthSegment) const
return lastEncodingAllowedBreak;
}
EncodingFamily Document::CodePageFamily() const {
if (SC_CP_UTF8 == dbcsCodePage)
return efUnicode;
else if (dbcsCodePage)
return efDBCS;
else
return efEightBit;
}
void Document::ModifiedAt(int pos) {
if (endStyled > pos)
endStyled = pos;
@ -1965,10 +1974,10 @@ int Document::WordPartLeft(int pos) {
--pos;
if (!isspacechar(cb.CharAt(pos)))
++pos;
} else if (!isascii(startChar)) {
while (pos > 0 && !isascii(cb.CharAt(pos)))
} else if (!IsASCII(startChar)) {
while (pos > 0 && !IsASCII(cb.CharAt(pos)))
--pos;
if (isascii(cb.CharAt(pos)))
if (IsASCII(cb.CharAt(pos)))
++pos;
} else {
++pos;
@ -1986,8 +1995,8 @@ int Document::WordPartRight(int pos) {
++pos;
startChar = cb.CharAt(pos);
}
if (!isascii(startChar)) {
while (pos < length && !isascii(cb.CharAt(pos)))
if (!IsASCII(startChar)) {
while (pos < length && !IsASCII(cb.CharAt(pos)))
++pos;
} else if (IsLowerCase(startChar)) {
while (pos < length && IsLowerCase(cb.CharAt(pos)))

View File

@ -19,6 +19,8 @@ namespace Scintilla {
typedef int Position;
const Position invalidPosition = -1;
enum EncodingFamily { efEightBit, efUnicode, efDBCS };
/**
* The range class represents a range of text in a document.
* The two values are not sorted as one end may be more significant than the other
@ -266,6 +268,7 @@ public:
int SCI_METHOD CodePage() const;
bool SCI_METHOD IsDBCSLeadByte(char ch) const;
int SafeSegment(const char *text, int length, int lengthSegment) const;
EncodingFamily CodePageFamily() const;
// Gateways to modifying document
void ModifiedAt(int pos);

File diff suppressed because it is too large Load Diff

View File

@ -160,6 +160,13 @@ struct WrapPending {
}
};
struct PrintParameters {
int magnification;
int colourMode;
WrapMode wrapState;
PrintParameters();
};
/**
*/
class Editor : public DocWatcher {
@ -182,11 +189,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
Point sizeRGBAImage;
float scaleRGBAImage;
int printMagnification;
int printColourMode;
int printWrapState;
PrintParameters printParameters;
int cursorMode;
int controlCharSymbol;
// Highlight current folding block
HighlightDelimiter highlightDelimiter;
@ -214,6 +219,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool endAtLastLine;
int caretSticky;
int marginOptions;
bool mouseSelectionRectangularSwitch;
bool multipleSelection;
bool additionalSelectionTyping;
int multiPasteMode;
@ -231,6 +237,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
LineLayoutCache llc;
PositionCache posCache;
SpecialRepresentations reprs;
KeyMap kmap;
@ -271,8 +278,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
int bracesMatchStyle;
int highlightGuideColumn;
int theEdge;
enum { notPainting, painting, paintAbandoned } paintState;
bool paintAbandonedByStyling;
PRectangle rcPaint;
@ -308,20 +313,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
int hsEnd;
// Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
int wrapWidth;
WrapPending wrapPending;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
bool convertPastes;
int marginNumberPadding; // the right-side padding of the number margin
int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
Document *pdoc;
Editor();
@ -332,6 +328,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateStyleData();
void InvalidateStyleRedraw();
void RefreshStyleData();
void SetRepresentations();
void DropGraphics(bool freeObjects);
void AllocateGraphics();
@ -424,6 +421,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void InvalidateCaret();
virtual void UpdateSystemCaret();
bool Wrapping() const;
void NeedWrapping(int docLineStart=0, int docLineEnd=WrapPending::lineLarge);
bool WrapOneLine(Surface *surface, int lineToWrap);
enum wrapScope {wsAll, wsVisible, wsIdle};
@ -523,7 +521,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void ContainerNeedsUpdate(int flags);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
enum { cmSame, cmUpper, cmLower } caseMap;
enum { cmSame, cmUpper, cmLower };
virtual std::string CaseMapString(const std::string &s, int caseMapping);
void ChangeCaseOfSelection(int caseMapping);
void LineTranspose();
@ -569,6 +567,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DwellEnd(bool mouseMoved);
void MouseLeave();
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
void ButtonMoveWithModifiers(Point pt, int modifiers);
void ButtonMove(Point pt);
void ButtonUp(Point pt, unsigned int curTime, bool ctrl);

View File

@ -6,8 +6,8 @@
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>

View File

@ -5,6 +5,13 @@
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef FONTQUALITY_H
#define FONTQUALITY_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
#define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1
@ -13,3 +20,9 @@
#define SCWIN_TECH_GDI 0
#define SCWIN_TECH_DIRECTWRITE 1
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -5,8 +5,8 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef KEYTOCOMMAND_H
#define KEYTOCOMMAND_H
#ifndef KEYMAP_H
#define KEYMAP_H
#ifdef SCI_NAMESPACE
namespace Scintilla {

View File

@ -12,7 +12,6 @@
namespace Scintilla {
#endif
/**
*/
class LineMarker {

View File

@ -8,6 +8,10 @@
#ifndef PARTITIONING_H
#define PARTITIONING_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/// A split vector of integers with a method for adding a value to all elements
/// in a range.
/// Used by the Partitioning class.
@ -186,4 +190,9 @@ public:
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -13,6 +13,7 @@
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "Platform.h"
@ -34,6 +35,7 @@
#include "ILexer.h"
#include "CaseFolder.h"
#include "Document.h"
#include "UniConversion.h"
#include "Selection.h"
#include "PositionCache.h"
@ -336,35 +338,75 @@ void LineLayoutCache::Dispose(LineLayout *ll) {
}
}
void BreakFinder::Insert(int val) {
if (val >= nextBreak) {
for (std::vector<int>::iterator it = selAndEdge.begin(); it != selAndEdge.end(); ++it) {
if (val == *it) {
return;
}
if (val <*it) {
selAndEdge.insert(it, 1, val);
return;
}
}
// Not less than any so append
selAndEdge.push_back(val);
// Simply pack the (maximum 4) character bytes into an int
static inline int KeyFromString(const char *charBytes, size_t len) {
PLATFORM_ASSERT(len <= 4);
int k=0;
for (size_t i=0; i<len && charBytes[i]; i++) {
k = k * 0x100;
k += static_cast<unsigned char>(charBytes[i]);
}
return k;
}
SpecialRepresentations::SpecialRepresentations() {
std::fill(startByteHasReprs, startByteHasReprs+0x100, 0);
}
void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) {
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes));
if (it == mapReprs.end()) {
// New entry so increment for first byte
startByteHasReprs[static_cast<unsigned char>(charBytes[0])]++;
}
mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = value;
}
void SpecialRepresentations::ClearRepresentation(const char *charBytes) {
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes));
if (it != mapReprs.end()) {
mapReprs.erase(it);
startByteHasReprs[static_cast<unsigned char>(charBytes[0])]--;
}
}
extern bool BadUTF(const char *s, int len, int &trailBytes);
static int NextBadU(const char *s, int p, int len, int &trailBytes) {
while (p < len) {
p++;
if (BadUTF(s + p, len - p, trailBytes))
return p;
Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) {
PLATFORM_ASSERT(len <= 4);
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
return 0;
MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, len));
if (it != mapReprs.end()) {
return &(it->second);
}
return 0;
}
bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const {
PLATFORM_ASSERT(len <= 4);
if (!startByteHasReprs[static_cast<unsigned char>(charBytes[0])])
return false;
MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len));
return it != mapReprs.end();
}
void SpecialRepresentations::Clear() {
mapReprs.clear();
std::fill(startByteHasReprs, startByteHasReprs+0x100, 0);
}
void BreakFinder::Insert(int val) {
if (val > nextBreak) {
const std::vector<int>::iterator it = std::lower_bound(selAndEdge.begin(), selAndEdge.end(), val);
if (it == selAndEdge.end()) {
selAndEdge.push_back(val);
} else if (*it != val) {
selAndEdge.insert(it, 1, val);
}
}
return -1;
}
BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_) :
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_) :
ll(ll_),
lineStart(lineStart_),
lineEnd(lineEnd_),
@ -373,11 +415,14 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
saeCurrentPos(0),
saeNext(0),
subBreak(-1),
pdoc(pdoc_) {
pdoc(pdoc_),
encodingFamily(pdoc_->CodePageFamily()),
preprs(preprs_) {
// Search for first visible break
// First find the first visible character
nextBreak = ll->FindBefore(xStart, lineStart, lineEnd);
if (xStart > 0.0f)
nextBreak = ll->FindBefore(xStart, lineStart, lineEnd);
// Now back to a style break
while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) {
nextBreak--;
@ -391,76 +436,80 @@ BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posL
SelectionSegment portion = ll->psel->Range(r).Intersect(segmentLine);
if (!(portion.start == portion.end)) {
if (portion.start.IsValid())
Insert(portion.start.Position() - posLineStart - 1);
Insert(portion.start.Position() - posLineStart);
if (portion.end.IsValid())
Insert(portion.end.Position() - posLineStart - 1);
Insert(portion.end.Position() - posLineStart);
}
}
}
Insert(ll->edgeColumn - 1);
Insert(lineEnd - 1);
if (pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage)) {
int trailBytes=0;
for (int pos = -1;;) {
pos = NextBadU(ll->chars, pos, lineEnd, trailBytes);
if (pos < 0)
break;
Insert(pos-1);
Insert(pos);
}
}
Insert(ll->edgeColumn);
Insert(lineEnd);
saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1;
}
BreakFinder::~BreakFinder() {
}
int BreakFinder::First() const {
return nextBreak;
}
int BreakFinder::Next() {
TextSegment BreakFinder::Next() {
if (subBreak == -1) {
int prev = nextBreak;
while (nextBreak < lineEnd) {
if ((ll->styles[nextBreak] != ll->styles[nextBreak + 1]) ||
(nextBreak == saeNext) ||
IsControlCharacter(ll->chars[nextBreak]) || IsControlCharacter(ll->chars[nextBreak + 1])) {
if (nextBreak == saeNext) {
while (nextBreak < lineEnd) {
int charWidth = 1;
if (encodingFamily == efUnicode)
charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(ll->chars) + nextBreak, lineEnd - nextBreak);
else if (encodingFamily == efDBCS)
charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1;
Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth);
if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) ||
repr ||
(nextBreak == saeNext)) {
while ((nextBreak >= saeNext) && (saeNext < lineEnd)) {
saeCurrentPos++;
saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : -1;
saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineEnd;
}
nextBreak++;
if ((nextBreak - prev) < lengthStartSubdivision) {
return nextBreak;
if ((nextBreak > prev) || repr) {
// Have a segment to report
if (nextBreak == prev) {
nextBreak += charWidth;
} else {
repr = 0; // Optimize -> should remember repr
}
if ((nextBreak - prev) < lengthStartSubdivision) {
return TextSegment(prev, nextBreak - prev, repr);
} else {
break;
}
}
break;
}
nextBreak++;
nextBreak += charWidth;
}
if ((nextBreak - prev) < lengthStartSubdivision) {
return nextBreak;
return TextSegment(prev, nextBreak - prev);
}
subBreak = prev;
}
// Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision.
// For very long runs add extra breaks after spaces or if no spaces before low punctuation.
int startSegment = subBreak;
if ((nextBreak - subBreak) <= lengthEachSubdivision) {
subBreak = -1;
return nextBreak;
return TextSegment(startSegment, nextBreak - startSegment);
} else {
subBreak += pdoc->SafeSegment(ll->chars + subBreak, nextBreak-subBreak, lengthEachSubdivision);
if (subBreak >= nextBreak) {
subBreak = -1;
return nextBreak;
return TextSegment(startSegment, nextBreak - startSegment);
} else {
return subBreak;
return TextSegment(startSegment, subBreak - startSegment);
}
}
}
bool BreakFinder::More() const {
return (subBreak >= 0) || (nextBreak < lineEnd);
}
PositionCacheEntry::PositionCacheEntry() :
styleNumber(0), len(0), clock(0), positions(0) {
}

View File

@ -113,6 +113,39 @@ public:
void ResetClock();
};
class Representation {
public:
std::string stringRep;
Representation(const char *value="") : stringRep(value) {
}
};
typedef std::map<int, Representation> MapRepresentation;
class SpecialRepresentations {
MapRepresentation mapReprs;
short startByteHasReprs[0x100];
public:
SpecialRepresentations();
void SetRepresentation(const char *charBytes, const char *value);
void ClearRepresentation(const char *charBytes);
Representation *RepresentationFromCharacter(const char *charBytes, size_t len);
bool Contains(const char *charBytes, size_t len) const;
void Clear();
};
struct TextSegment {
int start;
int length;
Representation *representation;
TextSegment(int start_=0, int length_=0, Representation *representation_=0) :
start(start_), length(length_), representation(representation_) {
}
int end() const {
return start + length;
}
};
// Class to break a line of text into shorter runs at sensible places.
class BreakFinder {
LineLayout *ll;
@ -125,6 +158,8 @@ class BreakFinder {
int saeNext;
int subBreak;
Document *pdoc;
EncodingFamily encodingFamily;
SpecialRepresentations *preprs;
void Insert(int val);
// Private so BreakFinder objects can not be copied
BreakFinder(const BreakFinder &);
@ -135,10 +170,10 @@ public:
// Try to make each subdivided run lengthEachSubdivision or shorter.
enum { lengthEachSubdivision = 100 };
BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_,
int xStart, bool breakForSelection, Document *pdoc_);
int xStart, bool breakForSelection, Document *pdoc_, SpecialRepresentations *preprs_);
~BreakFinder();
int First() const;
int Next();
TextSegment Next();
bool More() const;
};
class PositionCache {

View File

@ -4,12 +4,13 @@
// Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdexcept>
#include <algorithm>
#include "Platform.h"

View File

@ -262,7 +262,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
ac.lb->SetAverageCharWidth(aveCharWidth);
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
ac.SetList(list);
ac.SetList(list ? list : "");
// Fiddle the position of the list so it is right next to the target and wide enough for all its strings
PRectangle rcList = ac.lb->GetDesiredRect();

View File

@ -9,6 +9,10 @@
#ifndef SPLITVECTOR_H
#define SPLITVECTOR_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
template <typename T>
class SplitVector {
protected:
@ -280,4 +284,8 @@ public:
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -9,6 +9,14 @@
#include "UniConversion.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
enum { SURROGATE_LEAD_FIRST = 0xD800 };
enum { SURROGATE_TRAIL_FIRST = 0xDC00 };
enum { SURROGATE_TRAIL_LAST = 0xDFFF };
@ -246,3 +254,12 @@ int UTF8Classify(const unsigned char *us, int len) {
return UTF8MaskInvalid | 1;
}
}
int UTF8DrawBytes(const unsigned char *us, int len) {
int utf8StatusNext = UTF8Classify(us, len);
return (utf8StatusNext & UTF8MaskInvalid) ? 1 : (utf8StatusNext & UTF8MaskWidth);
}
#ifdef SCI_NAMESPACE
}
#endif

View File

@ -5,6 +5,13 @@
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef UNICONVERSION_H
#define UNICONVERSION_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
const int UTF8MaxBytes = 4;
unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen);
@ -27,6 +34,10 @@ inline bool UTF8IsAscii(int ch) {
enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 };
int UTF8Classify(const unsigned char *us, int len);
// Similar to UTF8Classify but returns a length of 1 for invalid bytes
// instead of setting the invalid flag
int UTF8DrawBytes(const unsigned char *us, int len);
// Line separator is U+2028 \xe2\x80\xa8
// Paragraph separator is U+2029 \xe2\x80\xa9
const int UTF8SeparatorLength = 3;
@ -39,3 +50,9 @@ const int UTF8NELLength = 2;
inline bool UTF8IsNEL(const unsigned char *us) {
return (us[0] == 0xc2) && (us[1] == 0x85);
}
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -5,6 +5,13 @@
// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
// This file is in the public domain.
#ifndef UNICODEFROMUTF8_H
#define UNICODEFROMUTF8_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
inline int UnicodeFromUTF8(const unsigned char *us) {
if (us[0] < 0xC2) {
return us[0];
@ -17,3 +24,9 @@ inline int UnicodeFromUTF8(const unsigned char *us) {
}
return us[0];
}
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -104,33 +104,24 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
indicators[ind] = source.indicators[ind];
}
selforeset = source.selforeset;
selforeground = source.selforeground;
selColours = source.selColours;
selAdditionalForeground = source.selAdditionalForeground;
selbackset = source.selbackset;
selbackground = source.selbackground;
selAdditionalBackground = source.selAdditionalBackground;
selbackground2 = source.selbackground2;
selBackground2 = source.selBackground2;
selAlpha = source.selAlpha;
selAdditionalAlpha = source.selAdditionalAlpha;
selEOLFilled = source.selEOLFilled;
foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour = source.foldmarginColour;
foldmarginHighlightColourSet = source.foldmarginHighlightColourSet;
foldmarginHighlightColour = source.foldmarginHighlightColour;
hotspotForegroundSet = source.hotspotForegroundSet;
hotspotForeground = source.hotspotForeground;
hotspotBackgroundSet = source.hotspotBackgroundSet;
hotspotBackground = source.hotspotBackground;
hotspotColours = source.hotspotColours;
hotspotUnderline = source.hotspotUnderline;
hotspotSingleLine = source.hotspotSingleLine;
whitespaceForegroundSet = source.whitespaceForegroundSet;
whitespaceForeground = source.whitespaceForeground;
whitespaceBackgroundSet = source.whitespaceBackgroundSet;
whitespaceBackground = source.whitespaceBackground;
whitespaceColours = source.whitespaceColours;
controlCharSymbol = source.controlCharSymbol;
controlCharWidth = source.controlCharWidth;
selbar = source.selbar;
selbarlight = source.selbarlight;
caretcolour = source.caretcolour;
@ -169,6 +160,18 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
braceHighlightIndicator = source.braceHighlightIndicator;
braceBadLightIndicatorSet = source.braceBadLightIndicatorSet;
braceBadLightIndicator = source.braceBadLightIndicator;
theEdge = source.theEdge;
marginNumberPadding = source.marginNumberPadding;
ctrlCharPadding = source.ctrlCharPadding;
lastSegItalicsOffset = source.lastSegItalicsOffset;
wrapState = source.wrapState;
wrapVisualFlags = source.wrapVisualFlags;
wrapVisualFlagsLocation = source.wrapVisualFlagsLocation;
wrapVisualStartIndent = source.wrapVisualStartIndent;
wrapIndentMode = source.wrapIndentMode;
}
ViewStyle::~ViewStyle() {
@ -204,27 +207,24 @@ void ViewStyle::Init(size_t stylesSize_) {
maxDescent = 1;
aveCharWidth = 8;
spaceWidth = 8;
tabWidth = spaceWidth * 8;
selforeset = false;
selforeground = ColourDesired(0xff, 0, 0);
selColours.fore = ColourOptional(ColourDesired(0xff, 0, 0));
selColours.back = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0), true);
selAdditionalForeground = ColourDesired(0xff, 0, 0);
selbackset = true;
selbackground = ColourDesired(0xc0, 0xc0, 0xc0);
selAdditionalBackground = ColourDesired(0xd7, 0xd7, 0xd7);
selbackground2 = ColourDesired(0xb0, 0xb0, 0xb0);
selBackground2 = ColourDesired(0xb0, 0xb0, 0xb0);
selAlpha = SC_ALPHA_NOALPHA;
selAdditionalAlpha = SC_ALPHA_NOALPHA;
selEOLFilled = false;
foldmarginColourSet = false;
foldmarginColour = ColourDesired(0xff, 0, 0);
foldmarginHighlightColourSet = false;
foldmarginHighlightColour = ColourDesired(0xc0, 0xc0, 0xc0);
foldmarginColour = ColourOptional(ColourDesired(0xff, 0, 0));
foldmarginHighlightColour = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0));
whitespaceForegroundSet = false;
whitespaceForeground = ColourDesired(0, 0, 0);
whitespaceBackgroundSet = false;
whitespaceBackground = ColourDesired(0xff, 0xff, 0xff);
whitespaceColours.fore = ColourOptional();
whitespaceColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff));
controlCharSymbol = 0; /* Draw the control characters */
controlCharWidth = 0;
selbar = Platform::Chrome();
selbarlight = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore = ColourDesired(0, 0, 0);
@ -242,10 +242,8 @@ void ViewStyle::Init(size_t stylesSize_) {
someStylesProtected = false;
someStylesForceCase = false;
hotspotForegroundSet = false;
hotspotForeground = ColourDesired(0, 0, 0xff);
hotspotBackgroundSet = false;
hotspotBackground = ColourDesired(0xff, 0xff, 0xff);
hotspotColours.fore = ColourOptional(ColourDesired(0, 0, 0xff));
hotspotColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff));
hotspotUnderline = true;
hotspotSingleLine = true;
@ -284,9 +282,21 @@ void ViewStyle::Init(size_t stylesSize_) {
braceHighlightIndicator = 0;
braceBadLightIndicatorSet = false;
braceBadLightIndicator = 0;
theEdge = 0;
marginNumberPadding = 3;
ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
lastSegItalicsOffset = 2;
wrapState = eWrapNone;
wrapVisualFlags = 0;
wrapVisualFlagsLocation = 0;
wrapVisualStartIndent = 0;
wrapIndentMode = SC_WRAPINDENT_FIXED;
}
void ViewStyle::Refresh(Surface &surface) {
void ViewStyle::Refresh(Surface &surface, int tabInChars) {
for (FontMap::iterator it = fonts.begin(); it != fonts.end(); ++it) {
delete it->second;
}
@ -332,6 +342,12 @@ void ViewStyle::Refresh(Surface &surface) {
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
tabWidth = spaceWidth * tabInChars;
controlCharWidth = 0.0;
if (controlCharSymbol >= 32) {
controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, controlCharSymbol);
}
fixedColumnWidth = marginInside ? leftMarginWidth : 0;
maskInLine = 0xffffffff;
@ -350,6 +366,10 @@ void ViewStyle::ReleaseAllExtendedStyles() {
int ViewStyle::AllocateExtendedStyles(int numberStyles) {
int startRange = static_cast<int>(nextExtendedStyle);
nextExtendedStyle += numberStyles;
EnsureStyle(nextExtendedStyle);
for (size_t i=startRange; i<nextExtendedStyle; i++) {
styles[i].ClearTo(styles[STYLE_DEFAULT]);
}
return startRange;
}
@ -389,6 +409,10 @@ bool ViewStyle::ProtectionActive() const {
return someStylesProtected;
}
int ViewStyle::ExternalMarginWidth() const {
return marginInside ? 0 : fixedColumnWidth;
}
bool ViewStyle::ValidStyle(size_t styleIndex) const {
return styleIndex < styles.size();
}
@ -409,6 +433,55 @@ void ViewStyle::CalcLargestMarkerHeight() {
}
}
ColourDesired ViewStyle::WrapColour() const {
if (whitespaceColours.fore.isSet)
return whitespaceColours.fore;
else
return styles[STYLE_DEFAULT].fore;
}
bool ViewStyle::SetWrapState(int wrapState_) {
WrapMode wrapStateWanted;
switch (wrapState_) {
case SC_WRAP_WORD:
wrapStateWanted = eWrapWord;
break;
case SC_WRAP_CHAR:
wrapStateWanted = eWrapChar;
break;
default:
wrapStateWanted = eWrapNone;
break;
}
bool changed = wrapState != wrapStateWanted;
wrapState = wrapStateWanted;
return changed;
}
bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) {
bool changed = wrapVisualFlags != wrapVisualFlags_;
wrapVisualFlags = wrapVisualFlags_;
return changed;
}
bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) {
bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_;
wrapVisualFlagsLocation = wrapVisualFlagsLocation_;
return changed;
}
bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) {
bool changed = wrapVisualStartIndent != wrapVisualStartIndent_;
wrapVisualStartIndent = wrapVisualStartIndent_;
return changed;
}
bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) {
bool changed = wrapIndentMode != wrapIndentMode_;
wrapIndentMode = wrapIndentMode_;
return changed;
}
void ViewStyle::AllocStyles(size_t sizeNew) {
size_t i=styles.size();
styles.resize(sizeNew);

View File

@ -56,6 +56,22 @@ enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterInden
typedef std::map<FontSpecification, FontRealised *> FontMap;
enum WrapMode { eWrapNone, eWrapWord, eWrapChar };
class ColourOptional : public ColourDesired {
public:
bool isSet;
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
}
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(lParam), isSet(wParam != 0) {
}
};
struct ForeBackColours {
ColourOptional fore;
ColourOptional back;
};
/**
*/
class ViewStyle {
@ -73,30 +89,22 @@ public:
unsigned int maxDescent;
XYPOSITION aveCharWidth;
XYPOSITION spaceWidth;
bool selforeset;
ColourDesired selforeground;
XYPOSITION tabWidth;
ForeBackColours selColours;
ColourDesired selAdditionalForeground;
bool selbackset;
ColourDesired selbackground;
ColourDesired selAdditionalBackground;
ColourDesired selbackground2;
ColourDesired selBackground2;
int selAlpha;
int selAdditionalAlpha;
bool selEOLFilled;
bool whitespaceForegroundSet;
ColourDesired whitespaceForeground;
bool whitespaceBackgroundSet;
ColourDesired whitespaceBackground;
ForeBackColours whitespaceColours;
int controlCharSymbol;
XYPOSITION controlCharWidth;
ColourDesired selbar;
ColourDesired selbarlight;
bool foldmarginColourSet;
ColourDesired foldmarginColour;
bool foldmarginHighlightColourSet;
ColourDesired foldmarginHighlightColour;
bool hotspotForegroundSet;
ColourDesired hotspotForeground;
bool hotspotBackgroundSet;
ColourDesired hotspotBackground;
ColourOptional foldmarginColour;
ColourOptional foldmarginHighlightColour;
ForeBackColours hotspotColours;
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
@ -134,12 +142,23 @@ public:
int braceHighlightIndicator;
bool braceBadLightIndicatorSet;
int braceBadLightIndicator;
int theEdge;
int marginNumberPadding; // the right-side padding of the number margin
int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs
// Wrapping support
WrapMode wrapState;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
ViewStyle();
ViewStyle(const ViewStyle &source);
~ViewStyle();
void Init(size_t stylesSize_=64);
void Refresh(Surface &surface);
void Refresh(Surface &surface, int tabInChars);
void ReleaseAllExtendedStyles();
int AllocateExtendedStyles(int numberStyles);
void EnsureStyle(size_t index);
@ -147,8 +166,16 @@ public:
void ClearStyles();
void SetStyleFontName(int styleIndex, const char *name);
bool ProtectionActive() const;
int ExternalMarginWidth() const;
bool ValidStyle(size_t styleIndex) const;
void CalcLargestMarkerHeight();
ColourDesired WrapColour() const;
bool SetWrapState(int wrapState_);
bool SetWrapVisualFlags(int wrapVisualFlags_);
bool SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_);
bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
bool SetWrapIndentMode(int wrapIndentMode_);
private:
void AllocStyles(size_t sizeNew);
void CreateFont(const FontSpecification &fs);

View File

@ -5,8 +5,8 @@
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <map>

View File

@ -1 +1 @@
334
335