Merge branch 'scintilla-update-351-pre'

This commit is contained in:
Colomban Wendling 2014-09-26 00:31:03 +02:00
commit 96806bf639
22 changed files with 234 additions and 76 deletions

View File

@ -19,6 +19,7 @@ sqlplus=default
sqlplus_prompt=default sqlplus_prompt=default
sqlplus_comment=comment sqlplus_comment=comment
quotedidentifier=identifier_2 quotedidentifier=identifier_2
qoperator=operator
[keywords] [keywords]
# all items must be in one line # all items must be in one line

View File

@ -4,6 +4,7 @@
default=default default=default
comment=comment comment=comment
comment_line_bang=comment_line comment_line_bang=comment_line
block_comment=comment
number=number_1 number=number_1
string=string_1 string=string_1
operator=operator operator=operator

View File

@ -811,9 +811,9 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
#endif #endif
int ucs = stride * height; int ucs = stride * height;
std::vector<unsigned char> image(ucs); std::vector<unsigned char> image(ucs);
for (int y=0; y<height; y++) { for (int iy=0; iy<height; iy++) {
for (int x=0; x<width; x++) { for (int ix=0; ix<width; ix++) {
unsigned char *pixel = &image[0] + y*stride + x * 4; unsigned char *pixel = &image[0] + iy*stride + ix * 4;
unsigned char alpha = pixelsImage[3]; unsigned char alpha = pixelsImage[3];
pixel[2] = (*pixelsImage++) * alpha / 255; pixel[2] = (*pixelsImage++) * alpha / 255;
pixel[1] = (*pixelsImage++) * alpha / 255; pixel[1] = (*pixelsImage++) * alpha / 255;
@ -822,12 +822,12 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
} }
} }
cairo_surface_t *psurf = cairo_image_surface_create_for_data(&image[0], CAIRO_FORMAT_ARGB32, width, height, stride); cairo_surface_t *psurfImage = cairo_image_surface_create_for_data(&image[0], CAIRO_FORMAT_ARGB32, width, height, stride);
cairo_set_source_surface(context, psurf, rc.left, rc.top); cairo_set_source_surface(context, psurfImage, rc.left, rc.top);
cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top); cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
cairo_fill(context); cairo_fill(context);
cairo_surface_destroy(psurf); cairo_surface_destroy(psurfImage);
} }
void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) {
@ -1625,10 +1625,10 @@ void ListBoxX::Create(Window &, int, Point, int, bool, int) {
if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode")) if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode"))
g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL); g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL);
GtkWidget *wid = PWidget(list); // No code inside the G_OBJECT macro GtkWidget *widget = PWidget(list); // No code inside the G_OBJECT macro
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid); gtk_container_add(GTK_CONTAINER(PWidget(scroller)), widget);
gtk_widget_show(wid); gtk_widget_show(widget);
g_signal_connect(G_OBJECT(wid), "button_press_event", g_signal_connect(G_OBJECT(widget), "button_press_event",
G_CALLBACK(ButtonPress), this); G_CALLBACK(ButtonPress), this);
} }
@ -1658,6 +1658,14 @@ int ListBoxX::GetVisibleRows() const {
int ListBoxX::GetRowHeight() int ListBoxX::GetRowHeight()
{ {
#if GTK_CHECK_VERSION(3,0,0)
// This version sometimes reports erroneous results on GTK2, but the GTK2
// version is inaccurate for GTK 3.14.
GdkRectangle rect;
GtkTreePath *path = gtk_tree_path_new_first();
gtk_tree_view_get_background_area(GTK_TREE_VIEW(list), path, NULL, &rect);
return rect.height;
#else
int row_height=0; int row_height=0;
int vertical_separator=0; int vertical_separator=0;
int expander_size=0; int expander_size=0;
@ -1669,6 +1677,7 @@ int ListBoxX::GetRowHeight()
row_height += vertical_separator; row_height += vertical_separator;
row_height = Platform::Maximum(row_height, expander_size); row_height = Platform::Maximum(row_height, expander_size);
return row_height; return row_height;
#endif
} }
PRectangle ListBoxX::GetDesiredRect() { PRectangle ListBoxX::GetDesiredRect() {

View File

@ -55,6 +55,7 @@
#include "Document.h" #include "Document.h"
#include "CaseConvert.h" #include "CaseConvert.h"
#include "UniConversion.h" #include "UniConversion.h"
#include "UnicodeFromUTF8.h"
#include "Selection.h" #include "Selection.h"
#include "PositionCache.h" #include "PositionCache.h"
#include "EditModel.h" #include "EditModel.h"
@ -63,7 +64,6 @@
#include "Editor.h" #include "Editor.h"
#include "AutoComplete.h" #include "AutoComplete.h"
#include "ScintillaBase.h" #include "ScintillaBase.h"
#include "UnicodeFromUTF8.h"
#ifdef SCI_LEXER #ifdef SCI_LEXER
#include "ExternalLexer.h" #include "ExternalLexer.h"

View File

@ -128,6 +128,7 @@
#define SCLEX_AS 113 #define SCLEX_AS 113
#define SCLEX_DMIS 114 #define SCLEX_DMIS 114
#define SCLEX_REGISTRY 115 #define SCLEX_REGISTRY 115
#define SCLEX_BIBTEX 116
#define SCLEX_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0 #define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1 #define SCE_P_COMMENTLINE 1
@ -1004,6 +1005,7 @@
#define SCE_VHDL_STDPACKAGE 12 #define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13 #define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14 #define SCE_VHDL_USERWORD 14
#define SCE_VHDL_BLOCK_COMMENT 15
#define SCE_CAML_DEFAULT 0 #define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1 #define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2 #define SCE_CAML_TAGNAME 2
@ -1115,6 +1117,7 @@
#define SCE_SQL_USER3 21 #define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22 #define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23 #define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_SQL_QOPERATOR 24
#define SCE_ST_DEFAULT 0 #define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1 #define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2 #define SCE_ST_NUMBER 2
@ -1731,6 +1734,13 @@
#define SCE_REG_STRING_GUID 10 #define SCE_REG_STRING_GUID 10
#define SCE_REG_PARAMETER 11 #define SCE_REG_PARAMETER 11
#define SCE_REG_OPERATOR 12 #define SCE_REG_OPERATOR 12
#define SCE_BIBTEX_DEFAULT 0
#define SCE_BIBTEX_ENTRY 1
#define SCE_BIBTEX_UNKNOWN_ENTRY 2
#define SCE_BIBTEX_KEY 3
#define SCE_BIBTEX_PARAMETER 4
#define SCE_BIBTEX_VALUE 5
#define SCE_BIBTEX_COMMENT 6
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif #endif

View File

@ -97,6 +97,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETNEXTTABSTOP 2677 #define SCI_GETNEXTTABSTOP 2677
#define SC_CP_UTF8 65001 #define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037 #define SCI_SETCODEPAGE 2037
#define SC_IME_WINDOWED 0
#define SC_IME_INLINE 1
#define SCI_GETIMEINTERACTION 2678
#define SCI_SETIMEINTERACTION 2679
#define MARKER_MAX 31 #define MARKER_MAX 31
#define SC_MARK_CIRCLE 0 #define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1 #define SC_MARK_ROUNDRECT 1
@ -888,6 +892,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SCROLLTOEND 2629 #define SCI_SCROLLTOEND 2629
#define SC_TECHNOLOGY_DEFAULT 0 #define SC_TECHNOLOGY_DEFAULT 0
#define SC_TECHNOLOGY_DIRECTWRITE 1 #define SC_TECHNOLOGY_DIRECTWRITE 1
#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define SCI_SETTECHNOLOGY 2630 #define SCI_SETTECHNOLOGY 2630
#define SCI_GETTECHNOLOGY 2631 #define SCI_GETTECHNOLOGY 2631
#define SCI_CREATELOADER 2632 #define SCI_CREATELOADER 2632

View File

@ -243,6 +243,16 @@ val SC_CP_UTF8=65001
# The SC_CP_UTF8 value can be used to enter Unicode mode. # The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,) set void SetCodePage=2037(int codePage,)
enu IMEInteraction=SC_IME_
val SC_IME_WINDOWED=0
val SC_IME_INLINE=1
# Is the IME displayed in a winow or inline?
get int GetIMEInteraction=2678(,)
# Choose to display the the IME in a winow or inline.
set void SetIMEInteraction=2679(int imeInteraction,)
enu MarkerSymbol=SC_MARK_ enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31 val MARKER_MAX=31
val SC_MARK_CIRCLE=0 val SC_MARK_CIRCLE=0
@ -2349,6 +2359,7 @@ fun void ScrollToEnd=2629(,)
val SC_TECHNOLOGY_DEFAULT=0 val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1 val SC_TECHNOLOGY_DIRECTWRITE=1
val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
# Set the technology used. # Set the technology used.
set void SetTechnology=2630(int technology,) set void SetTechnology=2630(int technology,)
@ -2700,6 +2711,7 @@ val SCLEX_DMAP=112
val SCLEX_AS=113 val SCLEX_AS=113
val SCLEX_DMIS=114 val SCLEX_DMIS=114
val SCLEX_REGISTRY=115 val SCLEX_REGISTRY=115
val SCLEX_BIBTEX=116
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1. # value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -3703,6 +3715,7 @@ val SCE_VHDL_STDFUNCTION=11
val SCE_VHDL_STDPACKAGE=12 val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13 val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14 val SCE_VHDL_USERWORD=14
val SCE_VHDL_BLOCK_COMMENT=15
# Lexical states for SCLEX_CAML # Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_ lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0 val SCE_CAML_DEFAULT=0
@ -3824,6 +3837,7 @@ val SCE_SQL_USER2=20
val SCE_SQL_USER3=21 val SCE_SQL_USER3=21
val SCE_SQL_USER4=22 val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23 val SCE_SQL_QUOTEDIDENTIFIER=23
val SCE_SQL_QOPERATOR=24
# Lexical states for SCLEX_SMALLTALK # Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0 val SCE_ST_DEFAULT=0
@ -4512,6 +4526,15 @@ val SCE_REG_KEYPATH_GUID=9
val SCE_REG_STRING_GUID=10 val SCE_REG_STRING_GUID=10
val SCE_REG_PARAMETER=11 val SCE_REG_PARAMETER=11
val SCE_REG_OPERATOR=12 val SCE_REG_OPERATOR=12
# Lexical state for SCLEX_BIBTEX
lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_
val SCE_BIBTEX_DEFAULT=0
val SCE_BIBTEX_ENTRY=1
val SCE_BIBTEX_UNKNOWN_ENTRY=2
val SCE_BIBTEX_KEY=3
val SCE_BIBTEX_PARAMETER=4
val SCE_BIBTEX_VALUE=5
val SCE_BIBTEX_COMMENT=6
# Events # Events

View File

@ -444,6 +444,8 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT; int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
int offset = 0; int offset = 0;
char qOperator = 0x00;
for (; sc.More(); sc.Forward(), offset++) { for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate. // Determine if the current state should terminate.
switch (sc.state) { switch (sc.state) {
@ -556,11 +558,39 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
} }
} }
break; break;
case SCE_SQL_QOPERATOR:
if (qOperator == 0x00) {
qOperator = sc.ch;
} else {
char qComplement = 0x00;
if (qOperator == '<') {
qComplement = '>';
} else if (qOperator == '(') {
qComplement = ')';
} else if (qOperator == '{') {
qComplement = '}';
} else if (qOperator == '[') {
qComplement = ']';
} else {
qComplement = qOperator;
}
if (sc.Match(qComplement, '\'')) {
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
qOperator = 0x00;
}
}
break;
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_SQL_DEFAULT) { if (sc.state == SCE_SQL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (sc.Match('q', '\'') || sc.Match('Q', '\'')) {
sc.SetState(SCE_SQL_QOPERATOR);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_SQL_NUMBER); sc.SetState(SCE_SQL_NUMBER);
} else if (IsAWordStart(sc.ch)) { } else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_SQL_IDENTIFIER); sc.SetState(SCE_SQL_IDENTIFIER);

View File

@ -119,6 +119,11 @@ static void ColouriseVHDLDoc(
sc.ChangeState(SCE_VHDL_STRINGEOL); sc.ChangeState(SCE_VHDL_STRINGEOL);
sc.ForwardSetState(SCE_VHDL_DEFAULT); sc.ForwardSetState(SCE_VHDL_DEFAULT);
} }
} else if (sc.state == SCE_VHDL_BLOCK_COMMENT){
if(sc.ch == '*' && sc.chNext == '/'){
sc.Forward();
sc.ForwardSetState(SCE_VHDL_DEFAULT);
}
} }
// Determine if a new state should be entered. // Determine if a new state should be entered.
@ -132,6 +137,8 @@ static void ColouriseVHDLDoc(
sc.SetState(SCE_VHDL_COMMENTLINEBANG); sc.SetState(SCE_VHDL_COMMENTLINEBANG);
else else
sc.SetState(SCE_VHDL_COMMENT); sc.SetState(SCE_VHDL_COMMENT);
} else if (sc.Match('/', '*')){
sc.SetState(SCE_VHDL_BLOCK_COMMENT);
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_VHDL_STRING); sc.SetState(SCE_VHDL_STRING);
} else if (isoperator(static_cast<char>(sc.ch))) { } else if (isoperator(static_cast<char>(sc.ch))) {
@ -155,6 +162,39 @@ static bool IsCommentLine(int line, Accessor &styler) {
} }
return false; return false;
} }
static bool IsCommentBlockStart(int line, Accessor &styler)
{
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '/') && (chNext == '*'))
return true;
}
return false;
}
static bool IsCommentBlockEnd(int line, Accessor &styler)
{
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
char chNext = styler[i+1];
char style = styler.StyleAt(i);
if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '*') && (chNext == '/'))
return true;
}
return false;
}
static bool IsCommentStyle(char style)
{
return style == SCE_VHDL_BLOCK_COMMENT || style == SCE_VHDL_COMMENT || style == SCE_VHDL_COMMENTLINEBANG;
}
//============================================================================= //=============================================================================
// Folding the code // Folding the code
@ -207,14 +247,14 @@ static void FoldNoBoxVHDLDoc(
char chPrev = styler.SafeGetCharAt(j-1); char chPrev = styler.SafeGetCharAt(j-1);
int style = styler.StyleAt(j); int style = styler.StyleAt(j);
int stylePrev = styler.StyleAt(j-1); int stylePrev = styler.StyleAt(j-1);
if ((stylePrev != SCE_VHDL_COMMENT) && (stylePrev != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (stylePrev != SCE_VHDL_STRING))
{ {
if(IsAWordChar(chPrev) && !IsAWordChar(ch)) if(IsAWordChar(chPrev) && !IsAWordChar(ch))
{ {
end = j-1; end = j-1;
} }
} }
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0)) if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0))
{ {
@ -236,7 +276,7 @@ static void FoldNoBoxVHDLDoc(
{ {
char ch = styler.SafeGetCharAt(j); char ch = styler.SafeGetCharAt(j);
int style = styler.StyleAt(j); int style = styler.StyleAt(j);
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if((ch == ';') && (strcmp(prevWord, "end") == 0)) if((ch == ';') && (strcmp(prevWord, "end") == 0))
{ {
@ -268,7 +308,9 @@ static void FoldNoBoxVHDLDoc(
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) if (foldComment && atEOL)
{
if(IsCommentLine(lineCurrent, styler))
{ {
if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler)) if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler))
{ {
@ -279,6 +321,18 @@ static void FoldNoBoxVHDLDoc(
levelNext--; levelNext--;
} }
} }
else
{
if (IsCommentBlockStart(lineCurrent, styler) && !IsCommentBlockEnd(lineCurrent, styler))
{
levelNext++;
}
else if (IsCommentBlockEnd(lineCurrent, styler) && !IsCommentBlockStart(lineCurrent, styler))
{
levelNext--;
}
}
}
if ((style == SCE_VHDL_OPERATOR) && foldAtParenthese) if ((style == SCE_VHDL_OPERATOR) && foldAtParenthese)
{ {
@ -289,7 +343,7 @@ static void FoldNoBoxVHDLDoc(
} }
} }
if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING))
{ {
if((ch == ';') && (strcmp(prevWord, "end") == 0)) if((ch == ';') && (strcmp(prevWord, "end") == 0))
{ {
@ -301,7 +355,7 @@ static void FoldNoBoxVHDLDoc(
lastStart = i; lastStart = i;
} }
if(iswordchar(ch) && !iswordchar(chNext)) { if(IsAWordChar(ch) && !IsAWordChar(chNext)) {
char s[32]; char s[32];
unsigned int k; unsigned int k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
@ -314,8 +368,6 @@ static void FoldNoBoxVHDLDoc(
if ( if (
strcmp(s, "architecture") == 0 || strcmp(s, "architecture") == 0 ||
strcmp(s, "case") == 0 || strcmp(s, "case") == 0 ||
strcmp(s, "component") == 0 ||
strcmp(s, "entity") == 0 ||
strcmp(s, "generate") == 0 || strcmp(s, "generate") == 0 ||
strcmp(s, "loop") == 0 || strcmp(s, "loop") == 0 ||
strcmp(s, "package") ==0 || strcmp(s, "package") ==0 ||
@ -330,6 +382,32 @@ static void FoldNoBoxVHDLDoc(
} }
levelNext++; levelNext++;
} }
} else if (
strcmp(s, "component") == 0 ||
strcmp(s, "entity") == 0 ||
strcmp(s, "configuration") == 0 )
{
if (strcmp(prevWord, "end") != 0)
{ // check for instantiated unit by backward searching for the colon.
unsigned pos = lastStart-1;
char chAtPos, styleAtPos;
do{// skip white spaces
styleAtPos = styler.StyleAt(pos);
chAtPos = styler.SafeGetCharAt(pos--);
}while(pos>0 &&
(chAtPos == ' ' || chAtPos == '\t' ||
chAtPos == '\n' || chAtPos == '\r' ||
IsCommentStyle(styleAtPos)));
// check for a colon (':') before the instantiated units "entity", "component" or "configuration". Don't fold thereafter.
if (chAtPos != ':')
{
if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext;
}
levelNext++;
}
}
} else if ( } else if (
strcmp(s, "procedure") == 0 || strcmp(s, "procedure") == 0 ||
strcmp(s, "function") == 0) strcmp(s, "function") == 0)
@ -338,19 +416,19 @@ static void FoldNoBoxVHDLDoc(
{ // This code checks to see if the procedure / function is a definition within a "package" { // This code checks to see if the procedure / function is a definition within a "package"
// rather than the actual code in the body. // rather than the actual code in the body.
int BracketLevel = 0; int BracketLevel = 0;
for(int j=i+1; j<styler.Length(); j++) for(int pos=i+1; pos<styler.Length(); pos++)
{ {
int LocalStyle = styler.StyleAt(j); int styleAtPos = styler.StyleAt(pos);
char LocalCh = styler.SafeGetCharAt(j); char chAtPos = styler.SafeGetCharAt(pos);
if(LocalCh == '(') BracketLevel++; if(chAtPos == '(') BracketLevel++;
if(LocalCh == ')') BracketLevel--; if(chAtPos == ')') BracketLevel--;
if( if(
(BracketLevel == 0) && (BracketLevel == 0) &&
(LocalStyle != SCE_VHDL_COMMENT) && (!IsCommentStyle(styleAtPos)) &&
(LocalStyle != SCE_VHDL_STRING) && (styleAtPos != SCE_VHDL_STRING) &&
!iswordchar(styler.SafeGetCharAt(j-1)) && !iswordchar(styler.SafeGetCharAt(pos-1)) &&
styler.Match(j, "is") && styler.Match(pos, "is") &&
!iswordchar(styler.SafeGetCharAt(j+2))) !iswordchar(styler.SafeGetCharAt(pos+2)))
{ {
if (levelMinCurrentElse > levelNext) { if (levelMinCurrentElse > levelNext) {
levelMinCurrentElse = levelNext; levelMinCurrentElse = levelNext;
@ -358,7 +436,7 @@ static void FoldNoBoxVHDLDoc(
levelNext++; levelNext++;
break; break;
} }
if((BracketLevel == 0) && (LocalCh == ';')) if((BracketLevel == 0) && (chAtPos == ';'))
{ {
break; break;
} }

View File

@ -31,7 +31,7 @@ diff --git b/scintilla/src/Catalogue.cxx a/scintilla/src/Catalogue.cxx
index 41d5d54..70ce3bc 100644 index 41d5d54..70ce3bc 100644
--- scintilla/src/Catalogue.cxx --- scintilla/src/Catalogue.cxx
+++ scintilla/src/Catalogue.cxx +++ scintilla/src/Catalogue.cxx
@@ -76,116 +76,48 @@ int Scintilla_LinkLexers() { @@ -76,117 +76,48 @@ int Scintilla_LinkLexers() {
//++Autogenerated -- run scripts/LexGen.py to regenerate //++Autogenerated -- run scripts/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\) //**\(\tLINK_LEXER(\*);\n\)
@ -49,6 +49,7 @@ index 41d5d54..70ce3bc 100644
- LINK_LEXER(lmBaan); - LINK_LEXER(lmBaan);
LINK_LEXER(lmBash); LINK_LEXER(lmBash);
LINK_LEXER(lmBatch); LINK_LEXER(lmBatch);
- LINK_LEXER(lmBibTeX);
- LINK_LEXER(lmBlitzBasic); - LINK_LEXER(lmBlitzBasic);
- LINK_LEXER(lmBullant); - LINK_LEXER(lmBullant);
LINK_LEXER(lmCaml); LINK_LEXER(lmCaml);

View File

@ -937,6 +937,8 @@ void Document::CheckReadOnly() {
// SetStyleAt does not change the persistent state of a document // SetStyleAt does not change the persistent state of a document
bool Document::DeleteChars(int pos, int len) { bool Document::DeleteChars(int pos, int len) {
if (pos < 0)
return false;
if (len <= 0) if (len <= 0)
return false; return false;
if ((pos + len) > Length()) if ((pos + len) > Length())
@ -2198,8 +2200,8 @@ public:
long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool, bool, int flags, bool caseSensitive, bool, bool, int flags,
int *length) { int *length) {
bool posix = (flags & SCFIND_POSIX) != 0; const bool posix = (flags & SCFIND_POSIX) != 0;
int increment = (minPos <= maxPos) ? 1 : -1; const int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos; int startPos = minPos;
int endPos = maxPos; int endPos = maxPos;
@ -2217,7 +2219,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2) // Replace: $(\1-\2)
int lineRangeStart = doc->LineFromPosition(startPos); int lineRangeStart = doc->LineFromPosition(startPos);
int lineRangeEnd = doc->LineFromPosition(endPos); const int lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) && if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) && (startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) { (lineRangeStart < lineRangeEnd)) {
@ -2233,9 +2235,9 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
} }
int pos = -1; int pos = -1;
int lenRet = 0; int lenRet = 0;
char searchEnd = s[*length - 1]; const char searchEnd = s[*length - 1];
char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0'; const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
int lineRangeBreak = lineRangeEnd + increment; const int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) { for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line); int startOfLine = doc->LineStart(line);
int endOfLine = doc->LineEnd(line); int endOfLine = doc->LineEnd(line);

View File

@ -61,6 +61,7 @@ EditModel::EditModel() {
bracesMatchStyle = STYLE_BRACEBAD; bracesMatchStyle = STYLE_BRACEBAD;
highlightGuideColumn = 0; highlightGuideColumn = 0;
primarySelection = true; primarySelection = true;
imeInteraction = imeWindowed;
foldFlags = 0; foldFlags = 0;
hotspot = Range(invalidPosition); hotspot = Range(invalidPosition);
wrapWidth = LineLayout::wrapWidthInfinite; wrapWidth = LineLayout::wrapWidthInfinite;

View File

@ -42,6 +42,8 @@ public:
Selection sel; Selection sel;
bool primarySelection; bool primarySelection;
enum IMEInteraction { imeWindowed, imeInline } imeInteraction;
int foldFlags; int foldFlags;
ContractionState cs; ContractionState cs;
// Hotspot support // Hotspot support

View File

@ -215,11 +215,11 @@ void EditView::ClearAllTabstops() {
ldTabstops = 0; ldTabstops = 0;
} }
int EditView::NextTabstopPos(int line, int x, int tabWidth) const { XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const {
int next = GetNextTabstop(line, x); int next = GetNextTabstop(line, static_cast<int>(x + 2));
if (next > 0) if (next > 0)
return next; return static_cast<XYPOSITION>(next);
return ((((x + 2) / tabWidth) + 1) * tabWidth); return (static_cast<int>((x + 2) / tabWidth) + 1) * tabWidth;
} }
bool EditView::ClearTabstops(int line) { bool EditView::ClearTabstops(int line) {
@ -452,9 +452,8 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
XYPOSITION representationWidth = vstyle.controlCharWidth; XYPOSITION representationWidth = vstyle.controlCharWidth;
if (ll->chars[ts.start] == '\t') { if (ll->chars[ts.start] == '\t') {
// Tab is a special case of representation, taking a variable amount of space // Tab is a special case of representation, taking a variable amount of space
const int x = static_cast<int>(ll->positions[ts.start]); const XYPOSITION x = ll->positions[ts.start];
const int tabWidth = static_cast<int>(vstyle.tabWidth); representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start];
representationWidth = static_cast<XYPOSITION>(NextTabstopPos(line, x, tabWidth) - ll->positions[ts.start]);
} else { } else {
if (representationWidth <= 0.0) { if (representationWidth <= 0.0) {
XYPOSITION positionsRepr[256]; // Should expand when needed XYPOSITION positionsRepr[256]; // Should expand when needed

View File

@ -32,7 +32,7 @@ enum DrawPhase {
drawLineTranslucent = 0x40, drawLineTranslucent = 0x40,
drawFoldLines = 0x80, drawFoldLines = 0x80,
drawCarets = 0x100, drawCarets = 0x100,
drawAll = 0x1FF, drawAll = 0x1FF
}; };
bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st); bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st);
@ -86,7 +86,7 @@ public:
bool LinesOverlap() const; bool LinesOverlap() const;
void ClearAllTabstops(); void ClearAllTabstops();
int NextTabstopPos(int line, int x, int tabWidth) const; XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const;
bool ClearTabstops(int line); bool ClearTabstops(int line);
bool AddTabstop(int line, int x); bool AddTabstop(int line, int x);
int GetNextTabstop(int line, int x) const; int GetNextTabstop(int line, int x) const;

View File

@ -2132,14 +2132,6 @@ void Editor::Redo() {
} }
} }
void Editor::DelChar() {
if (!RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1)) {
pdoc->DelChar(sel.MainCaret());
}
// Avoid blinking during rapid typing:
ShowCaretAtCurrentPosition();
}
void Editor::DelCharBack(bool allowLineStartDeletion) { void Editor::DelCharBack(bool allowLineStartDeletion) {
RefreshStyleData(); RefreshStyleData();
if (!sel.IsRectangular()) if (!sel.IsRectangular())
@ -4284,7 +4276,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
} }
bool Editor::PositionIsHotspot(int position) const { bool Editor::PositionIsHotspot(int position) const {
return vs.styles[pdoc->StyleAt(position)].hotspot; return vs.styles[static_cast<unsigned char>(pdoc->StyleAt(position))].hotspot;
} }
bool Editor::PointIsHotspot(Point pt) { bool Editor::PointIsHotspot(Point pt) {
@ -6259,6 +6251,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETCODEPAGE: case SCI_GETCODEPAGE:
return pdoc->dbcsCodePage; return pdoc->dbcsCodePage;
case SCI_SETIMEINTERACTION:
imeInteraction = static_cast<EditModel::IMEInteraction>(wParam);
break;
case SCI_GETIMEINTERACTION:
return imeInteraction;
#ifdef INCLUDE_DEPRECATED_FEATURES #ifdef INCLUDE_DEPRECATED_FEATURES
case SCI_SETUSEPALETTE: case SCI_SETUSEPALETTE:
InvalidateStyleRedraw(); InvalidateStyleRedraw();

View File

@ -403,7 +403,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
void SelectAll(); void SelectAll();
void Undo(); void Undo();
void Redo(); void Redo();
void DelChar();
void DelCharBack(bool allowLineStartDeletion); void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0; virtual void ClaimSelection() = 0;

View File

@ -17,11 +17,14 @@ namespace Scintilla {
class Indicator { class Indicator {
public: public:
int style; int style;
bool under;
ColourDesired fore; ColourDesired fore;
bool under;
int fillAlpha; int fillAlpha;
int outlineAlpha; int outlineAlpha;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) { Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)), under(false), fillAlpha(30), outlineAlpha(50) {
}
Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) :
style(style_), fore(fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_) {
} }
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const; void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) const;
}; };

View File

@ -276,10 +276,9 @@ void RESearch::GrabMatches(CharacterIndexer &ci) {
for (unsigned int i = 0; i < MAXTAG; i++) { for (unsigned int i = 0; i < MAXTAG; i++) {
if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) { if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) {
unsigned int len = eopat[i] - bopat[i]; unsigned int len = eopat[i] - bopat[i];
pat[i] = std::string(len+1, '\0'); pat[i].resize(len);
for (unsigned int j = 0; j < len; j++) for (unsigned int j = 0; j < len; j++)
pat[i][j] = ci.CharAt(bopat[i] + j); pat[i][j] = ci.CharAt(bopat[i] + j);
pat[i][len] = '\0';
} }
} }
} }

View File

@ -192,15 +192,9 @@ void ViewStyle::Init(size_t stylesSize_) {
// There are no image markers by default, so no need for calling CalcLargestMarkerHeight() // There are no image markers by default, so no need for calling CalcLargestMarkerHeight()
largestMarkerHeight = 0; largestMarkerHeight = 0;
indicators[0].style = INDIC_SQUIGGLE; indicators[0] = Indicator(INDIC_SQUIGGLE, ColourDesired(0, 0x7f, 0));
indicators[0].under = false; indicators[1] = Indicator(INDIC_TT, ColourDesired(0, 0, 0xff));
indicators[0].fore = ColourDesired(0, 0x7f, 0); indicators[2] = Indicator(INDIC_PLAIN, ColourDesired(0xff, 0, 0));
indicators[1].style = INDIC_TT;
indicators[1].under = false;
indicators[1].fore = ColourDesired(0, 0, 0xff);
indicators[2].style = INDIC_PLAIN;
indicators[2].under = false;
indicators[2].fore = ColourDesired(0xff, 0, 0);
technology = SC_TECHNOLOGY_DEFAULT; technology = SC_TECHNOLOGY_DEFAULT;
lineHeight = 1; lineHeight = 1;

View File

@ -1 +1 @@
350 351

View File

@ -1388,7 +1388,8 @@ static const HLStyle highlighting_styles_SQL[] =
{ SCE_SQL_SQLPLUS, "sqlplus", FALSE }, { SCE_SQL_SQLPLUS, "sqlplus", FALSE },
{ SCE_SQL_SQLPLUS_PROMPT, "sqlplus_prompt", FALSE }, { SCE_SQL_SQLPLUS_PROMPT, "sqlplus_prompt", FALSE },
{ SCE_SQL_SQLPLUS_COMMENT, "sqlplus_comment", FALSE }, { SCE_SQL_SQLPLUS_COMMENT, "sqlplus_comment", FALSE },
{ SCE_SQL_QUOTEDIDENTIFIER, "quotedidentifier", FALSE } { SCE_SQL_QUOTEDIDENTIFIER, "quotedidentifier", FALSE },
{ SCE_SQL_QOPERATOR, "qoperator", FALSE }
/* these are for user-defined keywords we don't set yet */ /* these are for user-defined keywords we don't set yet */
/*{ SCE_SQL_USER1, "user1", FALSE }, /*{ SCE_SQL_USER1, "user1", FALSE },
{ SCE_SQL_USER2, "user2", FALSE }, { SCE_SQL_USER2, "user2", FALSE },
@ -1483,6 +1484,7 @@ static const HLStyle highlighting_styles_VHDL[] =
{ SCE_VHDL_DEFAULT, "default", FALSE }, { SCE_VHDL_DEFAULT, "default", FALSE },
{ SCE_VHDL_COMMENT, "comment", FALSE }, { SCE_VHDL_COMMENT, "comment", FALSE },
{ SCE_VHDL_COMMENTLINEBANG, "comment_line_bang", FALSE }, { SCE_VHDL_COMMENTLINEBANG, "comment_line_bang", FALSE },
{ SCE_VHDL_BLOCK_COMMENT, "block_comment", FALSE },
{ SCE_VHDL_NUMBER, "number", FALSE }, { SCE_VHDL_NUMBER, "number", FALSE },
{ SCE_VHDL_STRING, "string", FALSE }, { SCE_VHDL_STRING, "string", FALSE },
{ SCE_VHDL_OPERATOR, "operator", FALSE }, { SCE_VHDL_OPERATOR, "operator", FALSE },