[anjuta-extras] scintilla: Update to scintilla 2.29
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta-extras] scintilla: Update to scintilla 2.29
- Date: Sat, 17 Sep 2011 11:01:01 +0000 (UTC)
commit a5df941d1814f0433c9e65e2f821159d905a8608
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sat Sep 17 11:17:17 2011 +0200
scintilla: Update to scintilla 2.29
plugins/scintilla/properties/styles.properties | 178 +++++++-
plugins/scintilla/scintilla/Accessor.cxx | 2 +-
plugins/scintilla/scintilla/ContractionState.cxx | 12 +-
plugins/scintilla/scintilla/ContractionState.h | 1 +
plugins/scintilla/scintilla/Decoration.cxx | 6 +-
plugins/scintilla/scintilla/Document.cxx | 201 ++++-----
plugins/scintilla/scintilla/Document.h | 39 +-
plugins/scintilla/scintilla/Editor.cxx | 501 +++++++++++++-------
plugins/scintilla/scintilla/Editor.h | 10 +-
plugins/scintilla/scintilla/Indicator.cxx | 54 +++
plugins/scintilla/scintilla/KeyMap.cxx | 47 ++-
plugins/scintilla/scintilla/KeyMap.h | 1 +
plugins/scintilla/scintilla/LexAU3.cxx | 2 +-
plugins/scintilla/scintilla/LexCOBOL.cxx | 8 +
plugins/scintilla/scintilla/LexCPP.cxx | 21 +-
plugins/scintilla/scintilla/LexConf.cxx | 2 +-
plugins/scintilla/scintilla/LexHTML.cxx | 62 ++-
plugins/scintilla/scintilla/LexLua.cxx | 82 +++-
plugins/scintilla/scintilla/LexMagik.cxx | 2 +-
plugins/scintilla/scintilla/LexMarkdown.cxx | 23 +-
plugins/scintilla/scintilla/LexMatlab.cxx | 12 +-
plugins/scintilla/scintilla/LexModula.cxx | 4 +-
plugins/scintilla/scintilla/LexOthers.cxx | 250 +++++++++--
plugins/scintilla/scintilla/LexPerl.cxx | 371 ++++++++++++---
plugins/scintilla/scintilla/LexPowerPro.cxx | 2 +-
plugins/scintilla/scintilla/LexPython.cxx | 57 +--
plugins/scintilla/scintilla/LexTeX.cxx | 2 +-
plugins/scintilla/scintilla/LexVHDL.cxx | 2 +-
plugins/scintilla/scintilla/LexVerilog.cxx | 30 +-
plugins/scintilla/scintilla/LineMarker.cxx | 29 +-
plugins/scintilla/scintilla/LineMarker.h | 9 +-
plugins/scintilla/scintilla/Makefile.am | 5 +
plugins/scintilla/scintilla/PerLine.cxx | 4 +-
plugins/scintilla/scintilla/PlatGTK.cxx | 213 ++++++---
plugins/scintilla/scintilla/PositionCache.cxx | 13 +-
plugins/scintilla/scintilla/PositionCache.h | 2 +-
plugins/scintilla/scintilla/PropSetSimple.cxx | 7 +-
plugins/scintilla/scintilla/RESearch.cxx | 6 +-
plugins/scintilla/scintilla/RunStyles.cxx | 34 ++-
plugins/scintilla/scintilla/RunStyles.h | 8 +-
plugins/scintilla/scintilla/ScintillaBase.cxx | 10 +-
plugins/scintilla/scintilla/ScintillaGTK.cxx | 102 ++++-
plugins/scintilla/scintilla/SparseState.h | 2 +-
plugins/scintilla/scintilla/Style.cxx | 8 +-
plugins/scintilla/scintilla/StyleContext.h | 2 +-
plugins/scintilla/scintilla/ViewStyle.cxx | 4 +
plugins/scintilla/scintilla/WordList.cxx | 28 +-
plugins/scintilla/scintilla/XPM.cxx | 143 ++++++-
plugins/scintilla/scintilla/XPM.h | 50 ++-
plugins/scintilla/scintilla/include/Platform.h | 11 +
plugins/scintilla/scintilla/include/SciLexer.h | 19 +
plugins/scintilla/scintilla/include/Scintilla.h | 19 +
.../scintilla/scintilla/include/Scintilla.iface | 64 +++
.../scintilla/patches/scintilla-64-bit.diff | 5 +-
.../scintilla/patches/scintilla-pango-always.diff | 7 +-
.../patches/scintilla-remove-deprecated.diff | 6 +-
56 files changed, 2107 insertions(+), 687 deletions(-)
---
diff --git a/plugins/scintilla/properties/styles.properties b/plugins/scintilla/properties/styles.properties
index 838f95d..f4238f3 100644
--- a/plugins/scintilla/properties/styles.properties
+++ b/plugins/scintilla/properties/styles.properties
@@ -1332,6 +1332,7 @@ file.patterns.idl=*.idl;*.odl
file.patterns.flash=*.as;*.asc;*.jsfl
file.patterns.ch=*.ch;*.chf;*.chs
file.patterns.vala=*.vala
+file.patterns.go=*.go
file.patterns.c.like=$(file.patterns.cpp);$(file.patterns.cs);$(file.patterns.idl);$(file.patterns.java);$(file.patterns.js);$(file.patterns.flash);$(file.patterns.ch);$(file.patterns.vala)
shbang.tcc=cpp
@@ -1345,6 +1346,7 @@ filter.idl=IDL (idl odl)|$(file.patterns.idl)|
filter.test=SilkTest (pln inc t)|$(file.patterns.test)|
filter.flash=Flash (as asc jsfl)|$(file.patterns.flash)|
filter.ch=Ch (ch chf chs)|$(file.patterns.ch)|
+filter.go=Go (go)|$(file.patterns.go)|
lexer.$(file.patterns.java)=cpp
lexer.$(file.patterns.javafx)=cpp
@@ -1357,6 +1359,7 @@ lexer.$(file.patterns.test)=cpp
lexer.$(file.patterns.flash)=cpp
lexer.$(file.patterns.ch)=cpp
lexer.$(file.patterns.vala)=cpp
+lexer.$(file.patterns.go)=cpp
keywordclass.cpp=and and_eq asm auto bitand bitor bool break \
case catch char class compl const const_cast continue \
@@ -1472,6 +1475,13 @@ unchecked unsafe ushort using var virtual void where while
keywords.$(file.patterns.cs)=$(keywordclass.cs)
word.characters.$(file.patterns.cs)=$(word.chars.cxx)
+keywordclass.go=\
+bool byte break case chan complex64 complex128 const continue defer default \
+else for func go goto fallthrough false float32 float64 if import int interface int8 int16 int32 int64 \
+len map nil package range return select string struct switch true type \
+uint uintptr uint8 uint16 uint32 uint64 var
+keywords.$(file.patterns.go)=$(keywordclass.go)
+
keywordclass.rc=\
ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON \
BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX CLASS \
@@ -1672,6 +1682,11 @@ command.go.*.fx=javafx -cp . $(FileName)
command.build.$(file.patterns.vala)=valac $(FileNameExt)
command.go.*.vala=./$(FileName)
+# can also be 6g for 64-bit systems!
+command.compile.*.go=8g $(FileNameExt)
+command.build.*.go=$(make.command)
+command.go.*.go=./$(FileName)
+
###############################################################################
@@ -3581,8 +3596,8 @@ lexer.$(file.patterns.lua)=lua
word.chars.lua=$(chars.alpha)$(chars.numeric)$(chars.accented)_%
word.characters.$(file.patterns.lua)=$(word.chars.lua)
-keywordclass.lua=and break do else elseif end false for function if \
-in local nil not or repeat return then true until while
+keywordclass.lua=and break do else elseif end false for function goto \
+if in local nil not or repeat return then true until while
keywords.$(file.patterns.lua)=$(keywordclass.lua)
# Basic Functions (in both versions of Lua)
@@ -4616,7 +4631,7 @@ system syswrite tell telldir tie tied time times truncate \
uc ucfirst umask undef unless unlink unpack unshift untie until \
use utime values vec wait waitpid wantarray warn while write \
xor \
-given when default say state UNITCHECK
+given when default break say state UNITCHECK
keywords.$(file.patterns.awk)=\
BEGIN END \
@@ -4689,6 +4704,8 @@ colour.bash.heredoc=$(colour.embedded.comment)
# Perl styles
# The perl styles are set to lots of different foreground and background colours as an
+
+
# Braces are only matched in operator style
braces.perl.style=10
@@ -6640,13 +6657,13 @@ comment.box.end.verilog= */
fold.verilog.flags=0
-#statement.lookback.$(file.patterns.verilog)=20
-#block.start.$(file.patterns.verilog)=5 begin
-#block.end.$(file.patterns.verilog)=5 end
-#statement.indent.$(file.patterns.verilog)=5 always case casex casez else for if while \
-#module function task
+statement.lookback.$(file.patterns.verilog)=20
+statement.end.$(file.patterns.verilog)=10 ;
+block.start.$(file.patterns.verilog)=5 begin case casex casez
+block.end.$(file.patterns.verilog)=5 begin end endcase
+statement.indent.$(file.patterns.verilog)=5 always else for if while
-indent.maintain.$(file.patterns.verilog)=1;
+indent.maintain.$(file.patterns.verilog)=0
preprocessor.symbol.$(file.patterns.verilog)=`
preprocessor.start.$(file.patterns.verilog)=ifdef ifndef
@@ -6672,7 +6689,7 @@ parameter pmos posedge primitive pull0 pull1 pulldown pullup pulsestyle_ondetect
rcmos real realtime reg release repeat rnmos rpmos rtran rtranif0 rtranif1 \
scalared showcancelled signed small specify specparam strong0 strong1 supply0 supply1 \
table task time tran tranif0 tranif1 tri tri0 tri1 triand trior trireg \
-unsigned use \
+unsigned use uwire \
vectored \
wait wand weak0 weak1 while wire wor \
xnor xor
@@ -6686,7 +6703,7 @@ $countdrivers \
$display $displayb $displayh $displayo \
$dist_chi_square $dist_erlang $dist_exponential $dist_normal $dist_poisson $dist_t $dist_uniform \
$dumpall $dumpfile $dumpflush $dumplimit $dumpoff $dumpon $dumpportsall $dumpportsflush $dumpportslimit $dumpportsoff $dumpportson $dumpvars \
-$fclose $fdisplayh $fdisplay $fdisplayf $fdisplayb $ferror $fflush $fgetc $fgets $finish $fmonitorb $fmonitor $fmonitorf $fmonitorh $fopen $fread $fscanf $fseek $fsscanf $fstrobe $fstrobebb $fstrobef $fstrobeh $ftel $fullskew $fwriteb $fwritef $fwriteh $fwrite \
+$fclose $fdisplayh $fdisplay $fdisplayf $fdisplayb $feof $ferror $fflush $fgetc $fgets $finish $fmonitorb $fmonitor $fmonitorf $fmonitorh $fopen $fread $fscanf $fseek $fsscanf $fstrobe $fstrobebb $fstrobef $fstrobeh $ftel $fullskew $fwriteb $fwritef $fwriteh $fwrite \
$getpattern \
$history $hold \
$incsave $input $itor \
@@ -6703,8 +6720,103 @@ $ungetc $unsigned \
$value$plusargs \
$width $writeb $writeh $write $writeo
+
+# Define SciTE settings for SystemVerilog files.
+
+# systemverilog files
+file.patterns.systemverilog=*.sv;*.svh
+filter.systemverilog=systemverilog (systemverilog)|$(file.patterns.systemverilog)|
+lexer.$(file.patterns.systemverilog)=verilog
+
+word.chars.systemverilog=$(chars.alpha)$(chars.numeric)_`$#
+word.characters.$(file.patterns.systemverilog)=$(word.chars.systemverilog)
+
+statement.lookback.$(file.patterns.systemverilog)=20
+statement.end.$(file.patterns.systemverilog)=10 ;
+block.start.$(file.patterns.systemverilog)=5 begin case casex casez
+block.end.$(file.patterns.systemverilog)=5 begin end endcase
+statement.indent.$(file.patterns.systemverilog)=5 always else for if while
+
+indent.maintain.$(file.patterns.systemverilog)= 0
+
+preprocessor.symbol.$(file.patterns.systemverilog)=`
+preprocessor.start.$(file.patterns.systemverilog)=ifdef ifndef
+preprocessor.middle.$(file.patterns.systemverilog)=else
+preprocessor.end.$(file.patterns.systemverilog)=endif
+
+# Taken from the SystemVerilog IEEE Std 1800-2005 Annex B
+keywords.$(file.patterns.systemverilog)=\
+alias always always_comb always_ff always_latch and assert assign assume \
+automatic before begin bind bins binsof bit break buf bufif0 bufif1 byte case \
+casex casez cell chandle class clocking cmos config const constraint context \
+continue cover covergroup coverpoint cross deassign default defparam design \
+disable dist do edge else end endcase endclass endclocking endconfig \
+endfunction endgenerate endgroup endinterface endmodule endpackage \
+endprimitive endprogram endproperty endspecify endsequence endtable endtask \
+enum event expect export extends extern final first_match for force foreach \
+forever fork forkjoin function generate genvar highz0 highz1 if iff ifnone \
+ignore_bins illegal_bins import incdir include initial inout input inside \
+instance int integer interface intersect join join_any join_none large liblist \
+library local localparam logic longint macromodule matches medium modport \
+module nand negedge new nmos nor noshowcancelled not notif0 notif1 null or \
+output package packed parameter pmos posedge primitive priority program \
+property protected pull0 pull1 pulldown pullup pulsestyle_onevent \
+pulsestyle_ondetect pure rand randc randcase randsequence rcmos real realtime \
+ref reg release repeat return rnmos rpmos rtran rtranif0 rtranif1 scalared \
+sequence shortint shortreal showcancelled signed small solve specify specparam \
+static string strong0 strong1 struct super supply0 supply1 table tagged task \
+this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 \
+triand trior trireg type typedef union unique unsigned use uwire var vectored \
+virtual void wait wait_order wand weak0 weak1 while wildcard wire with within \
+wor xnor xor
+
+# Secondary keywords and identifiers
+#keywords2.$(file.patterns.systemverilog)=
+
+# System Tasks
+keywords3.$(file.patterns.systemverilog)=\
+$acos $acosh $asin $asinh $assertfailoff $assertfailon $assertkill \
+$assertnonvacuouson $assertoff $asserton $assertpassoff $assertpasson \
+$assertvacuousoff $async$and$array $async$and$plane $async$nand$array \
+$async$nand$plane $async$nor$array $async$nor$plane $async$or$array \
+$async$or$plane $atan $atan2 $atanh $bits $bitstoreal $bitstoshortreal $cast \
+$ceil $changed $changed_gclk $changing_gclk $clog2 $cos $cosh $countdrivers \
+$countones $coverage_control $coverage_get $coverage_get_max $coverage_merge \
+$coverage_save $dimensions $display $displayb $displayh $displayo \
+$dist_chi_square $dist_erlang $dist_exponential $dist_normal $dist_poisson \
+$dist_t $dist_uniform $dumpall $dumpfile $dumpflush $dumplimit $dumpoff \
+$dumpon $dumpports $dumpportsall $dumpportsflush $dumpportslimit $dumpportsoff \
+$dumpportson $dumpvars $error $exit $exp $falling_gclk $fatal $fclose \
+$fdisplay $fdisplayb $fdisplayf $fdisplayh $fdisplayo $fell $fell_gclk $feof \
+$ferror $fflush $fgetc $fgets $finish $floor $fmonitor $fmonitorb $fmonitorf \
+$fmonitorh $fmonitoro $fopen $fread $fscanf $fseek $fsscanf $fstrobe $fstrobeb \
+$fstrobebb $fstrobef $fstrobeh $fstrobeo $ftel $ftell $fullskew $future_gclk \
+$fwrite $fwriteb $fwritef $fwriteh $fwriteo $get_coverage $getpattern $high \
+$history $hold $hypot $increment $incsave $info $input $isunbounded $isunknown \
+$itor $key $left $list $ln $load_coverage_db $log $log10 $low $monitor \
+$monitorb $monitorh $monitoro $monitoroff $monitoron $nochange $nokey $nolog \
+$onehot $onehot0 $past $past_gclk $period $pow $printtimescale $q_add $q_exam \
+$q_full $q_initialize $q_remove $random $readmemb $readmemh $realtime \
+$realtobits $recovery $recrem $removal $reset $reset_count $reset_value \
+$restart $rewind $right $rising_gclk $root $rose $rose_gclk $rtoi $sampled \
+$save $scale $scope $sdf_annotate $set_coverage_db_name $setup $setuphold \
+$sformat $sformatf $shortrealtobits $showscopes $showvariables $showvars \
+$signed $sin $sinh $size $skew $sqrt $sreadmemb $sreadmemh $sscanf $stable \
+$stable_gclk $steady_gclk $stime $stop $strobe $strobeb $strobeh $strobeo \
+$swrite $swriteb $swriteh $swriteo $sync$and$array $sync$and$plane \
+$sync$nand$array $sync$nand$plane $sync$nor$array $sync$nor$plane \
+$sync$or$array $sync$or$plane $system $tan $tanh $test$plusargs $time \
+$timeformat $timeskew $typename $ungetc $unit $unpacked_dimensions $unsigned \
+$urandom $urandom_range $value$plusargs $warning $width $write $writeb $writeh \
+$writememb $writememh $writeo
+
+# User defined tasks and identifiers
+#keywords4.$(file.patterns.systemverilog)=
+
+
# Verilog styles
+# Operators
# Braces are only matched in operator style
braces.verilog.style=10
@@ -8281,12 +8393,28 @@ keywords.$(file.patterns.yaml)=true false yes no
style.latex.0=$(style.anjuta.whitespace)
# Command
style.latex.1=$(style.anjuta.keyword)
-# Tag
+# Tag Opening
style.latex.2=$(style.anjuta.attribute)
-# Math
+# Math Inline
style.latex.3=$(style.anjuta.function)
# Comment
style.latex.4=$(style.anjuta.comment)
+# Tag Closing
+ style.latex.5=$(style.anjuta.string)
+# Math Block
+ style.latex.6=$(style.anjuta.regex)
+# Comment Block
+ style.latex.7=$(style.anjuta.comment)
+# Verbatim Segment
+ style.latex.8=$(style.anjuta.raw)
+# Short Command
+ style.latex.9=$(style.anjuta.preprocessor)
+# Special Char
+ style.latex.10=$(style.anjuta.char)
+# Command optional argument
+ style.latex.11=$(style.anjuta.extrakeyword)
+# Syntax error
+ style.latex.12=$(style.anjuta.error)
@@ -8397,6 +8525,8 @@ keywords.$(file.patterns.yaml)=true false yes no
style.lua.18=$(style.anjuta.syskeyword)
#
style.lua.19=$(style.anjuta.extrakeyword)
+# Labels
+ style.lua.20=$(style.anjuta.extrakeyword)
@@ -8791,6 +8921,26 @@ keywords.$(file.patterns.yaml)=true false yes no
style.perl.41=$(style.anjuta.raw)
# format body
style.perl.42=$(style.anjuta.raw)
+# Double quoted string (interpolated variable)
+ style.perl.43=$(style.anjuta.string)
+# translation: tr{}{} y{}{}
+ style.perl.44=$(style.anjuta.regex)
+# Regex: /re/ or m{re} (interpolated variable)
+ style.perl.54=$(style.anjuta.regex)
+# Substitution: s/re/ore/ (interpolated variable)
+ style.perl.55=$(style.anjuta.regex)
+# Back Ticks (interpolated variable)
+ style.perl.57=$(style.anjuta.char)
+# Here-doc (double quoted, qq) (interpolated variable)
+ style.perl.61=$(style.anjuta.comment)
+# Here-doc (back ticks, qx) (interpolated variable)
+ style.perl.62=$(style.anjuta.comment)
+# qq = Double quoted string (interpolated variable)
+ style.perl.64=$(style.anjuta.string)
+# qx = Back ticks (interpolated variable)
+ style.perl.65=$(style.anjuta.char)
+# qr = Regex (interpolated variable)
+ style.perl.66=$(style.anjuta.regex)
@@ -9581,7 +9731,7 @@ keywords.$(file.patterns.yaml)=true false yes no
style.verilog.8=$(style.anjuta.syskeyword)
# Preprocessor
style.verilog.9=$(style.anjuta.preprocessor)
-# Operators
+#~ style.verilog.10=$(colour.operator),bold
style.verilog.10=$(style.anjuta.operator)
# End of line where string is not closed
style.verilog.12=$(style.anjuta.error)
diff --git a/plugins/scintilla/scintilla/Accessor.cxx b/plugins/scintilla/scintilla/Accessor.cxx
index 5adaaa2..6560959 100644
--- a/plugins/scintilla/scintilla/Accessor.cxx
+++ b/plugins/scintilla/scintilla/Accessor.cxx
@@ -71,7 +71,7 @@ int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsComment
*flags = spaceFlags;
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...
- if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
+ if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') ||
(pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)))
return indent | SC_FOLDLEVELWHITEFLAG;
else
diff --git a/plugins/scintilla/scintilla/ContractionState.cxx b/plugins/scintilla/scintilla/ContractionState.cxx
index 8a1b486..af0f4f3 100644
--- a/plugins/scintilla/scintilla/ContractionState.cxx
+++ b/plugins/scintilla/scintilla/ContractionState.cxx
@@ -168,6 +168,14 @@ bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible
}
}
+bool ContractionState::HiddenLines() const {
+ if (OneToOne()) {
+ return false;
+ } else {
+ return !visible->AllSameAs(1);
+ }
+}
+
bool ContractionState::GetExpanded(int lineDoc) const {
if (OneToOne()) {
return true;
@@ -223,7 +231,7 @@ int ContractionState::GetHeight(int lineDoc) const {
bool ContractionState::SetHeight(int lineDoc, int height) {
if (OneToOne() && (height == 1)) {
return false;
- } else {
+ } else if (lineDoc < LinesInDoc()) {
EnsureData();
if (GetHeight(lineDoc) != height) {
if (GetVisible(lineDoc)) {
@@ -236,6 +244,8 @@ bool ContractionState::SetHeight(int lineDoc, int height) {
Check();
return false;
}
+ } else {
+ return false;
}
}
diff --git a/plugins/scintilla/scintilla/ContractionState.h b/plugins/scintilla/scintilla/ContractionState.h
index 8e7b39b..0309fc2 100644
--- a/plugins/scintilla/scintilla/ContractionState.h
+++ b/plugins/scintilla/scintilla/ContractionState.h
@@ -48,6 +48,7 @@ public:
bool GetVisible(int lineDoc) const;
bool SetVisible(int lineDocStart, int lineDocEnd, bool visible);
+ bool HiddenLines() const;
bool GetExpanded(int lineDoc) const;
bool SetExpanded(int lineDoc, bool expanded);
diff --git a/plugins/scintilla/scintilla/Decoration.cxx b/plugins/scintilla/scintilla/Decoration.cxx
index e4ac0e0..24632d7 100644
--- a/plugins/scintilla/scintilla/Decoration.cxx
+++ b/plugins/scintilla/scintilla/Decoration.cxx
@@ -28,7 +28,7 @@ Decoration::~Decoration() {
}
bool Decoration::Empty() {
- return rs.starts->Partitions() == 1;
+ return rs.Runs() == 1;
}
DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0),
@@ -126,9 +126,13 @@ bool DecorationList::FillRange(int &position, int value, int &fillLength) {
}
void DecorationList::InsertSpace(int position, int insertLength) {
+ const bool atEnd = position == lengthDocument;
lengthDocument += insertLength;
for (Decoration *deco=root; deco; deco = deco->next) {
deco->rs.InsertSpace(position, insertLength);
+ if (atEnd) {
+ deco->rs.FillRange(position, 0, insertLength);
+ }
}
}
diff --git a/plugins/scintilla/scintilla/Document.cxx b/plugins/scintilla/scintilla/Document.cxx
index 7b718f2..5c05aa5 100644
--- a/plugins/scintilla/scintilla/Document.cxx
+++ b/plugins/scintilla/scintilla/Document.cxx
@@ -87,10 +87,10 @@ void LexInterface::Colourise(int start, int end) {
Document::Document() {
refCount = 0;
-#ifdef __unix__
- eolMode = SC_EOL_LF;
-#else
+#ifdef _WIN32
eolMode = SC_EOL_CRLF;
+#else
+ eolMode = SC_EOL_LF;
#endif
dbcsCodePage = 0;
stylingBits = 5;
@@ -316,15 +316,18 @@ static bool IsSubordinate(int levelStart, int levelTry) {
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
}
-int Document::GetLastChild(int lineParent, int level) {
+int Document::GetLastChild(int lineParent, int level, int lastLine) {
if (level == -1)
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
int maxLine = LinesTotal();
+ int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1;
int lineMaxSubord = lineParent;
while (lineMaxSubord < maxLine - 1) {
EnsureStyledTo(LineStart(lineMaxSubord + 2));
if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1)))
break;
+ if ((lookLastLine != -1) && (lineMaxSubord >= lookLastLine) && !(GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG))
+ break;
lineMaxSubord++;
}
if (lineMaxSubord > lineParent) {
@@ -355,108 +358,74 @@ int Document::GetFoldParent(int line) {
}
}
-void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int topLine, int bottomLine) {
- int noNeedToParseBefore = Platform::Minimum(line, topLine) - 1;
- int noNeedToParseAfter = Platform::Maximum(line, bottomLine) + 1;
- int endLine = LineFromPosition(Length());
- int beginFoldBlock = noNeedToParseBefore;
- int endFoldBlock = -1;
- int beginMarginCorrectlyDrawnZone = noNeedToParseBefore;
- int endMarginCorrectlyDrawnZone = noNeedToParseAfter;
- int endOfTailOfWhiteFlag = -1; //endOfTailOfWhiteFlag points the last SC_FOLDLEVELWHITEFLAG if follow a fold block. Otherwise endOfTailOfWhiteFlag points end of fold block.
+void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int lastLine) {
int level = GetLevel(line);
- int levelNumber = -1;
- int lineLookLevel = 0;
- int lineLookLevelNumber = -1;
- int lineLook = line;
- bool beginFoldBlockFound = false;
- bool endFoldBlockFound = false;
- bool beginMarginCorrectlyDrawnZoneFound = false;
- bool endMarginCorrectlyDrawnZoneFound = false;
-
- /*******************************************************************************/
- /* search backward (beginFoldBlock & beginMarginCorrectlyDrawnZone) */
- /*******************************************************************************/
- for (endOfTailOfWhiteFlag = line; (lineLook > noNeedToParseBefore || (lineLookLevel & SC_FOLDLEVELWHITEFLAG)) && (!beginFoldBlockFound || !beginMarginCorrectlyDrawnZoneFound); --lineLook) {
- lineLookLevel = GetLevel(lineLook);
- if (levelNumber != -1) {
- lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
- if (!beginMarginCorrectlyDrawnZoneFound && (lineLookLevelNumber > levelNumber)) {
- beginMarginCorrectlyDrawnZoneFound = true;
- beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag;
- }
- //find the last space line (SC_FOLDLEVELWHITEFLAG).
- if (!beginMarginCorrectlyDrawnZoneFound && !(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) {
- endOfTailOfWhiteFlag = lineLook - 1;
- }
- if (!beginFoldBlockFound && (lineLookLevelNumber < levelNumber)) {
- beginFoldBlockFound = true;
- beginFoldBlock = lineLook;
- if (!beginMarginCorrectlyDrawnZoneFound) {
- beginMarginCorrectlyDrawnZoneFound = true;
- beginMarginCorrectlyDrawnZone = lineLook - 1;
+ int lookLastLine = Platform::Maximum(line, lastLine) + 1;
+
+ int lookLine = line;
+ int lookLineLevel = level;
+ int lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
+ while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) ||
+ ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))))) {
+ lookLineLevel = GetLevel(--lookLine);
+ lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
+ }
+
+ int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine);
+ if (beginFoldBlock == -1) {
+ highlightDelimiter.Clear();
+ return;
+ }
+
+ int endFoldBlock = GetLastChild(beginFoldBlock, -1, lookLastLine);
+ int firstChangeableLineBefore = -1;
+ if (endFoldBlock < line) {
+ lookLine = beginFoldBlock - 1;
+ lookLineLevel = GetLevel(lookLine);
+ lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
+ while ((lookLine >= 0) && (lookLineLevelNum >= SC_FOLDLEVELBASE)) {
+ if (lookLineLevel & SC_FOLDLEVELHEADERFLAG) {
+ if (GetLastChild(lookLine, -1, lookLastLine) == line) {
+ beginFoldBlock = lookLine;
+ endFoldBlock = line;
+ firstChangeableLineBefore = line - 1;
}
- } else if (!beginFoldBlockFound && lineLookLevelNumber == SC_FOLDLEVELBASE) {
- beginFoldBlockFound = true;
- beginFoldBlock = -1;
- }
- } else if (!(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) {
- endOfTailOfWhiteFlag = lineLook - 1;
- levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
- if (lineLookLevel & SC_FOLDLEVELHEADERFLAG &&
- //Managed the folding block when a fold header does not have any subordinate lines to fold away.
- (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) {
- beginFoldBlockFound = true;
- beginFoldBlock = lineLook;
- beginMarginCorrectlyDrawnZoneFound = true;
- beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag;
- levelNumber = GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK;;
}
+ if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && ((GetLevel(lookLine - 1) & SC_FOLDLEVELNUMBERMASK) > lookLineLevelNum))
+ break;
+ lookLineLevel = GetLevel(--lookLine);
+ lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
}
}
-
- /****************************************************************************/
- /* search forward (endStartBlock & endMarginCorrectlyDrawnZone) */
- /****************************************************************************/
- if (level & SC_FOLDLEVELHEADERFLAG) {
- //ignore this line because this line is on first one of block.
- lineLook = line + 1;
- } else {
- lineLook = line;
- }
- for (; lineLook < noNeedToParseAfter && (!endFoldBlockFound || !endMarginCorrectlyDrawnZoneFound); ++lineLook) {
- lineLookLevel = GetLevel(lineLook);
- lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
- if (!endFoldBlockFound && !(lineLookLevel & SC_FOLDLEVELWHITEFLAG) && lineLookLevelNumber < levelNumber) {
- endFoldBlockFound = true;
- endFoldBlock = lineLook - 1;
- if (!endMarginCorrectlyDrawnZoneFound) {
- endMarginCorrectlyDrawnZoneFound = true;
- endMarginCorrectlyDrawnZone = lineLook;
+ if (firstChangeableLineBefore == -1) {
+ for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
+ lookLine >= beginFoldBlock;
+ lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) {
+ if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > (level & SC_FOLDLEVELNUMBERMASK))) {
+ firstChangeableLineBefore = lookLine;
+ break;
}
- } else if (!endFoldBlockFound && lineLookLevel == SC_FOLDLEVELBASE) {
- endFoldBlockFound = true;
- endFoldBlock = -1;
- }
- if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG) &&
- //Managed the folding block when a fold header does not have any subordinate lines to fold away.
- (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) {
- endMarginCorrectlyDrawnZoneFound = true;
- endMarginCorrectlyDrawnZone = lineLook;
}
}
- if (!endFoldBlockFound && ((lineLook > endLine && lineLookLevelNumber < levelNumber) ||
- (levelNumber > SC_FOLDLEVELBASE))) {
- //manage when endfold is incorrect or on last line.
- endFoldBlock = lineLook - 1;
- //useless to set endMarginCorrectlyDrawnZone.
- //if endMarginCorrectlyDrawnZoneFound equals false then endMarginCorrectlyDrawnZone already equals to endLine + 1.
+ if (firstChangeableLineBefore == -1)
+ firstChangeableLineBefore = beginFoldBlock - 1;
+
+ int firstChangeableLineAfter = -1;
+ for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
+ lookLine <= endFoldBlock;
+ lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) {
+ if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))) {
+ firstChangeableLineAfter = lookLine;
+ break;
+ }
}
+ if (firstChangeableLineAfter == -1)
+ firstChangeableLineAfter = endFoldBlock + 1;
highlightDelimiter.beginFoldBlock = beginFoldBlock;
highlightDelimiter.endFoldBlock = endFoldBlock;
- highlightDelimiter.beginMarginCorrectlyDrawnZone = beginMarginCorrectlyDrawnZone;
- highlightDelimiter.endMarginCorrectlyDrawnZone = endMarginCorrectlyDrawnZone;
+ highlightDelimiter.firstChangeableLineBefore = firstChangeableLineBefore;
+ highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter;
}
int Document::ClampPositionIntoDocument(int pos) {
@@ -693,7 +662,8 @@ bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const {
case 932:
// Shift_jis
return ((uch >= 0x81) && (uch <= 0x9F)) ||
- ((uch >= 0xE0) && (uch <= 0xEF));
+ ((uch >= 0xE0) && (uch <= 0xFC));
+ // Lead bytes F0 to FC may be a Microsoft addition.
case 936:
// GBK
return (uch >= 0x81) && (uch <= 0xFE);
@@ -986,7 +956,7 @@ bool Document::InsertChar(int pos, char ch) {
* Insert a null terminated string.
*/
bool Document::InsertCString(int position, const char *s) {
- return InsertString(position, s, strlen(s));
+ return InsertString(position, s, static_cast<int>(strlen(s)));
}
void Document::ChangeChar(int pos, char ch) {
@@ -1143,17 +1113,17 @@ void Document::Indent(bool forwards, int lineBottom, int lineTop) {
// Convert line endings for a piece of text to a particular mode.
// Stop at len or when a NUL is found.
// Caller must delete the returned pointer.
-char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode) {
+char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted) {
char *dest = new char[2 * len + 1];
const char *sptr = s;
char *dptr = dest;
for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) {
if (*sptr == '\n' || *sptr == '\r') {
- if (eolMode == SC_EOL_CR) {
+ if (eolModeWanted == SC_EOL_CR) {
*dptr++ = '\r';
- } else if (eolMode == SC_EOL_LF) {
+ } else if (eolModeWanted == SC_EOL_LF) {
*dptr++ = '\n';
- } else { // eolMode == SC_EOL_CRLF
+ } else { // eolModeWanted == SC_EOL_CRLF
*dptr++ = '\r';
*dptr++ = '\n';
}
@@ -1385,7 +1355,7 @@ size_t Document::ExtractChar(int pos, char *bytes) {
size_t widthChar = UTF8CharLength(ch);
bytes[0] = ch;
for (size_t i=1; i<widthChar; i++) {
- bytes[i] = cb.CharAt(pos+i);
+ bytes[i] = cb.CharAt(static_cast<int>(pos+i));
if (!GoodTrailByte(static_cast<unsigned char>(bytes[i]))) { // Bad byte
widthChar = 1;
}
@@ -1458,7 +1428,6 @@ long Document::FindText(int minPos, int maxPos, const char *search,
// Compute actual search ranges needed
const int lengthFind = (*length == -1) ? static_cast<int>(strlen(search)) : *length;
- const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
const int limitPos = Platform::Maximum(startPos, endPos);
@@ -1468,6 +1437,7 @@ long Document::FindText(int minPos, int maxPos, const char *search,
pos = NextPosition(pos, increment);
}
if (caseSensitive) {
+ const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
bool found = (pos + lengthFind) <= limitPos;
for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) {
@@ -1483,8 +1453,9 @@ long Document::FindText(int minPos, int maxPos, const char *search,
const size_t maxBytesCharacter = 4;
const size_t maxFoldingExpansion = 4;
std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
- const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
- while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+ const int lenSearch = static_cast<int>(
+ pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
+ while (forward ? (pos < endPos) : (pos >= endPos)) {
int widthFirstCharacter = 0;
int indexDocument = 0;
int indexSearch = 0;
@@ -1494,11 +1465,13 @@ long Document::FindText(int minPos, int maxPos, const char *search,
(indexSearch < lenSearch)) {
char bytes[maxBytesCharacter + 1];
bytes[maxBytesCharacter] = 0;
- const int widthChar = ExtractChar(pos + indexDocument, bytes);
+ const int widthChar = static_cast<int>(ExtractChar(pos + indexDocument, bytes));
if (!widthFirstCharacter)
widthFirstCharacter = widthChar;
+ if ((pos + indexDocument + widthChar) > limitPos)
+ break;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
- const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
+ const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
// Does folded match the buffer
characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
@@ -1522,8 +1495,9 @@ long Document::FindText(int minPos, int maxPos, const char *search,
const size_t maxBytesCharacter = 2;
const size_t maxFoldingExpansion = 4;
std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
- const int lenSearch = pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
- while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+ const int lenSearch = static_cast<int>(
+ pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
+ while (forward ? (pos < endPos) : (pos >= endPos)) {
int indexDocument = 0;
int indexSearch = 0;
bool characterMatches = true;
@@ -1535,8 +1509,10 @@ long Document::FindText(int minPos, int maxPos, const char *search,
const int widthChar = IsDBCSLeadByte(bytes[0]) ? 2 : 1;
if (widthChar == 2)
bytes[1] = cb.CharAt(pos + indexDocument + 1);
+ if ((pos + indexDocument + widthChar) > limitPos)
+ break;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
- const int lenFlat = pcf->Fold(folded, sizeof(folded), bytes, widthChar);
+ const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
// Does folded match the buffer
characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat);
@@ -1553,7 +1529,7 @@ long Document::FindText(int minPos, int maxPos, const char *search,
break;
}
} else {
- CaseFolderTable caseFolder;
+ const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
std::vector<char> searchThing(lengthFind + 1);
pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
@@ -2113,6 +2089,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
+ char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line);
@@ -2124,7 +2101,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
startOfLine = startPos;
}
if (line == lineRangeEnd) {
- if ((endPos != endOfLine) && (searchEnd == '$'))
+ if ((endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
@@ -2135,7 +2112,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
startOfLine = endPos;
}
if (line == lineRangeStart) {
- if ((startPos != endOfLine) && (searchEnd == '$'))
+ if ((startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}
diff --git a/plugins/scintilla/scintilla/Document.h b/plugins/scintilla/scintilla/Document.h
index 7858db7..00d23a4 100644
--- a/plugins/scintilla/scintilla/Document.h
+++ b/plugins/scintilla/scintilla/Document.h
@@ -117,42 +117,41 @@ struct StyledText {
class HighlightDelimiter {
public:
- HighlightDelimiter() {
+ HighlightDelimiter() : isEnabled(false) {
+ Clear();
+ }
+
+ void Clear() {
beginFoldBlock = -1;
endFoldBlock = -1;
- beginMarginCorrectlyDrawnZone = -1;
- endMarginCorrectlyDrawnZone = -1;
- isEnabled = false;
+ firstChangeableLineBefore = -1;
+ firstChangeableLineAfter = -1;
}
bool NeedsDrawing(int line) {
- return isEnabled && (line <= beginMarginCorrectlyDrawnZone || endMarginCorrectlyDrawnZone <= line);
+ return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter);
}
- bool isCurrentBlockHighlight(int line) {
+ bool IsFoldBlockHighlighted(int line) {
return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock;
}
- bool isHeadBlockFold(int line) {
+ bool IsHeadOfFoldBlock(int line) {
return beginFoldBlock == line && line < endFoldBlock;
}
- bool isBodyBlockFold(int line) {
+ bool IsBodyOfFoldBlock(int line) {
return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock;
}
- bool isTailBlockFold(int line) {
+ bool IsTailOfFoldBlock(int line) {
return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock;
}
- // beginFoldBlock : Begin of current fold block.
- // endStartBlock : End of current fold block.
- // beginMarginCorrectlyDrawnZone : Begin of zone where margin is correctly drawn.
- // endMarginCorrectlyDrawnZone : End of zone where margin is correctly drawn.
- int beginFoldBlock;
- int endFoldBlock;
- int beginMarginCorrectlyDrawnZone;
- int endMarginCorrectlyDrawnZone;
+ int beginFoldBlock; // Begin of current fold block
+ int endFoldBlock; // End of current fold block
+ int firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block
+ int firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block
bool isEnabled;
};
@@ -304,7 +303,7 @@ public:
int GetColumn(int position);
int FindColumn(int line, int column);
void Indent(bool forwards, int lineBottom, int lineTop);
- static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode);
+ static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted);
void ConvertLineEnds(int eolModeSet);
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
bool IsReadOnly() { return cb.IsReadOnly(); }
@@ -339,9 +338,9 @@ public:
int SCI_METHOD SetLevel(int line, int level);
int SCI_METHOD GetLevel(int line) const;
void ClearLevels();
- int GetLastChild(int lineParent, int level=-1);
+ int GetLastChild(int lineParent, int level=-1, int lastLine=-1);
int GetFoldParent(int line);
- void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int topLine, int bottomLine);
+ void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine);
void Indent(bool forwards);
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
diff --git a/plugins/scintilla/scintilla/Editor.cxx b/plugins/scintilla/scintilla/Editor.cxx
index d1d0e7f..7dbaa36 100644
--- a/plugins/scintilla/scintilla/Editor.cxx
+++ b/plugins/scintilla/scintilla/Editor.cxx
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include <map>
#include <algorithm>
#include <memory>
@@ -131,7 +132,7 @@ Editor::Editor() {
selectionType = selChar;
lastXChosen = 0;
- lineAnchor = 0;
+ lineAnchorPos = 0;
originalAnchorPos = 0;
wordSelectAnchorStartPos = 0;
wordSelectAnchorEndPos = 0;
@@ -144,6 +145,9 @@ Editor::Editor() {
caretYPolicy = CARET_EVEN;
caretYSlop = 0;
+
+ visiblePolicy = 0;
+ visibleSlop = 0;
searchAnchor = 0;
@@ -156,6 +160,7 @@ Editor::Editor() {
verticalScrollBarVisible = true;
endAtLastLine = true;
caretSticky = SC_CARETSTICKY_OFF;
+ marginOptions = SC_MARGINOPTION_NONE;
multipleSelection = false;
additionalSelectionTyping = false;
multiPasteMode = SC_MULTIPASTE_ONCE;
@@ -1607,8 +1612,10 @@ void Editor::LinesSplit(int pixelWidth) {
unsigned int posLineStart = pdoc->LineStart(line);
LayoutLine(line, surface, vs, ll, pixelWidth);
for (int subLine = 1; subLine < ll->lines; subLine++) {
- pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) +
- ll->LineStart(subLine), eol);
+ pdoc->InsertCString(
+ static_cast<int>(posLineStart + (subLine - 1) * strlen(eol) +
+ ll->LineStart(subLine)),
+ eol);
targetEnd += static_cast<int>(strlen(eol));
}
}
@@ -1651,7 +1658,8 @@ static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset,
size_t endSegment = start;
while ((endSegment+1 < len) && (static_cast<size_t>(styles[endSegment+1]) == style))
endSegment++;
- width += surface->WidthText(vs.styles[style+styleOffset].font, text + start, endSegment - start + 1);
+ width += surface->WidthText(vs.styles[style+styleOffset].font, text + start,
+ static_cast<int>(endSegment - start + 1));
start = endSegment + 1;
}
return width;
@@ -1666,7 +1674,8 @@ static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, con
if (st.multipleStyles) {
widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine);
} else {
- widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font, st.text + start, lenLine);
+ widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font,
+ st.text + start, static_cast<int>(lenLine));
}
if (widthSubLine > widthMax)
widthMax = widthSubLine;
@@ -1687,21 +1696,24 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle
while (end < length-1 && st.styles[start+end+1] == style)
end++;
style += styleOffset;
- int width = surface->WidthText(vs.styles[style].font, st.text + start + i, end - i + 1);
+ int width = surface->WidthText(vs.styles[style].font,
+ st.text + start + i, static_cast<int>(end - i + 1));
PRectangle rcSegment = rcText;
rcSegment.left = x;
rcSegment.right = x + width + 1;
surface->DrawTextNoClip(rcSegment, vs.styles[style].font,
- ascent, st.text + start + i, end - i + 1,
+ ascent, st.text + start + i,
+ static_cast<int>(end - i + 1),
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
x += width;
i = end + 1;
}
} else {
- int style = st.style + styleOffset;
+ size_t style = st.style + styleOffset;
surface->DrawTextNoClip(rcText, vs.styles[style].font,
- rcText.top + vs.maxAscent, st.text + start, length,
+ rcText.top + vs.maxAscent, st.text + start,
+ static_cast<int>(length),
vs.styles[style].fore.allocated,
vs.styles[style].back.allocated);
}
@@ -1734,13 +1746,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
- /* alternate scheme:
- if (vs.ms[margin].mask & SC_MASK_FOLDERS)
- surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
- else
- // Required because of special way brush is created for selection margin
- surface->FillRectangle(rcSelMargin, pixmapSelPattern);
- */
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
surface->FillRectangle(rcSelMargin, *pixmapSelPattern);
@@ -1769,24 +1774,25 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
// lessening of fold level which implies a 'fold tail' but which should not
// be displayed until the last of a sequence of whitespace.
bool needWhiteClosure = false;
- int level = pdoc->GetLevel(cs.DocFromDisplay(topLine));
- if (level & SC_FOLDLEVELWHITEFLAG) {
- int lineBack = cs.DocFromDisplay(topLine);
- int levelPrev = level;
- while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) {
- lineBack--;
- levelPrev = pdoc->GetLevel(lineBack);
+ if (vs.ms[margin].mask & SC_MASK_FOLDERS) {
+ int level = pdoc->GetLevel(cs.DocFromDisplay(topLine));
+ if (level & SC_FOLDLEVELWHITEFLAG) {
+ int lineBack = cs.DocFromDisplay(topLine);
+ int levelPrev = level;
+ while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) {
+ lineBack--;
+ levelPrev = pdoc->GetLevel(lineBack);
+ }
+ if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
+ if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
+ needWhiteClosure = true;
+ }
}
- if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
- if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
- needWhiteClosure = true;
+ if (highlightDelimiter.isEnabled) {
+ int lastLine = cs.DocFromDisplay(topLine + LinesOnScreen()) + 1;
+ pdoc->GetHighlightDelimiters(highlightDelimiter, pdoc->LineFromPosition(CurrentPosition()), lastLine);
}
}
- if (highlightDelimiter.isEnabled && (vs.ms[margin].mask & SC_MASK_FOLDERS)) {
- int lineBack = cs.DocFromDisplay(topLine);
- int lineFront = cs.DocFromDisplay(((rcMargin.bottom - rcMargin.top) / vs.lineHeight) + topLine) + 1;
- pdoc->GetHighlightDelimiters(highlightDelimiter, pdoc->LineFromPosition(CurrentPosition()), lineBack, lineFront);
- }
// Old code does not know about new markers needed to distinguish all cases
int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID,
@@ -1802,85 +1808,103 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
bool firstSubLine = visibleLine == cs.DisplayFromDoc(lineDoc);
bool lastSubLine = visibleLine == (cs.DisplayFromDoc(lineDoc + 1) - 1);
- // Decide which fold indicator should be displayed
- level = pdoc->GetLevel(lineDoc);
- int levelNext = pdoc->GetLevel(lineDoc + 1);
int marks = pdoc->GetMark(lineDoc);
if (!firstSubLine)
marks = 0;
- int levelNum = level & SC_FOLDLEVELNUMBERMASK;
- int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
- if (level & SC_FOLDLEVELHEADERFLAG) {
- if (firstSubLine) {
- if (levelNum < levelNextNum) {
- if (cs.GetExpanded(lineDoc)) {
- if (levelNum == SC_FOLDLEVELBASE)
- marks |= 1 << SC_MARKNUM_FOLDEROPEN;
- else
- marks |= 1 << folderOpenMid;
- } else {
- if (levelNum == SC_FOLDLEVELBASE)
- marks |= 1 << SC_MARKNUM_FOLDER;
- else
- marks |= 1 << folderEnd;
- }
- } else if (levelNum > SC_FOLDLEVELBASE) {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
- }
- } else {
- if (levelNum < levelNextNum) {
- if (cs.GetExpanded(lineDoc)) {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
+
+ bool headWithTail = false;
+
+ if (vs.ms[margin].mask & SC_MASK_FOLDERS) {
+ // Decide which fold indicator should be displayed
+ int level = pdoc->GetLevel(lineDoc);
+ int levelNext = pdoc->GetLevel(lineDoc + 1);
+ int levelNum = level & SC_FOLDLEVELNUMBERMASK;
+ int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
+ if (level & SC_FOLDLEVELHEADERFLAG) {
+ if (firstSubLine) {
+ if (levelNum < levelNextNum) {
+ if (cs.GetExpanded(lineDoc)) {
+ if (levelNum == SC_FOLDLEVELBASE)
+ marks |= 1 << SC_MARKNUM_FOLDEROPEN;
+ else
+ marks |= 1 << folderOpenMid;
+ } else {
+ if (levelNum == SC_FOLDLEVELBASE)
+ marks |= 1 << SC_MARKNUM_FOLDER;
+ else
+ marks |= 1 << folderEnd;
+ }
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
- }
- } else if (levelNum > SC_FOLDLEVELBASE) {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
- }
- }
- needWhiteClosure = false;
- } else if (level & SC_FOLDLEVELWHITEFLAG) {
- if (needWhiteClosure) {
- if (levelNext & SC_FOLDLEVELWHITEFLAG) {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
- } else if (levelNum > SC_FOLDLEVELBASE) {
- marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
- needWhiteClosure = false;
+ }
} else {
- marks |= 1 << SC_MARKNUM_FOLDERTAIL;
- needWhiteClosure = false;
+ if (levelNum < levelNextNum) {
+ if (cs.GetExpanded(lineDoc)) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ }
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ }
}
- } else if (levelNum > SC_FOLDLEVELBASE) {
- if (levelNextNum < levelNum) {
- if (levelNextNum > SC_FOLDLEVELBASE) {
+ needWhiteClosure = false;
+ int firstFollowupLine = cs.DocFromDisplay(cs.DisplayFromDoc(lineDoc + 1));
+ int firstFollowupLineLevel = pdoc->GetLevel(firstFollowupLine);
+ int secondFollowupLineLevelNum = pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK;
+ if (!cs.GetExpanded(lineDoc)) {
+ if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) &&
+ (levelNum > secondFollowupLineLevelNum))
+ needWhiteClosure = true;
+
+ if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine))
+ headWithTail = true;
+ }
+ } else if (level & SC_FOLDLEVELWHITEFLAG) {
+ if (needWhiteClosure) {
+ if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ } else if (levelNextNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ needWhiteClosure = false;
} else {
marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ needWhiteClosure = false;
+ }
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ if (levelNextNum < levelNum) {
+ if (levelNextNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ } else {
+ marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ }
+ } else {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
- } else {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
- }
- } else if (levelNum > SC_FOLDLEVELBASE) {
- if (levelNextNum < levelNum) {
- needWhiteClosure = false;
- if (levelNext & SC_FOLDLEVELWHITEFLAG) {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
- needWhiteClosure = true;
- } else if (lastSubLine) {
- if (levelNextNum > SC_FOLDLEVELBASE) {
- marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ if (levelNextNum < levelNum) {
+ needWhiteClosure = false;
+ if (levelNext & SC_FOLDLEVELWHITEFLAG) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ needWhiteClosure = true;
+ } else if (lastSubLine) {
+ if (levelNextNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ } else {
+ marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ }
} else {
- marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
- } else {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
}
+
marks &= vs.ms[margin].mask;
+
PRectangle rcMarker = rcSelMargin;
rcMarker.top = yposScreen;
rcMarker.bottom = yposScreen + vs.lineHeight;
@@ -1926,18 +1950,23 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (marks) {
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
if (marks & 1) {
- LineMarker::typeOfFold tFold;
- if (!highlightDelimiter.isCurrentBlockHighlight(lineDoc)) {
- tFold = LineMarker::undefined;
- } else if (highlightDelimiter.isBodyBlockFold(lineDoc)) {
- tFold = LineMarker::body;
- } else if (highlightDelimiter.isHeadBlockFold(lineDoc)) {
- tFold = LineMarker::head;
- } else if (highlightDelimiter.isTailBlockFold(lineDoc)) {
- tFold = LineMarker::tail;
- } else {
- //Normally, this branch is never used. But I prefer to manage it anyway.
- tFold = LineMarker::undefined;
+ LineMarker::typeOfFold tFold = LineMarker::undefined;
+ if ((vs.ms[margin].mask & SC_MASK_FOLDERS) && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) {
+ if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) {
+ tFold = LineMarker::body;
+ } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) {
+ if (firstSubLine) {
+ tFold = headWithTail ? LineMarker::headWithTail : LineMarker::head;
+ } else {
+ if (cs.GetExpanded(lineDoc) || headWithTail) {
+ tFold = LineMarker::body;
+ } else {
+ tFold = LineMarker::undefined;
+ }
+ }
+ } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) {
+ tFold = LineMarker::tail;
+ }
}
vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font, tFold);
}
@@ -2362,10 +2391,12 @@ ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackgroun
return vsDraw.edgecolour.allocated;
if (inHotspot && vsDraw.hotspotBackgroundSet)
return vsDraw.hotspotBackground.allocated;
- if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD))
- return background;
}
- return vsDraw.styles[styleMain].back.allocated;
+ if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {
+ return background;
+ } else {
+ return vsDraw.styles[styleMain].back.allocated;
+ }
}
void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) {
@@ -2528,7 +2559,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
// Draw the eol-is-selected rectangle
rcSegment.left = xEol + xStart + virtualSpace + blobsWidth;
- rcSegment.right = xEol + xStart + virtualSpace + blobsWidth + vsDraw.aveCharWidth;
+ rcSegment.right = rcSegment.left + vsDraw.aveCharWidth;
if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1));
@@ -2548,7 +2579,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin
}
// Fill the remainder of the line
- rcSegment.left = xEol + xStart + virtualSpace + blobsWidth + vsDraw.aveCharWidth;
+ rcSegment.left = rcSegment.right;
if (rcSegment.left < rcLine.left)
rcSegment.left = rcLine.left;
rcSegment.right = rcLine.right;
@@ -2925,6 +2956,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = theEdge * vsDraw.spaceWidth;
rcSegment.left = edgeX + xStart;
+ if ((ll->wrapIndent != 0) && (lineStart != 0))
+ rcSegment.left -= ll->wrapIndent;
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
@@ -3928,37 +3961,50 @@ void Editor::FilterSelections() {
}
}
+static bool cmpSelPtrs(const SelectionRange *a, const SelectionRange *b) {
+ return *a < *b;
+}
+
// AddCharUTF inserts an array of bytes which may or may not be in UTF-8.
void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
FilterSelections();
{
UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike);
- for (size_t r=0; r<sel.Count(); r++) {
- if (!RangeContainsProtected(sel.Range(r).Start().Position(),
- sel.Range(r).End().Position())) {
- int positionInsert = sel.Range(r).Start().Position();
- if (!sel.Range(r).Empty()) {
- if (sel.Range(r).Length()) {
- pdoc->DeleteChars(positionInsert, sel.Range(r).Length());
- sel.Range(r).ClearVirtualSpace();
+
+ std::vector<SelectionRange *> selPtrs;
+ for (size_t r = 0; r < sel.Count(); r++) {
+ selPtrs.push_back(&sel.Range(r));
+ }
+ std::sort(selPtrs.begin(), selPtrs.end(), cmpSelPtrs);
+
+ for (std::vector<SelectionRange *>::reverse_iterator rit = selPtrs.rbegin();
+ rit != selPtrs.rend(); ++rit) {
+ SelectionRange *currentSel = *rit;
+ if (!RangeContainsProtected(currentSel->Start().Position(),
+ currentSel->End().Position())) {
+ int positionInsert = currentSel->Start().Position();
+ if (!currentSel->Empty()) {
+ if (currentSel->Length()) {
+ pdoc->DeleteChars(positionInsert, currentSel->Length());
+ currentSel->ClearVirtualSpace();
} else {
// Range is all virtual so collapse to start of virtual space
- sel.Range(r).MinimizeVirtualSpace();
+ currentSel->MinimizeVirtualSpace();
}
} else if (inOverstrike) {
if (positionInsert < pdoc->Length()) {
if (!IsEOLChar(pdoc->CharAt(positionInsert))) {
pdoc->DelChar(positionInsert);
- sel.Range(r).ClearVirtualSpace();
+ currentSel->ClearVirtualSpace();
}
}
}
- positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace());
+ positionInsert = InsertSpace(positionInsert, currentSel->caret.VirtualSpace());
if (pdoc->InsertString(positionInsert, s, len)) {
- sel.Range(r).caret.SetPosition(positionInsert + len);
- sel.Range(r).anchor.SetPosition(positionInsert + len);
+ currentSel->caret.SetPosition(positionInsert + len);
+ currentSel->anchor.SetPosition(positionInsert + len);
}
- sel.Range(r).ClearVirtualSpace();
+ currentSel->ClearVirtualSpace();
// If in wrap mode rewrap current line so EnsureCaretVisible has accurate information
if (wrapState != eWrapNone) {
AutoSurface surface(this);
@@ -4177,7 +4223,13 @@ bool Editor::CanPaste() {
void Editor::Clear() {
// If multiple selections, don't delete EOLS
if (sel.Empty()) {
- UndoGroup ug(pdoc, sel.Count() > 1);
+ bool singleVirtual = false;
+ if ((sel.Count() == 1) &&
+ !RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1) &&
+ sel.RangeMain().Start().VirtualSpace()) {
+ singleVirtual = true;
+ }
+ UndoGroup ug(pdoc, (sel.Count() > 1) || singleVirtual);
for (size_t r=0; r<sel.Count(); r++) {
if (!RangeContainsProtected(sel.Range(r).caret.Position(), sel.Range(r).caret.Position() + 1)) {
if (sel.Range(r).Start().VirtualSpace()) {
@@ -4280,6 +4332,10 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
void Editor::NotifyFocus(bool) {}
+void Editor::SetCtrlID(int identifier) {
+ ctrlID = identifier;
+}
+
void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
SCNotification scn = {0};
scn.nmhdr.code = SCN_STYLENEEDED;
@@ -4525,7 +4581,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length);
braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length);
}
- if (cs.LinesDisplayed() < cs.LinesInDoc()) {
+ if ((mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) && cs.HiddenLines()) {
// Some lines are hidden so may need shown.
// TODO: check if the modified area is hidden.
if (mh.modificationType & SC_MOD_BEFOREINSERT) {
@@ -4743,6 +4799,8 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar
case SCI_VERTICALCENTRECARET:
case SCI_MOVESELECTEDLINESUP:
case SCI_MOVESELECTEDLINESDOWN:
+ case SCI_SCROLLTOSTART:
+ case SCI_SCROLLTOEND:
break;
// Filter out all others like display changes. Also, newlines are redundant
@@ -4835,10 +4893,13 @@ void Editor::ChangeCaseOfSelection(int caseMapping) {
while (sMapped[lastDifference] == sText[lastDifference])
lastDifference--;
size_t endSame = sMapped.size() - 1 - lastDifference;
- pdoc->DeleteChars(currentNoVS.Start().Position() + firstDifference,
- rangeBytes - firstDifference - endSame);
- pdoc->InsertString(currentNoVS.Start().Position() + firstDifference,
- sMapped.c_str() + firstDifference, lastDifference - firstDifference + 1);
+ pdoc->DeleteChars(
+ static_cast<int>(currentNoVS.Start().Position() + firstDifference),
+ static_cast<int>(rangeBytes - firstDifference - endSame));
+ pdoc->InsertString(
+ static_cast<int>(currentNoVS.Start().Position() + firstDifference),
+ sMapped.c_str() + firstDifference,
+ static_cast<int>(lastDifference - firstDifference + 1));
// Automatic movement changes selection so reset to exactly the same as it was.
sel.Range(r) = current;
}
@@ -5479,6 +5540,12 @@ int Editor::KeyCommand(unsigned int iMessage) {
StartEndDisplayLine(sel.MainCaret(), false), 1), Selection::selStream);
SetLastXChosen();
break;
+ case SCI_SCROLLTOSTART:
+ ScrollTo(0);
+ break;
+ case SCI_SCROLLTOEND:
+ ScrollTo(MaxScrollPos());
+ break;
}
return 0;
}
@@ -5487,10 +5554,8 @@ int Editor::KeyDefault(int, int) {
return 0;
}
-int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) {
+int Editor::KeyDownWithModifiers(int key, int modifiers, bool *consumed) {
DwellEnd(false);
- int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
- (alt ? SCI_ALT : 0);
int msg = kmap.Find(key, modifiers);
if (msg) {
if (consumed)
@@ -5503,6 +5568,12 @@ int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) {
}
}
+int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) {
+ int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
+ (alt ? SCI_ALT : 0);
+ return KeyDownWithModifiers(key, modifiers, consumed);
+}
+
void Editor::SetWhitespaceVisible(int view) {
vs.viewWhitespace = static_cast<WhiteSpaceVisibility>(view);
}
@@ -5775,7 +5846,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
int end = pdoc->LineEnd(currentLine);
char *text = CopyRange(start, end);
- int textLen = text ? strlen(text) : 0;
+ size_t textLen = text ? strlen(text) : 0;
// include room for \r\n\0
textLen += 3;
char *textWithEndl = new char[textLen];
@@ -5786,7 +5857,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
strncat(textWithEndl, "\r", textLen);
if (pdoc->eolMode != SC_EOL_CR)
strncat(textWithEndl, "\n", textLen);
- ss->Set(textWithEndl, strlen(textWithEndl) + 1,
+ ss->Set(textWithEndl, static_cast<int>(strlen(textWithEndl) + 1),
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, true);
delete []text;
}
@@ -5799,7 +5870,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
delimiterLength = 1;
}
}
- int size = sel.Length() + delimiterLength * sel.Count();
+ size_t size = sel.Length() + delimiterLength * sel.Count();
char *text = new char[size + 1];
int j = 0;
std::vector<SelectionRange> rangesInOrder = sel.RangesCopy();
@@ -5822,7 +5893,7 @@ void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) {
}
}
text[size] = '\0';
- ss->Set(text, size + 1, pdoc->dbcsCodePage,
+ ss->Set(text, static_cast<int>(size + 1), pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, sel.IsRectangular(), sel.selType == Selection::selLines);
}
}
@@ -5948,21 +6019,21 @@ bool Editor::PositionInSelection(int pos) {
}
bool Editor::PointInSelection(Point pt) {
- SelectionPosition pos = SPositionFromLocation(pt);
- int xPos = XFromPosition(pos);
+ SelectionPosition pos = SPositionFromLocation(pt, false, true);
+ Point ptPos = LocationFromPosition(pos);
for (size_t r=0; r<sel.Count(); r++) {
SelectionRange range = sel.Range(r);
if (range.Contains(pos)) {
bool hit = true;
if (pos == range.Start()) {
// see if just before selection
- if (pt.x < xPos) {
+ if (pt.x < ptPos.x) {
hit = false;
}
}
if (pos == range.End()) {
// see if just after selection
- if (pt.x > xPos) {
+ if (pt.x > ptPos.x) {
hit = false;
}
}
@@ -5994,17 +6065,37 @@ Window::Cursor Editor::GetMarginCursor(Point pt) {
return Window::cursorReverseArrow;
}
-void Editor::LineSelection(int lineCurrent_, int lineAnchor_) {
- if (lineAnchor_ < lineCurrent_) {
- SetSelection(pdoc->LineStart(lineCurrent_ + 1),
- pdoc->LineStart(lineAnchor_));
- } else if (lineAnchor_ > lineCurrent_) {
- SetSelection(pdoc->LineStart(lineCurrent_),
- pdoc->LineStart(lineAnchor_ + 1));
- } else { // Same line, select it
- SetSelection(pdoc->LineStart(lineAnchor_ + 1),
- pdoc->LineStart(lineAnchor_));
+void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine) {
+ int selCurrentPos, selAnchorPos;
+ if (wholeLine) {
+ int lineCurrent_ = pdoc->LineFromPosition(lineCurrentPos_);
+ int lineAnchor_ = pdoc->LineFromPosition(lineAnchorPos_);
+ if (lineAnchorPos_ < lineCurrentPos_) {
+ selCurrentPos = pdoc->LineStart(lineCurrent_ + 1);
+ selAnchorPos = pdoc->LineStart(lineAnchor_);
+ } else if (lineAnchorPos_ > lineCurrentPos_) {
+ selCurrentPos = pdoc->LineStart(lineCurrent_);
+ selAnchorPos = pdoc->LineStart(lineAnchor_ + 1);
+ } else { // Same line, select it
+ selCurrentPos = pdoc->LineStart(lineAnchor_ + 1);
+ selAnchorPos = pdoc->LineStart(lineAnchor_);
+ }
+ } else {
+ if (lineAnchorPos_ < lineCurrentPos_) {
+ selCurrentPos = StartEndDisplayLine(lineCurrentPos_, false) + 1;
+ selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1);
+ selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true);
+ } else if (lineAnchorPos_ > lineCurrentPos_) {
+ selCurrentPos = StartEndDisplayLine(lineCurrentPos_, true);
+ selAnchorPos = StartEndDisplayLine(lineAnchorPos_, false) + 1;
+ selAnchorPos = pdoc->MovePositionOutsideChar(selAnchorPos, 1);
+ } else { // Same line, select it
+ selCurrentPos = StartEndDisplayLine(lineAnchorPos_, false) + 1;
+ selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1);
+ selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true);
+ }
}
+ SetSelection(selCurrentPos, selAnchorPos);
}
void Editor::WordSelection(int pos) {
@@ -6084,10 +6175,20 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
selectionType = selWord;
doubleClick = true;
} else if (selectionType == selWord) {
- selectionType = selLine;
+ // Since we ended up here, we're inside a *triple* click, which should always select
+ // whole line irregardless of word wrap being enabled or not.
+ selectionType = selWholeLine;
} else {
- selectionType = selChar;
- originalAnchorPos = sel.MainCaret();
+ if (inSelMargin) {
+ // Selection type is either selSubLine or selWholeLine here and we're inside margin.
+ // If it is selSubLine, we're inside a *double* click and word wrap is enabled,
+ // so we switch to selWholeLine in order to select whole line.
+ if (selectionType == selSubLine)
+ selectionType = selWholeLine;
+ } else {
+ selectionType = selChar;
+ originalAnchorPos = sel.MainCaret();
+ }
}
}
@@ -6119,9 +6220,9 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
wordSelectAnchorEndPos = endWord;
wordSelectInitialCaretPos = sel.MainCaret();
WordSelection(wordSelectInitialCaretPos);
- } else if (selectionType == selLine) {
- lineAnchor = LineFromLocation(pt);
- SetSelection(pdoc->LineStart(lineAnchor + 1), pdoc->LineStart(lineAnchor));
+ } else if (selectionType == selSubLine || selectionType == selWholeLine) {
+ lineAnchorPos = newPos.Position();
+ LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine);
//Platform::DebugPrintf("Triple click: %d - %d\n", anchor, currentPos);
} else {
SetEmptySelection(sel.MainCaret());
@@ -6141,25 +6242,27 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b
return;
}
if (!shift) {
- lineAnchor = LineFromLocation(pt);
- // Single click in margin: select whole line
- LineSelection(lineAnchor, lineAnchor);
- SetSelection(pdoc->LineStart(lineAnchor + 1),
- pdoc->LineStart(lineAnchor));
+ // Single click in margin: select whole line or only subline if word wrap is enabled
+ lineAnchorPos = newPos.Position();
+ selectionType = ((wrapState != eWrapNone) && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine;
+ LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine);
} else {
// Single shift+click in margin: select from line anchor to clicked line
if (sel.MainAnchor() > sel.MainCaret())
- lineAnchor = pdoc->LineFromPosition(sel.MainAnchor() - 1);
+ lineAnchorPos = sel.MainAnchor() - 1;
else
- lineAnchor = pdoc->LineFromPosition(sel.MainAnchor());
- int lineStart = LineFromLocation(pt);
- LineSelection(lineStart, lineAnchor);
- //lineAnchor = lineStart; // Keep the same anchor for ButtonMove
+ lineAnchorPos = sel.MainAnchor();
+ // Reset selection type if there is an empty selection.
+ // This ensures that we don't end up stuck in previous selection mode, which is no longer valid.
+ // Otherwise, if there's a non empty selection, reset selection type only if it differs from selSubLine and selWholeLine.
+ // This ensures that we continue selecting in the same selection mode.
+ if (sel.Empty() || (selectionType != selSubLine && selectionType != selWholeLine))
+ selectionType = ((wrapState != eWrapNone) && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine;
+ LineSelection(newPos.Position(), lineAnchorPos, selectionType == selWholeLine);
}
SetDragPosition(SelectionPosition(invalidPosition));
SetMouseCapture(true);
- selectionType = selLine;
} else {
if (PointIsHotspot(pt)) {
NotifyHotSpotClicked(newPos.Position(), shift, ctrl, alt);
@@ -6317,23 +6420,18 @@ void Editor::ButtonMove(Point pt) {
}
} else {
// Continue selecting by line
- int lineMove = LineFromLocation(pt);
- LineSelection(lineMove, lineAnchor);
+ LineSelection(movePos.Position(), lineAnchorPos, selectionType == selWholeLine);
}
}
// Autoscroll
PRectangle rcClient = GetClientRectangle();
+ int lineMove = DisplayFromPosition(movePos.Position());
if (pt.y > rcClient.bottom) {
- int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
- if (lineMove < 0) {
- lineMove = cs.DisplayFromDoc(pdoc->LinesTotal() - 1);
- }
ScrollTo(lineMove - LinesOnScreen() + 1);
Redraw();
} else if (pt.y < rcClient.top) {
- int lineMove = cs.DisplayFromDoc(LineFromLocation(pt));
- ScrollTo(lineMove - 1);
+ ScrollTo(lineMove);
Redraw();
}
EnsureCaretVisible(false, false, true);
@@ -6746,7 +6844,12 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
WrapLines(true, -1);
if (!cs.GetVisible(lineDoc)) {
- int lineParent = pdoc->GetFoldParent(lineDoc);
+ int lookLine = lineDoc;
+ int lookLineLevel = pdoc->GetLevel(lookLine);
+ while ((lookLine > 0) && (lookLineLevel & SC_FOLDLEVELWHITEFLAG)) {
+ lookLineLevel = pdoc->GetLevel(--lookLine);
+ }
+ int lineParent = pdoc->GetFoldParent(lookLine);
if (lineParent >= 0) {
if (lineDoc != lineParent)
EnsureLineVisible(lineParent, enforcePolicy);
@@ -6842,9 +6945,9 @@ int Editor::WrapCount(int line) {
void Editor::AddStyledText(char *buffer, int appendLength) {
// The buffer consists of alternating character bytes and style bytes
- size_t textLength = appendLength / 2;
+ int textLength = appendLength / 2;
char *text = new char[textLength];
- size_t i;
+ int i;
for (i = 0; i < textLength; i++) {
text[i] = buffer[i*2];
}
@@ -6952,7 +7055,7 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar
}
sptr_t Editor::StringResult(sptr_t lParam, const char *val) {
- const int n = strlen(val);
+ const size_t n = strlen(val);
if (lParam != 0) {
char *ptr = reinterpret_cast<char *>(lParam);
strcpy(ptr, val);
@@ -7428,6 +7531,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETSELECTIONEND:
return sel.LimitsForRectangularElseMain().end.Position();
+ case SCI_SETEMPTYSELECTION:
+ SetEmptySelection(wParam);
+ break;
+
case SCI_SETPRINTMAGNIFICATION:
printMagnification = wParam;
break;
@@ -7786,8 +7893,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return endAtLastLine;
case SCI_SETCARETSTICKY:
- PLATFORM_ASSERT((wParam >= SC_CARETSTICKY_OFF) && (wParam <= SC_CARETSTICKY_WHITESPACE));
- if ((wParam >= SC_CARETSTICKY_OFF) && (wParam <= SC_CARETSTICKY_WHITESPACE)) {
+ PLATFORM_ASSERT(wParam <= SC_CARETSTICKY_WHITESPACE);
+ if (wParam <= SC_CARETSTICKY_WHITESPACE) {
caretSticky = wParam;
}
break;
@@ -7951,6 +8058,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
RedrawSelMargin();
break;
+ case SCI_RGBAIMAGESETWIDTH:
+ sizeRGBAImage.x = wParam;
+ break;
+
+ case SCI_RGBAIMAGESETHEIGHT:
+ sizeRGBAImage.y = wParam;
+ break;
+
+ case SCI_MARKERDEFINERGBAIMAGE:
+ if (wParam <= MARKER_MAX) {
+ vs.markers[wParam].SetRGBAImage(sizeRGBAImage, reinterpret_cast<unsigned char *>(lParam));
+ };
+ InvalidateStyleData();
+ RedrawSelMargin();
+ break;
+
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
vs.ms[wParam].style = lParam;
@@ -8243,7 +8366,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.caretcolour.desired.AsLong();
case SCI_SETCARETSTYLE:
- if (wParam >= CARETSTYLE_INVISIBLE && wParam <= CARETSTYLE_BLOCK)
+ if (wParam <= CARETSTYLE_BLOCK)
vs.caretStyle = wParam;
else
/* Default to the line caret */
@@ -8255,7 +8378,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.caretStyle;
case SCI_SETCARETWIDTH:
- if (wParam <= 0)
+ if (static_cast<int>(wParam) <= 0)
vs.caretWidth = 0;
else if (wParam >= 3)
vs.caretWidth = 3;
@@ -8394,6 +8517,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_DOCUMENTSTARTEXTEND:
case SCI_DOCUMENTEND:
case SCI_DOCUMENTENDEXTEND:
+ case SCI_SCROLLTOSTART:
+ case SCI_SCROLLTOEND:
case SCI_STUTTEREDPAGEUP:
case SCI_STUTTEREDPAGEUPEXTEND:
@@ -8748,6 +8873,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_MARGINGETSTYLEOFFSET:
return vs.marginStyleOffset;
+ case SCI_SETMARGINOPTIONS:
+ marginOptions = wParam;
+ break;
+
+ case SCI_GETMARGINOPTIONS:
+ return marginOptions;
+
case SCI_MARGINSETTEXT:
pdoc->MarginSetText(wParam, CharPtrFromSPtr(lParam));
break;
@@ -9062,6 +9194,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_CHANGELEXERSTATE:
pdoc->ChangeLexerState(wParam, lParam);
break;
+
+ case SCI_SETIDENTIFIER:
+ SetCtrlID(wParam);
+ break;
+
+ case SCI_GETIDENTIFIER:
+ return GetCtrlID();
default:
return DefWndProc(iMessage, wParam, lParam);
diff --git a/plugins/scintilla/scintilla/Editor.h b/plugins/scintilla/scintilla/Editor.h
index 5c01ee8..f1a500b 100644
--- a/plugins/scintilla/scintilla/Editor.h
+++ b/plugins/scintilla/scintilla/Editor.h
@@ -131,6 +131,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
* When a style attribute is changed, this cache is flushed. */
bool stylesValid;
ViewStyle vs;
+ Point sizeRGBAImage;
Palette palette;
int printMagnification;
@@ -163,6 +164,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool verticalScrollBarVisible;
bool endAtLastLine;
int caretSticky;
+ int marginOptions;
bool multipleSelection;
bool additionalSelectionTyping;
int multiPasteMode;
@@ -194,7 +196,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int dwellDelay;
int ticksToDwell;
bool dwelling;
- enum { selChar, selWord, selLine } selectionType;
+ enum { selChar, selWord, selSubLine, selWholeLine } selectionType;
Point ptMouseLast;
enum { ddNone, ddInitial, ddDragging } inDragDrop;
bool dropWentOutside;
@@ -202,7 +204,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
SelectionPosition posDrop;
int hotSpotClickPos;
int lastXChosen;
- int lineAnchor;
+ int lineAnchorPos;
int originalAnchorPos;
int wordSelectAnchorStartPos;
int wordSelectAnchorEndPos;
@@ -421,6 +423,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
+ virtual void SetCtrlID(int identifier);
virtual int GetCtrlID() { return ctrlID; }
virtual void NotifyParent(SCNotification scn) = 0;
virtual void NotifyStyleToNeeded(int endStyleNeeded);
@@ -463,6 +466,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
+ int KeyDownWithModifiers(int key, int modifiers, bool *consumed);
int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);
int GetWhitespaceVisible();
@@ -492,7 +496,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt);
Window::Cursor GetMarginCursor(Point pt);
- void LineSelection(int lineCurrent_, int lineAnchor_);
+ void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine);
void WordSelection(int pos);
void DwellEnd(bool mouseMoved);
void MouseLeave();
diff --git a/plugins/scintilla/scintilla/Indicator.cxx b/plugins/scintilla/scintilla/Indicator.cxx
index 5c352bf..7059a55 100644
--- a/plugins/scintilla/scintilla/Indicator.cxx
+++ b/plugins/scintilla/scintilla/Indicator.cxx
@@ -5,9 +5,17 @@
// Copyright 1998-2001 by Neil Hodgson <neilh scintilla org>
// The License.txt file describes the conditions under which this software may be distributed.
+#include <vector>
+#include <map>
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4786)
+#endif
+
#include "Platform.h"
#include "Scintilla.h"
+#include "XPM.h"
#include "Indicator.h"
#ifdef SCI_NAMESPACE
@@ -27,6 +35,17 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
y = 2 - y;
}
surface->LineTo(rc.right, rc.top + y); // Finish the line
+ } else if (style == INDIC_SQUIGGLELOW) {
+ surface->MoveTo(rc.left, rc.top);
+ int x = rc.left + 3;
+ int y = 0;
+ while (x < rc.right) {
+ surface->LineTo(x-1, rc.top + y);
+ y = 1 - y;
+ surface->LineTo(x, rc.top + y);
+ x += 3;
+ }
+ surface->LineTo(rc.right, rc.top + y); // Finish the line
} else if (style == INDIC_TT) {
surface->MoveTo(rc.left, ymid);
int x = rc.left + 5;
@@ -73,6 +92,41 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.left = rc.left;
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore.allocated, fillAlpha, fore.allocated, outlineAlpha, 0);
+ } else if (style == INDIC_DOTBOX) {
+ PRectangle rcBox = rcLine;
+ rcBox.top = rcLine.top + 1;
+ rcBox.left = rc.left;
+ rcBox.right = rc.right;
+ // Cap width at 4000 to avoid large allocations when mistakes made
+ int width = Platform::Minimum(rcBox.Width(), 4000);
+ RGBAImage image(width, rcBox.Height(), 0);
+ // Draw horizontal lines top and bottom
+ for (int x=0; x<width; x++) {
+ for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) {
+ image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha);
+ }
+ }
+ // Draw vertical lines left and right
+ for (int y=1; y<rcBox.Height(); y++) {
+ for (int x=0; x<width; x += width-1) {
+ image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha);
+ }
+ }
+ surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
+ } else if (style == INDIC_DASH) {
+ int x = rc.left;
+ while (x < rc.right) {
+ surface->MoveTo(x, ymid);
+ surface->LineTo(Platform::Minimum(x + 4, rc.right), ymid);
+ x += 7;
+ }
+ } else if (style == INDIC_DOTS) {
+ int x = rc.left;
+ while (x < rc.right) {
+ PRectangle rcDot(x, ymid, x+1, ymid+1);
+ surface->FillRectangle(rcDot, fore.allocated);
+ x += 2;
+ }
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);
diff --git a/plugins/scintilla/scintilla/KeyMap.cxx b/plugins/scintilla/scintilla/KeyMap.cxx
index c223d5b..4d866d1 100644
--- a/plugins/scintilla/scintilla/KeyMap.cxx
+++ b/plugins/scintilla/scintilla/KeyMap.cxx
@@ -66,14 +66,42 @@ unsigned int KeyMap::Find(int key, int modifiers) {
return 0;
}
+#if PLAT_GTK_MACOSX
+#define OS_X_KEYS 1
+#else
+#define OS_X_KEYS 0
+#endif
+
+// Define a modifier that is exactly Ctrl key on all platforms
+// Most uses of Ctrl map to Cmd on OS X but some can't so use SCI_[S]CTRL_META
+#if OS_X_KEYS
+#define SCI_CTRL_META SCI_META
+#define SCI_SCTRL_META (SCI_META | SCI_SHIFT)
+#else
+#define SCI_CTRL_META SCI_CTRL
+#define SCI_SCTRL_META (SCI_CTRL | SCI_SHIFT)
+#endif
+
const KeyToCommand KeyMap::MapDefault[] = {
+
+#if OS_X_KEYS
+ {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND},
+ {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
+ {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART},
+ {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
+ {SCK_LEFT, SCI_CTRL, SCI_VCHOME},
+ {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND},
+ {SCK_RIGHT, SCI_CTRL, SCI_LINEEND},
+ {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND},
+#endif
+
{SCK_DOWN, SCI_NORM, SCI_LINEDOWN},
{SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
- {SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
+ {SCK_DOWN, SCI_CTRL_META, SCI_LINESCROLLDOWN},
{SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND},
{SCK_UP, SCI_NORM, SCI_LINEUP},
{SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
- {SCK_UP, SCI_CTRL, SCI_LINESCROLLUP},
+ {SCK_UP, SCI_CTRL_META, SCI_LINESCROLLUP},
{SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND},
{'[', SCI_CTRL, SCI_PARAUP},
{'[', SCI_CSHIFT, SCI_PARAUPEXTEND},
@@ -81,13 +109,13 @@ const KeyToCommand KeyMap::MapDefault[] = {
{']', SCI_CSHIFT, SCI_PARADOWNEXTEND},
{SCK_LEFT, SCI_NORM, SCI_CHARLEFT},
{SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
- {SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
- {SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
+ {SCK_LEFT, SCI_CTRL_META, SCI_WORDLEFT},
+ {SCK_LEFT, SCI_SCTRL_META, SCI_WORDLEFTEXTEND},
{SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND},
{SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
{SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
- {SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
- {SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
+ {SCK_RIGHT, SCI_CTRL_META, SCI_WORDRIGHT},
+ {SCK_RIGHT, SCI_SCTRL_META, SCI_WORDRIGHTEXTEND},
{SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND},
{'/', SCI_CTRL, SCI_WORDPARTLEFT},
{'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND},
@@ -98,14 +126,12 @@ const KeyToCommand KeyMap::MapDefault[] = {
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
{SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
{SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY},
-// {SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND},
{SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND},
{SCK_END, SCI_NORM, SCI_LINEEND},
{SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
{SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
{SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
{SCK_END, SCI_ALT, SCI_LINEENDDISPLAY},
-// {SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND},
{SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND},
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
{SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
@@ -127,7 +153,11 @@ const KeyToCommand KeyMap::MapDefault[] = {
{SCK_BACK, SCI_ALT, SCI_UNDO},
{SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT},
{'Z', SCI_CTRL, SCI_UNDO},
+#if OS_X_KEYS
+ {'Z', SCI_CSHIFT, SCI_REDO},
+#else
{'Y', SCI_CTRL, SCI_REDO},
+#endif
{'X', SCI_CTRL, SCI_CUT},
{'C', SCI_CTRL, SCI_COPY},
{'V', SCI_CTRL, SCI_PASTE},
@@ -139,7 +169,6 @@ const KeyToCommand KeyMap::MapDefault[] = {
{SCK_ADD, SCI_CTRL, SCI_ZOOMIN},
{SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT},
{SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM},
- //'L', SCI_CTRL, SCI_FORMFEED,
{'L', SCI_CTRL, SCI_LINECUT},
{'L', SCI_CSHIFT, SCI_LINEDELETE},
{'T', SCI_CSHIFT, SCI_LINECOPY},
diff --git a/plugins/scintilla/scintilla/KeyMap.h b/plugins/scintilla/scintilla/KeyMap.h
index fd9005d..f1235d8 100644
--- a/plugins/scintilla/scintilla/KeyMap.h
+++ b/plugins/scintilla/scintilla/KeyMap.h
@@ -16,6 +16,7 @@ namespace Scintilla {
#define SCI_SHIFT SCMOD_SHIFT
#define SCI_CTRL SCMOD_CTRL
#define SCI_ALT SCMOD_ALT
+#define SCI_META SCMOD_META
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
diff --git a/plugins/scintilla/scintilla/LexAU3.cxx b/plugins/scintilla/scintilla/LexAU3.cxx
index 72c918f..e9ab757 100644
--- a/plugins/scintilla/scintilla/LexAU3.cxx
+++ b/plugins/scintilla/scintilla/LexAU3.cxx
@@ -241,7 +241,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
if (IsAWordChar(sc.ch) || sc.ch == '}')
{
strcpy(s_save,s);
- int tp = strlen(s_save);
+ int tp = static_cast<int>(strlen(s_save));
if (tp < 99) {
s_save[tp] = static_cast<char>(tolower(sc.ch));
s_save[tp+1] = '\0';
diff --git a/plugins/scintilla/scintilla/LexCOBOL.cxx b/plugins/scintilla/scintilla/LexCOBOL.cxx
index a9a8f55..b3bc011 100644
--- a/plugins/scintilla/scintilla/LexCOBOL.cxx
+++ b/plugins/scintilla/scintilla/LexCOBOL.cxx
@@ -208,6 +208,14 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
+ } else if (column == 6 && ch == '*') {
+ // Cobol comment line: asterisk in column 7.
+ ColourTo(styler, i-1, state);
+ state = SCE_C_COMMENTLINE;
+ } else if (ch == '*' && chNext == '>') {
+ // Cobol inline comment: asterisk, followed by greater than.
+ ColourTo(styler, i-1, state);
+ state = SCE_C_COMMENTLINE;
} else if (column == 0 && ch == '*' && chNext != '*') {
ColourTo(styler, i-1, state);
state = SCE_C_COMMENTLINE;
diff --git a/plugins/scintilla/scintilla/LexCPP.cxx b/plugins/scintilla/scintilla/LexCPP.cxx
index 22477c3..51fd192 100644
--- a/plugins/scintilla/scintilla/LexCPP.cxx
+++ b/plugins/scintilla/scintilla/LexCPP.cxx
@@ -803,15 +803,20 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx
} else if (sc.ch == '\"') {
if (sc.chPrev == 'R') {
- sc.SetState(SCE_C_STRINGRAW|activitySet);
- rawStringTerminator = ")";
- for (int termPos = sc.currentPos + 1;; termPos++) {
- char chTerminator = styler.SafeGetCharAt(termPos, '(');
- if (chTerminator == '(')
- break;
- rawStringTerminator += chTerminator;
+ styler.Flush();
+ if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) {
+ sc.SetState(SCE_C_STRINGRAW|activitySet);
+ rawStringTerminator = ")";
+ for (int termPos = sc.currentPos + 1;; termPos++) {
+ char chTerminator = styler.SafeGetCharAt(termPos, '(');
+ if (chTerminator == '(')
+ break;
+ rawStringTerminator += chTerminator;
+ }
+ rawStringTerminator += '\"';
+ } else {
+ sc.SetState(SCE_C_STRING|activitySet);
}
- rawStringTerminator += '\"';
} else {
sc.SetState(SCE_C_STRING|activitySet);
}
diff --git a/plugins/scintilla/scintilla/LexConf.cxx b/plugins/scintilla/scintilla/LexConf.cxx
index 5e1bd19..23ed5a6 100644
--- a/plugins/scintilla/scintilla/LexConf.cxx
+++ b/plugins/scintilla/scintilla/LexConf.cxx
@@ -2,7 +2,7 @@
/** @file LexConf.cxx
** Lexer for Apache Configuration Files.
**
- ** First working version contributed by Ahmad Zawawi <zeus_go64 hotmail com> on October 28, 2000.
+ ** First working version contributed by Ahmad Zawawi <ahmad zawawi gmail com> on October 28, 2000.
** i created this lexer because i needed something pretty when dealing
** when Apache Configuration files...
**/
diff --git a/plugins/scintilla/scintilla/LexHTML.cxx b/plugins/scintilla/scintilla/LexHTML.cxx
index 4c50a15..a207963 100644
--- a/plugins/scintilla/scintilla/LexHTML.cxx
+++ b/plugins/scintilla/scintilla/LexHTML.cxx
@@ -57,7 +57,7 @@ inline bool IsOperator(int ch) {
}
static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
- size_t i = 0;
+ unsigned int i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
}
@@ -66,7 +66,7 @@ static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int en
static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) {
- size_t i = 0;
+ unsigned int i = 0;
for (; i < sLen-1; i++) {
char ch = static_cast<char>(styler.SafeGetCharAt(start + i));
if ((i == 0) && !IsAWordStart(ch))
@@ -356,7 +356,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
return SCE_HB_DEFAULT;
}
-static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) {
+static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) {
bool wordIsNumber = IsADigit(styler[start]);
char s[30 + 1];
unsigned int i = 0;
@@ -373,6 +373,8 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
chAttr = SCE_HP_NUMBER;
else if (keywords.InList(s))
chAttr = SCE_HP_WORD;
+ else if (isMako && 0 == strcmp(s, "block"))
+ chAttr = SCE_HP_WORD;
styler.ColourTo(end, statePrintForState(chAttr, inScriptType));
strcpy(prevWord, s);
}
@@ -494,7 +496,10 @@ static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType
(0 == strcmp(blockType, "page"))) {
return ((ch == '/') && (chNext == '>'));
} else if (0 == strcmp(blockType, "%")) {
- return isLineEnd(ch);
+ if (ch == '/' && isLineEnd(chNext))
+ return 1;
+ else
+ return isLineEnd(ch);
} else if (0 == strcmp(blockType, "{")) {
return ch == '}';
} else {
@@ -588,6 +593,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
int state = stateForPrintState(StateToPrint);
char makoBlockType[200];
makoBlockType[0] = '\0';
+ int makoComment = 0;
char djangoBlockType[2];
djangoBlockType[0] = '\0';
@@ -762,7 +768,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case eScriptPython:
- if (state != SCE_HP_COMMENTLINE) {
+ if (state != SCE_HP_COMMENTLINE && !isMako) {
if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
levelCurrent++;
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
@@ -818,6 +824,18 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
lineStartVisibleChars = 0;
}
+ // handle start of Mako comment line
+ if (isMako && ch == '#' && chNext == '#') {
+ makoComment = 1;
+ }
+
+ // handle end of Mako comment line
+ else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
+ makoComment = 0;
+ styler.ColourTo(i, SCE_HP_COMMENTLINE);
+ state = SCE_HP_DEFAULT;
+ }
+
// Allow falling through to mako handling code if newline is going to end a block
if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
(!isMako || (0 != strcmp(makoBlockType, "%")))) {
@@ -912,9 +930,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// handle the start Mako template Python code
else if (isMako && scriptLanguage == eScriptNone && ((ch == '<' && chNext == '%') ||
(lineStartVisibleChars == 1 && ch == '%') ||
+ (lineStartVisibleChars == 1 && ch == '/' && chNext == '%') ||
(ch == '$' && chNext == '{') ||
(ch == '<' && chNext == '/' && chNext2 == '%'))) {
- if (ch == '%')
+ if (ch == '%' || ch == '/')
strcpy(makoBlockType, "%");
else if (ch == '$')
strcpy(makoBlockType, "{");
@@ -939,12 +958,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HP_START;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
- if (foldHTMLPreprocessor && ch == '<')
- levelCurrent++;
- if (ch != '%' && ch != '$') {
- i += strlen(makoBlockType);
- visibleChars += strlen(makoBlockType);
+ if (ch != '%' && ch != '$' && ch != '/') {
+ i += static_cast<int>(strlen(makoBlockType));
+ visibleChars += static_cast<int>(strlen(makoBlockType));
if (keywords4.InList(makoBlockType))
styler.ColourTo(i, SCE_HP_WORD);
else
@@ -1085,7 +1102,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
- classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
+ classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
@@ -1093,7 +1110,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
i++;
visibleChars++;
}
- if (0 != strcmp(makoBlockType, "%")) {
+ else if (0 == strcmp(makoBlockType, "%") && ch == '/') {
+ i++;
+ visibleChars++;
+ }
+ if (0 != strcmp(makoBlockType, "%") || ch == '/') {
styler.ColourTo(i, SCE_H_ASP);
}
state = beforePreProc;
@@ -1101,9 +1122,6 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
- if (foldHTMLPreprocessor && ch != '\n' && ch != '\r') {
- levelCurrent--;
- }
scriptLanguage = eScriptNone;
continue;
}
@@ -1118,7 +1136,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.GetStartSegment(), i - 1, aspScript);
}
if (state == SCE_HP_WORD) {
- classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
+ classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
} else {
styler.ColourTo(i - 1, StateToPrint);
}
@@ -1152,7 +1170,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType);
break;
case SCE_HP_WORD:
- classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
+ classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler);
@@ -1814,7 +1832,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
case SCE_HP_WORD:
if (!IsAWordChar(ch)) {
- classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType);
+ classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako);
state = SCE_HP_DEFAULT;
if (ch == '#') {
state = SCE_HP_COMMENTLINE;
@@ -1965,7 +1983,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, StateToPrint);
state = SCE_HPHP_DEFAULT;
} else if (isLineEnd(chPrev)) {
- const int psdLength = strlen(phpStringDelimiter);
+ const int psdLength = static_cast<int>(strlen(phpStringDelimiter));
const char chAfterPsd = styler.SafeGetCharAt(i + psdLength);
const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1);
if (isLineEnd(chAfterPsd) ||
@@ -1988,7 +2006,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_DEFAULT;
}
} else if (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter)) {
- const int psdLength = strlen(phpStringDelimiter);
+ const int psdLength = static_cast<int>(strlen(phpStringDelimiter));
const char chAfterPsd = styler.SafeGetCharAt(i + psdLength);
const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1);
if (isLineEnd(chAfterPsd) ||
@@ -2103,7 +2121,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType);
break;
case SCE_HP_WORD:
- classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType);
+ classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType, isMako);
break;
case SCE_HPHP_WORD:
classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler);
diff --git a/plugins/scintilla/scintilla/LexLua.cxx b/plugins/scintilla/scintilla/LexLua.cxx
index 1dc9d40..9e48efc 100644
--- a/plugins/scintilla/scintilla/LexLua.cxx
+++ b/plugins/scintilla/scintilla/LexLua.cxx
@@ -59,7 +59,7 @@ static void ColouriseLuaDoc(
// Accepts accented characters
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
- CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
+ CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases. [pP] is for hex floats.
CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefpABCDEFP");
@@ -71,7 +71,7 @@ static void ColouriseLuaDoc(
// Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
// if we are inside such a string. Block comment was introduced in Lua 5.0,
// blocks with separators [=[ ... ]=] in Lua 5.1.
- // Continuation of a string (\* whitespace escaping) is controlled by stringWs.
+ // Continuation of a string (\z whitespace escaping) is controlled by stringWs.
int nestLevel = 0;
int sepCount = 0;
int stringWs = 0;
@@ -130,6 +130,61 @@ static void ColouriseLuaDoc(
// Determine if the current state should terminate.
if (sc.state == SCE_LUA_OPERATOR) {
+ if (sc.ch == ':' && sc.chPrev == ':') { // :: <label> :: forward scan
+ sc.Forward();
+ int ln = 0, maxln = startPos + length - sc.currentPos;
+ int c;
+ while (ln < maxln) { // determine line extent
+ c = sc.GetRelative(ln);
+ if (c == '\r' || c == '\n')
+ break;
+ ln++;
+ }
+ maxln = ln; ln = 0;
+ while (ln < maxln) { // skip over spaces/tabs
+ if (!IsASpaceOrTab(sc.GetRelative(ln)))
+ break;
+ ln++;
+ }
+ int ws1 = ln;
+ if (setWordStart.Contains(sc.GetRelative(ln))) {
+ int i = 0;
+ char s[100];
+ while (ln < maxln) { // get potential label
+ c = sc.GetRelative(ln);
+ if (!setWord.Contains(c))
+ break;
+ if (i < 90)
+ s[i++] = c;
+ ln++;
+ }
+ s[i] = '\0'; int lbl = ln;
+ if (!keywords.InList(s)) {
+ while (ln < maxln) { // skip over spaces/tabs
+ if (!IsASpaceOrTab(sc.GetRelative(ln)))
+ break;
+ ln++;
+ }
+ int ws2 = ln - lbl;
+ if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') {
+ // final :: found, complete valid label construct
+ sc.ChangeState(SCE_LUA_LABEL);
+ if (ws1) {
+ sc.SetState(SCE_LUA_DEFAULT);
+ sc.Forward(ws1);
+ }
+ sc.SetState(SCE_LUA_LABEL);
+ sc.Forward(lbl - ws1);
+ if (ws2) {
+ sc.SetState(SCE_LUA_DEFAULT);
+ sc.Forward(ws2);
+ }
+ sc.SetState(SCE_LUA_LABEL);
+ sc.Forward(2);
+ }
+ }
+ }
+ }
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
// We stop the number definition on non-numerical non-dot non-eEpP non-sign non-hexdigit char
@@ -140,11 +195,26 @@ static void ColouriseLuaDoc(
sc.SetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_IDENTIFIER) {
- if (!setWord.Contains(sc.ch) || sc.Match('.', '.')) {
+ if (!(setWord.Contains(sc.ch) || sc.ch == '.') || sc.Match('.', '.')) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_LUA_WORD);
+ if (strcmp(s, "goto") == 0) { // goto <label> forward scan
+ sc.SetState(SCE_LUA_DEFAULT);
+ while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd)
+ sc.Forward();
+ if (setWordStart.Contains(sc.ch)) {
+ sc.SetState(SCE_LUA_LABEL);
+ sc.Forward();
+ while (setWord.Contains(sc.ch))
+ sc.Forward();
+ sc.GetCurrent(s, sizeof(s));
+ if (keywords.InList(s))
+ sc.ChangeState(SCE_LUA_WORD);
+ }
+ sc.SetState(SCE_LUA_DEFAULT);
+ }
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_LUA_WORD2);
} else if (keywords3.InList(s)) {
@@ -174,7 +244,7 @@ static void ColouriseLuaDoc(
if (sc.ch == '\\') {
if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward();
- } else if (sc.chNext == '*') {
+ } else if (sc.chNext == 'z') {
sc.Forward();
stringWs = 0x100;
}
@@ -192,7 +262,7 @@ static void ColouriseLuaDoc(
if (sc.ch == '\\') {
if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward();
- } else if (sc.chNext == '*') {
+ } else if (sc.chNext == 'z') {
sc.Forward();
stringWs = 0x100;
}
@@ -269,7 +339,7 @@ static void ColouriseLuaDoc(
}
}
- if (setWord.Contains(sc.chPrev)) {
+ if (setWord.Contains(sc.chPrev) || sc.chPrev == '.') {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
diff --git a/plugins/scintilla/scintilla/LexMagik.cxx b/plugins/scintilla/scintilla/LexMagik.cxx
index 45390d4..992080d 100644
--- a/plugins/scintilla/scintilla/LexMagik.cxx
+++ b/plugins/scintilla/scintilla/LexMagik.cxx
@@ -233,7 +233,7 @@ static void ColouriseMagikDoc(unsigned int startPos, int length, int initStyle,
}
if(characters.InList(keyword)) {
- sc.Forward(strlen(keyword));
+ sc.Forward(static_cast<int>(strlen(keyword)));
} else {
sc.Forward();
}
diff --git a/plugins/scintilla/scintilla/LexMarkdown.cxx b/plugins/scintilla/scintilla/LexMarkdown.cxx
index 3937120..a926977 100644
--- a/plugins/scintilla/scintilla/LexMarkdown.cxx
+++ b/plugins/scintilla/scintilla/LexMarkdown.cxx
@@ -113,6 +113,10 @@ static bool HasPrevLineContent(StyleContext &sc) {
return false;
}
+static bool AtTermStart(StyleContext &sc) {
+ return sc.currentPos == 0 || isspacechar(sc.chPrev);
+}
+
static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
int c, count = 1;
unsigned int i = 0;
@@ -373,35 +377,38 @@ static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle
}
}
// Code - also a special case for alternate inside spacing
- if (sc.Match("``") && sc.GetRelative(3) != ' ') {
+ if (sc.Match("``") && sc.GetRelative(3) != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_CODE2);
sc.Forward();
}
- else if (sc.ch == '`' && sc.chNext != ' ') {
+ else if (sc.ch == '`' && sc.chNext != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_CODE);
}
// Strong
- else if (sc.Match("**") && sc.GetRelative(2) != ' ') {
+ else if (sc.Match("**") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_STRONG1);
sc.Forward();
}
- else if (sc.Match("__") && sc.GetRelative(2) != ' ') {
+ else if (sc.Match("__") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_STRONG2);
sc.Forward();
}
// Emphasis
- else if (sc.ch == '*' && sc.chNext != ' ')
+ else if (sc.ch == '*' && sc.chNext != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_EM1);
- else if (sc.ch == '_' && sc.chNext != ' ')
+ }
+ else if (sc.ch == '_' && sc.chNext != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_EM2);
+ }
// Strikeout
- else if (sc.Match("~~") && sc.GetRelative(2) != ' ') {
+ else if (sc.Match("~~") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) {
sc.SetState(SCE_MARKDOWN_STRIKEOUT);
sc.Forward();
}
// Beginning of line
- else if (IsNewline(sc.ch))
+ else if (IsNewline(sc.ch)) {
sc.SetState(SCE_MARKDOWN_LINE_BEGIN);
+ }
}
// Advance if not holding back the cursor for this iteration.
if (!freezeCursor)
diff --git a/plugins/scintilla/scintilla/LexMatlab.cxx b/plugins/scintilla/scintilla/LexMatlab.cxx
index 0d2064e..68915af 100644
--- a/plugins/scintilla/scintilla/LexMatlab.cxx
+++ b/plugins/scintilla/scintilla/LexMatlab.cxx
@@ -106,12 +106,12 @@ static void ColouriseMatlabOctaveDoc(
transpose = true;
}
} else if (sc.state == SCE_MATLAB_STRING) {
- if (sc.ch == '\\') {
- if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
- sc.Forward();
- }
- } else if (sc.ch == '\'') {
- sc.ForwardSetState(SCE_MATLAB_DEFAULT);
+ if (sc.ch == '\'') {
+ if (sc.chNext == '\'') {
+ sc.Forward();
+ } else {
+ sc.ForwardSetState(SCE_MATLAB_DEFAULT);
+ }
}
} else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) {
if (sc.ch == '\\') {
diff --git a/plugins/scintilla/scintilla/LexModula.cxx b/plugins/scintilla/scintilla/LexModula.cxx
index 1d03611..cc5847f 100644
--- a/plugins/scintilla/scintilla/LexModula.cxx
+++ b/plugins/scintilla/scintilla/LexModula.cxx
@@ -92,7 +92,7 @@ static inline bool checkStatement(
Accessor &styler,
int &curPos,
const char *stt, bool spaceAfter = true ) {
- int len = strlen( stt );
+ int len = static_cast<int>(strlen( stt ));
int i;
for( i = 0; i < len; i++ ) {
if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) {
@@ -113,7 +113,7 @@ static inline bool checkEndSemicolon(
int &curPos, int endPos )
{
const char *stt = "END";
- int len = strlen( stt );
+ int len = static_cast<int>(strlen( stt ));
int i;
for( i = 0; i < len; i++ ) {
if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) {
diff --git a/plugins/scintilla/scintilla/LexOthers.cxx b/plugins/scintilla/scintilla/LexOthers.cxx
index bc2c287..720d979 100644
--- a/plugins/scintilla/scintilla/LexOthers.cxx
+++ b/plugins/scintilla/scintilla/LexOthers.cxx
@@ -1162,21 +1162,71 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
}
}
-static int isSpecial(char s) {
- return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||
- (s == '\"') || (s == '`') || (s == '^') || (s == '~');
+static bool latexIsSpecial(int ch) {
+ return (ch == '#') || (ch == '$') || (ch == '%') || (ch == '&') || (ch == '_') ||
+ (ch == '{') || (ch == '}') || (ch == ' ');
}
-static int isTag(int start, Accessor &styler) {
- char s[6];
- unsigned int i = 0, e = 1;
- while (i < 5 && e) {
- s[i] = styler[start + i];
+static bool latexIsBlank(int ch) {
+ return (ch == ' ') || (ch == '\t');
+}
+
+static bool latexIsBlankAndNL(int ch) {
+ return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n');
+}
+
+static bool latexIsLetter(int ch) {
+ return isascii(ch) && isalpha(ch);
+}
+
+static bool latexIsTagValid(int &i, int l, Accessor &styler) {
+ while (i < l) {
+ if (styler.SafeGetCharAt(i) == '{') {
+ while (i < l) {
+ i++;
+ if (styler.SafeGetCharAt(i) == '}') {
+ return true;
+ } else if (!latexIsLetter(styler.SafeGetCharAt(i)) &&
+ styler.SafeGetCharAt(i)!='*') {
+ return false;
+ }
+ }
+ } else if (!latexIsBlank(styler.SafeGetCharAt(i))) {
+ return false;
+ }
i++;
- e = (strchr("{ \t", styler[start + i]) == NULL);
+ }
+ return false;
+}
+
+static bool latexNextNotBlankIs(int i, int l, Accessor &styler, char needle) {
+ char ch;
+ while (i < l) {
+ ch = styler.SafeGetCharAt(i);
+ if (!latexIsBlankAndNL(ch) && ch != '*') {
+ if (ch == needle)
+ return true;
+ else
+ return false;
+ }
+ i++;
+ }
+ return false;
+}
+
+static bool latexLastWordIs(int start, Accessor &styler, const char *needle) {
+ unsigned int i = 0;
+ unsigned int l = static_cast<unsigned int>(strlen(needle));
+ int ini = start-l+1;
+ char s[32];
+
+ while (i < l && i < 32) {
+ s[i] = styler.SafeGetCharAt(ini + i);
+ i++;
}
s[i] = '\0';
- return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);
+
+ return (strcmp(s, needle) == 0);
}
static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
@@ -1185,39 +1235,51 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
styler.StartAt(startPos);
int state = initStyle;
- char chNext = styler[startPos];
+ char chNext = styler.SafeGetCharAt(startPos);
styler.StartSegment(startPos);
int lengthDoc = startPos + length;
+ char chVerbatimDelim = '\0';
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (styler.IsLeadByte(ch)) {
- chNext = styler.SafeGetCharAt(i + 2);
i++;
+ chNext = styler.SafeGetCharAt(i + 1);
continue;
}
+
switch (state) {
case SCE_L_DEFAULT :
switch (ch) {
case '\\' :
styler.ColourTo(i - 1, state);
- if (isSpecial(styler[i + 1])) {
- styler.ColourTo(i + 1, SCE_L_COMMAND);
- i++;
- chNext = styler.SafeGetCharAt(i + 1);
+ if (latexIsSpecial(chNext)) {
+ state = SCE_L_SPECIAL;
} else {
- if (isTag(i + 1, styler))
- state = SCE_L_TAG;
- else
+ if (latexIsLetter(chNext)) {
state = SCE_L_COMMAND;
+ } else {
+ if (chNext == '(' || chNext == '[') {
+ styler.ColourTo(i-1, state);
+ styler.ColourTo(i+1, SCE_L_SHORTCMD);
+ state = SCE_L_MATH;
+ if (chNext == '[')
+ state = SCE_L_MATH2;
+ i++;
+ chNext = styler.SafeGetCharAt(i+1);
+ } else {
+ state = SCE_L_SHORTCMD;
+ }
+ }
}
break;
case '$' :
styler.ColourTo(i - 1, state);
state = SCE_L_MATH;
if (chNext == '$') {
+ state = SCE_L_MATH2;
i++;
chNext = styler.SafeGetCharAt(i + 1);
}
@@ -1228,29 +1290,124 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
break;
}
break;
+ case SCE_L_ERROR:
+ styler.ColourTo(i-1, state);
+ state = SCE_L_DEFAULT;
+ break;
+ case SCE_L_SPECIAL:
+ case SCE_L_SHORTCMD:
+ styler.ColourTo(i, state);
+ state = SCE_L_DEFAULT;
+ break;
case SCE_L_COMMAND :
- if (chNext == '[' || chNext == '{' || chNext == '}' ||
- chNext == ' ' || chNext == '\r' || chNext == '\n') {
+ if (!latexIsLetter(chNext)) {
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
- i++;
- chNext = styler.SafeGetCharAt(i + 1);
+ if (latexNextNotBlankIs(i+1, lengthDoc, styler, '[' )) {
+ state = SCE_L_CMDOPT;
+ } else if (latexLastWordIs(i, styler, "\\begin")) {
+ state = SCE_L_TAG;
+ } else if (latexLastWordIs(i, styler, "\\end")) {
+ state = SCE_L_TAG2;
+ } else if (latexLastWordIs(i, styler, "\\verb") &&
+ chNext != '*' && chNext != ' ') {
+ chVerbatimDelim = chNext;
+ state = SCE_L_VERBATIM;
+ }
}
break;
+ case SCE_L_CMDOPT :
+ if (ch == ']') {
+ styler.ColourTo(i, state);
+ state = SCE_L_DEFAULT;
+ }
+ break;
case SCE_L_TAG :
- if (ch == '}') {
+ if (latexIsTagValid(i, lengthDoc, styler)) {
+ styler.ColourTo(i, state);
+ state = SCE_L_DEFAULT;
+ if (latexLastWordIs(i, styler, "{verbatim}")) {
+ state = SCE_L_VERBATIM;
+ } else if (latexLastWordIs(i, styler, "{comment}")) {
+ state = SCE_L_COMMENT2;
+ } else if (latexLastWordIs(i, styler, "{math}")) {
+ state = SCE_L_MATH;
+ } else if (latexLastWordIs(i, styler, "{displaymath}")) {
+ state = SCE_L_MATH2;
+ } else if (latexLastWordIs(i, styler, "{equation}")) {
+ state = SCE_L_MATH2;
+ }
+ } else {
+ state = SCE_L_ERROR;
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
}
+ chNext = styler.SafeGetCharAt(i+1);
+ break;
+ case SCE_L_TAG2 :
+ if (latexIsTagValid(i, lengthDoc, styler)) {
+ styler.ColourTo(i, state);
+ state = SCE_L_DEFAULT;
+ } else {
+ state = SCE_L_ERROR;
+ }
+ chNext = styler.SafeGetCharAt(i+1);
break;
case SCE_L_MATH :
if (ch == '$') {
- if (chNext == '$') {
- i++;
- chNext = styler.SafeGetCharAt(i + 1);
- }
styler.ColourTo(i, state);
state = SCE_L_DEFAULT;
+ } else if (ch == '\\' && chNext == ')') {
+ styler.ColourTo(i-1, state);
+ styler.ColourTo(i+1, SCE_L_SHORTCMD);
+ i++;
+ chNext = styler.SafeGetCharAt(i+1);
+ state = SCE_L_DEFAULT;
+ } else if (ch == '\\') {
+ int match = i + 3;
+ if (latexLastWordIs(match, styler, "\\end")) {
+ match++;
+ if (latexIsTagValid(match, lengthDoc, styler)) {
+ if (latexLastWordIs(match, styler, "{math}")) {
+ styler.ColourTo(i-1, state);
+ state = SCE_L_COMMAND;
+ }
+ }
+ }
+ }
+
+ break;
+ case SCE_L_MATH2 :
+ if (ch == '$') {
+ if (chNext == '$') {
+ i++;
+ chNext = styler.SafeGetCharAt(i + 1);
+ styler.ColourTo(i, state);
+ state = SCE_L_DEFAULT;
+ } else {
+ styler.ColourTo(i, SCE_L_ERROR);
+ state = SCE_L_DEFAULT;
+ }
+ } else if (ch == '\\' && chNext == ']') {
+ styler.ColourTo(i-1, state);
+ styler.ColourTo(i+1, SCE_L_SHORTCMD);
+ i++;
+ chNext = styler.SafeGetCharAt(i+1);
+ state = SCE_L_DEFAULT;
+ } else if (ch == '\\') {
+ int match = i + 3;
+ if (latexLastWordIs(match, styler, "\\end")) {
+ match++;
+ if (latexIsTagValid(match, lengthDoc, styler)) {
+ if (latexLastWordIs(match, styler, "{displaymath}")) {
+ styler.ColourTo(i-1, state);
+ state = SCE_L_COMMAND;
+ } else if (latexLastWordIs(match, styler, "{equation}")) {
+ styler.ColourTo(i-1, state);
+ state = SCE_L_COMMAND;
+ }
+ }
+ }
}
break;
case SCE_L_COMMENT :
@@ -1258,6 +1415,43 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(i - 1, state);
state = SCE_L_DEFAULT;
}
+ break;
+ case SCE_L_COMMENT2 :
+ if (ch == '\\') {
+ int match = i + 3;
+ if (latexLastWordIs(match, styler, "\\end")) {
+ match++;
+ if (latexIsTagValid(match, lengthDoc, styler)) {
+ if (latexLastWordIs(match, styler, "{comment}")) {
+ styler.ColourTo(i-1, state);
+ state = SCE_L_COMMAND;
+ }
+ }
+ }
+ }
+ break;
+ case SCE_L_VERBATIM :
+ if (ch == '\\') {
+ int match = i + 3;
+ if (latexLastWordIs(match, styler, "\\end")) {
+ match++;
+ if (latexIsTagValid(match, lengthDoc, styler)) {
+ if (latexLastWordIs(match, styler, "{verbatim}")) {
+ styler.ColourTo(i-1, state);
+ state = SCE_L_COMMAND;
+ }
+ }
+ }
+ } else if (chNext == chVerbatimDelim) {
+ styler.ColourTo(i+1, state);
+ state = SCE_L_DEFAULT;
+ chVerbatimDelim = '\0';
+ } else if (chVerbatimDelim != '\0' && (ch == '\n' || ch == '\r')) {
+ styler.ColourTo(i, SCE_L_ERROR);
+ state = SCE_L_DEFAULT;
+ chVerbatimDelim = '\0';
+ }
+ break;
}
}
styler.ColourTo(lengthDoc-1, state);
diff --git a/plugins/scintilla/scintilla/LexPerl.cxx b/plugins/scintilla/scintilla/LexPerl.cxx
index 7f0cbcf..8a0f642 100644
--- a/plugins/scintilla/scintilla/LexPerl.cxx
+++ b/plugins/scintilla/scintilla/LexPerl.cxx
@@ -69,6 +69,10 @@ using namespace Scintilla;
#define BACK_OPERATOR 1 // whitespace/comments are insignificant
#define BACK_KEYWORD 2 // operators/keywords are needed for disambiguation
+// all interpolated styles are different from their parent styles by a constant difference
+// we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value
+#define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING)
+
static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywords, LexAccessor &styler) {
// old-style keyword matcher; needed because GetCurrent() needs
// current segment to be committed, but we may abandon early...
@@ -246,14 +250,6 @@ static bool styleCheckSubPrototype(LexAccessor &styler, unsigned int bk) {
return true;
}
-static bool isMatch(const char *sref, char *s) {
- // match per-line delimiter - must kill trailing CR if CRLF
- int i = strlen(s);
- if (i != 0 && s[i - 1] == '\r')
- s[i - 1] = '\0';
- return (strcmp(sref, s) == 0);
-}
-
static int actualNumStyle(int numberStyle) {
if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) {
return SCE_PL_STRING;
@@ -360,11 +356,19 @@ struct OptionSetPerl : public OptionSet<OptionsPerl> {
};
class LexerPerl : public ILexer {
+ CharacterSet setWordStart;
+ CharacterSet setWord;
+ CharacterSet setSpecialVar;
+ CharacterSet setControlVar;
WordList keywords;
OptionsPerl options;
OptionSetPerl osPerl;
public:
- LexerPerl() {
+ LexerPerl() :
+ setWordStart(CharacterSet::setAlpha, "_", 0x80, true),
+ setWord(CharacterSet::setAlphaNum, "_", 0x80, true),
+ setSpecialVar(CharacterSet::setNone, "\"$;<>&`'+,./\\%:=~!? []"),
+ setControlVar(CharacterSet::setNone, "ACDEFHILMNOPRSTVWX") {
}
~LexerPerl() {
}
@@ -398,6 +402,7 @@ public:
static ILexer *LexerFactoryPerl() {
return new LexerPerl();
}
+ void InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern=false);
};
int SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) {
@@ -426,6 +431,90 @@ int SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) {
return firstModification;
}
+void LexerPerl::InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern) {
+ // interpolate a segment (with no active backslashes or delimiters within)
+ // switch in or out of an interpolation style or continue current style
+ // commit variable patterns if found, trim segment, repeat until done
+ while (maxSeg > 0) {
+ bool isVar = false;
+ int sLen = 0;
+ if ((maxSeg > 1) && (sc.ch == '$' || sc.ch == '@')) {
+ // $#[$]*word [$ ][$]*word (where word or {word} is always present)
+ bool braces = false;
+ sLen = 1;
+ if (sc.ch == '$' && sc.chNext == '#') { // starts with $#
+ sLen++;
+ }
+ while ((maxSeg > sLen) && (sc.GetRelative(sLen) == '$')) // >0 $ dereference within
+ sLen++;
+ if ((maxSeg > sLen) && (sc.GetRelative(sLen) == '{')) { // { start for {word}
+ sLen++;
+ braces = true;
+ }
+ if (maxSeg > sLen) {
+ int c = sc.GetRelative(sLen);
+ if (setWordStart.Contains(c)) { // word (various)
+ sLen++;
+ isVar = true;
+ while ((maxSeg > sLen) && setWord.Contains(sc.GetRelative(sLen)))
+ sLen++;
+ } else if (braces && IsADigit(c) && (sLen == 2)) { // digit for ${digit}
+ sLen++;
+ isVar = true;
+ }
+ }
+ if (braces) {
+ if ((maxSeg > sLen) && (sc.GetRelative(sLen) == '}')) { // } end for {word}
+ sLen++;
+ } else
+ isVar = false;
+ }
+ }
+ if (!isVar && (maxSeg > 1)) { // $- or @-specific variable patterns
+ sLen = 1;
+ int c = sc.chNext;
+ if (sc.ch == '$') {
+ if (IsADigit(c)) { // $[0-9] and slurp trailing digits
+ sLen++;
+ isVar = true;
+ while ((maxSeg > sLen) && IsADigit(sc.GetRelative(sLen)))
+ sLen++;
+ } else if (setSpecialVar.Contains(c)) { // $ special variables
+ sLen++;
+ isVar = true;
+ } else if (!isPattern && ((c == '(') || (c == ')') || (c == '|'))) { // $ additional
+ sLen++;
+ isVar = true;
+ } else if (c == '^') { // $^A control-char style
+ sLen++;
+ if ((maxSeg > sLen) && setControlVar.Contains(sc.GetRelative(sLen))) {
+ sLen++;
+ isVar = true;
+ }
+ }
+ } else if (sc.ch == '@') {
+ if (!isPattern && ((c == '+') || (c == '-'))) { // @ specials non-pattern
+ sLen++;
+ isVar = true;
+ }
+ }
+ }
+ if (isVar) { // commit as interpolated variable or normal character
+ if (sc.state < SCE_PL_STRING_VAR)
+ sc.SetState(sc.state + INTERPOLATE_SHIFT);
+ sc.Forward(sLen);
+ maxSeg -= sLen;
+ } else {
+ if (sc.state >= SCE_PL_STRING_VAR)
+ sc.SetState(sc.state - INTERPOLATE_SHIFT);
+ sc.Forward();
+ maxSeg--;
+ }
+ }
+ if (sc.state >= SCE_PL_STRING_VAR)
+ sc.SetState(sc.state - INTERPOLATE_SHIFT);
+}
+
void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
@@ -434,8 +523,6 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
reWords.Set("elsif if split while");
// charset classes
- CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
- CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMAC");
// lexing of "%*</" operators is non-trivial; these are missing in the set below
CharacterSet setPerlOperator(CharacterSet::setNone, "^&\\()-+=|{}[]:;>,?!.~");
@@ -450,7 +537,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
CharacterSet &setPOD = setModifiers;
CharacterSet setNonHereDoc(CharacterSet::setDigits, "=$@");
CharacterSet setHereDocDelim(CharacterSet::setAlphaNum, "_");
- CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$ %&*];");
+ CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$ %&*+];");
// for format identifiers
CharacterSet setFormatStart(CharacterSet::setAlpha, "_=");
CharacterSet &setFormat = setHereDocDelim;
@@ -520,10 +607,13 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
// Includes strings (may be multi-line), numbers (additional state), format
// bodies, as well as POD sections.
if (initStyle == SCE_PL_HERE_Q
- || initStyle == SCE_PL_HERE_QQ
- || initStyle == SCE_PL_HERE_QX
- || initStyle == SCE_PL_FORMAT
+ || initStyle == SCE_PL_HERE_QQ
+ || initStyle == SCE_PL_HERE_QX
+ || initStyle == SCE_PL_FORMAT
+ || initStyle == SCE_PL_HERE_QQ_VAR
+ || initStyle == SCE_PL_HERE_QX_VAR
) {
+ // backtrack through multiple styles to reach the delimiter start
int delim = (initStyle == SCE_PL_FORMAT) ? SCE_PL_FORMAT_IDENT:SCE_PL_HERE_DELIM;
while ((startPos > 1) && (styler.StyleAt(startPos) != delim)) {
startPos--;
@@ -531,15 +621,34 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
startPos = styler.LineStart(styler.GetLine(startPos));
initStyle = styler.StyleAt(startPos - 1);
}
- if (initStyle == SCE_PL_STRING_Q
- || initStyle == SCE_PL_STRING_QQ
- || initStyle == SCE_PL_STRING_QX
- || initStyle == SCE_PL_STRING_QR
+ if (initStyle == SCE_PL_STRING
+ || initStyle == SCE_PL_STRING_QQ
+ || initStyle == SCE_PL_BACKTICKS
+ || initStyle == SCE_PL_STRING_QX
+ || initStyle == SCE_PL_REGEX
+ || initStyle == SCE_PL_STRING_QR
+ || initStyle == SCE_PL_REGSUBST
+ || initStyle == SCE_PL_STRING_VAR
+ || initStyle == SCE_PL_STRING_QQ_VAR
+ || initStyle == SCE_PL_BACKTICKS_VAR
+ || initStyle == SCE_PL_STRING_QX_VAR
+ || initStyle == SCE_PL_REGEX_VAR
+ || initStyle == SCE_PL_STRING_QR_VAR
+ || initStyle == SCE_PL_REGSUBST_VAR
+ ) {
+ // for interpolation, must backtrack through a mix of two different styles
+ int otherStyle = (initStyle >= SCE_PL_STRING_VAR) ?
+ initStyle - INTERPOLATE_SHIFT : initStyle + INTERPOLATE_SHIFT;
+ while (startPos > 1) {
+ int st = styler.StyleAt(startPos - 1);
+ if ((st != initStyle) && (st != otherStyle))
+ break;
+ startPos--;
+ }
+ initStyle = SCE_PL_DEFAULT;
+ } else if (initStyle == SCE_PL_STRING_Q
|| initStyle == SCE_PL_STRING_QW
- || initStyle == SCE_PL_REGEX
- || initStyle == SCE_PL_REGSUBST
- || initStyle == SCE_PL_STRING
- || initStyle == SCE_PL_BACKTICKS
+ || initStyle == SCE_PL_XLAT
|| initStyle == SCE_PL_CHARACTER
|| initStyle == SCE_PL_NUMBER
|| initStyle == SCE_PL_IDENTIFIER
@@ -770,17 +879,48 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_PL_HERE_Q:
case SCE_PL_HERE_QQ:
- case SCE_PL_HERE_QX: {
- // also implies HereDoc.State == 2
- sc.Complete();
- while (!sc.atLineEnd)
- sc.Forward();
- char s[HERE_DELIM_MAX];
- sc.GetCurrent(s, sizeof(s));
- if (isMatch(HereDoc.Delimiter, s)) {
+ case SCE_PL_HERE_QX:
+ // also implies HereDoc.State == 2
+ sc.Complete();
+ if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) {
+ int c = sc.GetRelative(HereDoc.DelimiterLength);
+ if (c == '\r' || c == '\n') { // peek first, do not consume match
+ sc.Forward(HereDoc.DelimiterLength);
sc.SetState(SCE_PL_DEFAULT);
backFlag = BACK_NONE;
HereDoc.State = 0;
+ if (!sc.atLineEnd)
+ sc.Forward();
+ break;
+ }
+ }
+ if (sc.state == SCE_PL_HERE_Q) { // \EOF and 'EOF' non-interpolated
+ while (!sc.atLineEnd)
+ sc.Forward();
+ break;
+ }
+ while (!sc.atLineEnd) { // "EOF" and `EOF` interpolated
+ int s = 0, endType = 0;
+ int maxSeg = endPos - sc.currentPos;
+ while (s < maxSeg) { // scan to break string into segments
+ int c = sc.GetRelative(s);
+ if (c == '\\') {
+ endType = 1; break;
+ } else if (c == '\r' || c == '\n') {
+ endType = 2; break;
+ }
+ s++;
+ }
+ if (s > 0) // process non-empty segments
+ InterpolateSegment(sc, s);
+ if (endType == 1) {
+ sc.Forward();
+ // \ at end-of-line does not appear to have any effect, skip
+ if (sc.ch != '\r' && sc.ch != '\n')
+ sc.Forward();
+ } else if (endType == 2) {
+ if (!sc.atLineEnd)
+ sc.Forward();
}
}
break;
@@ -833,45 +973,89 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_PL_DEFAULT);
} else if (!Quote.Up && !IsASpace(sc.ch)) {
Quote.Open(sc.ch);
- } else if (sc.ch == '\\' && Quote.Up != '\\') {
- sc.Forward();
- } else if (sc.ch == Quote.Down) {
- Quote.Count--;
- if (Quote.Count == 0)
- Quote.Rep--;
- } else if (sc.ch == Quote.Up) {
- Quote.Count++;
+ } else {
+ int s = 0, endType = 0;
+ int maxSeg = endPos - sc.currentPos;
+ while (s < maxSeg) { // scan to break string into segments
+ int c = sc.GetRelative(s);
+ if (IsASpace(c)) {
+ break;
+ } else if (c == '\\' && Quote.Up != '\\') {
+ endType = 1; break;
+ } else if (c == Quote.Down) {
+ Quote.Count--;
+ if (Quote.Count == 0) {
+ Quote.Rep--;
+ break;
+ }
+ } else if (c == Quote.Up)
+ Quote.Count++;
+ s++;
+ }
+ if (s > 0) { // process non-empty segments
+ if (Quote.Up != '\'') {
+ InterpolateSegment(sc, s, true);
+ } else // non-interpolated path
+ sc.Forward(s);
+ }
+ if (endType == 1)
+ sc.Forward();
}
break;
case SCE_PL_REGSUBST:
+ case SCE_PL_XLAT:
if (Quote.Rep <= 0) {
if (!setModifiers.Contains(sc.ch))
sc.SetState(SCE_PL_DEFAULT);
} else if (!Quote.Up && !IsASpace(sc.ch)) {
Quote.Open(sc.ch);
- } else if (sc.ch == '\\' && Quote.Up != '\\') {
- sc.Forward();
- } else if (Quote.Count == 0 && Quote.Rep == 1) {
- // We matched something like s(...) or tr{...}, Perl 5.10
- // appears to allow almost any character for use as the
- // next delimiters. Whitespace and comments are accepted in
- // between, but we'll limit to whitespace here.
- // For '#', if no whitespace in between, it's a delimiter.
- if (IsASpace(sc.ch)) {
- // Keep going
- } else if (sc.ch == '#' && IsASpaceOrTab(sc.chPrev)) {
- sc.SetState(SCE_PL_DEFAULT);
- } else {
- Quote.Open(sc.ch);
+ } else {
+ int s = 0, endType = 0;
+ int maxSeg = endPos - sc.currentPos;
+ bool isPattern = (Quote.Rep == 2);
+ while (s < maxSeg) { // scan to break string into segments
+ int c = sc.GetRelative(s);
+ if (c == '\\' && Quote.Up != '\\') {
+ endType = 2; break;
+ } else if (Quote.Count == 0 && Quote.Rep == 1) {
+ // We matched something like s(...) or tr{...}, Perl 5.10
+ // appears to allow almost any character for use as the
+ // next delimiters. Whitespace and comments are accepted in
+ // between, but we'll limit to whitespace here.
+ // For '#', if no whitespace in between, it's a delimiter.
+ if (IsASpace(c)) {
+ // Keep going
+ } else if (c == '#' && IsASpaceOrTab(sc.GetRelative(s - 1))) {
+ endType = 3;
+ } else
+ Quote.Open(c);
+ break;
+ } else if (c == Quote.Down) {
+ Quote.Count--;
+ if (Quote.Count == 0) {
+ Quote.Rep--;
+ endType = 1;
+ }
+ if (Quote.Up == Quote.Down)
+ Quote.Count++;
+ if (endType == 1)
+ break;
+ } else if (c == Quote.Up) {
+ Quote.Count++;
+ } else if (IsASpace(c))
+ break;
+ s++;
+ }
+ if (s > 0) { // process non-empty segments
+ if (sc.state == SCE_PL_REGSUBST && Quote.Up != '\'') {
+ InterpolateSegment(sc, s, isPattern);
+ } else // non-interpolated path
+ sc.Forward(s);
}
- } else if (sc.ch == Quote.Down) {
- Quote.Count--;
- if (Quote.Count == 0)
- Quote.Rep--;
- if (Quote.Up == Quote.Down)
- Quote.Count++;
- } else if (sc.ch == Quote.Up) {
- Quote.Count++;
+ if (endType == 2) {
+ sc.Forward();
+ } else if (endType == 3)
+ sc.SetState(SCE_PL_DEFAULT);
}
break;
case SCE_PL_STRING_Q:
@@ -883,14 +1067,45 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
case SCE_PL_BACKTICKS:
if (!Quote.Down && !IsASpace(sc.ch)) {
Quote.Open(sc.ch);
- } else if (sc.ch == '\\' && Quote.Up != '\\') {
- sc.Forward();
- } else if (sc.ch == Quote.Down) {
- Quote.Count--;
- if (Quote.Count == 0)
+ } else {
+ int s = 0, endType = 0;
+ int maxSeg = endPos - sc.currentPos;
+ while (s < maxSeg) { // scan to break string into segments
+ int c = sc.GetRelative(s);
+ if (IsASpace(c)) {
+ break;
+ } else if (c == '\\' && Quote.Up != '\\') {
+ endType = 2; break;
+ } else if (c == Quote.Down) {
+ Quote.Count--;
+ if (Quote.Count == 0) {
+ endType = 3; break;
+ }
+ } else if (c == Quote.Up)
+ Quote.Count++;
+ s++;
+ }
+ if (s > 0) { // process non-empty segments
+ switch (sc.state) {
+ case SCE_PL_STRING:
+ case SCE_PL_STRING_QQ:
+ case SCE_PL_BACKTICKS:
+ InterpolateSegment(sc, s);
+ break;
+ case SCE_PL_STRING_QX:
+ if (Quote.Up != '\'') {
+ InterpolateSegment(sc, s);
+ break;
+ }
+ // (continued for ' delim)
+ default: // non-interpolated path
+ sc.Forward(s);
+ }
+ }
+ if (endType == 2) {
+ sc.Forward();
+ } else if (endType == 3)
sc.ForwardSetState(SCE_PL_DEFAULT);
- } else if (sc.ch == Quote.Up) {
- Quote.Count++;
}
break;
case SCE_PL_SUB_PROTOTYPE: {
@@ -910,12 +1125,13 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_PL_FORMAT: {
sc.Complete();
+ if (sc.Match('.')) {
+ sc.Forward();
+ if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n')))
+ sc.SetState(SCE_PL_DEFAULT);
+ }
while (!sc.atLineEnd)
sc.Forward();
- char s[10];
- sc.GetCurrent(s, sizeof(s));
- if (isMatch(".", s))
- sc.SetState(SCE_PL_DEFAULT);
}
break;
case SCE_PL_ERROR:
@@ -1000,9 +1216,9 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
numState = PERLNUM_DECIMAL;
dotCount = 0;
if (sc.ch == '0') { // hex,bin,octal
- if (sc.chNext == 'x') {
+ if (sc.chNext == 'x' || sc.chNext == 'X') {
numState = PERLNUM_HEX;
- } else if (sc.chNext == 'b') {
+ } else if (sc.chNext == 'b' || sc.chNext == 'B') {
numState = PERLNUM_BINARY;
} else if (IsADigit(sc.chNext)) {
numState = PERLNUM_OCTAL;
@@ -1032,10 +1248,10 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
sc.ChangeState(SCE_PL_STRING_Q);
Quote.New();
} else if (sc.ch == 'y' && !setWord.Contains(sc.chNext)) {
- sc.ChangeState(SCE_PL_REGSUBST);
+ sc.ChangeState(SCE_PL_XLAT);
Quote.New(2);
} else if (sc.Match('t', 'r') && !setWord.Contains(sc.GetRelative(2))) {
- sc.ChangeState(SCE_PL_REGSUBST);
+ sc.ChangeState(SCE_PL_XLAT);
Quote.New(2);
sc.Forward();
fw++;
@@ -1127,7 +1343,6 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
bool isHereDoc = sc.Match('<', '<');
bool hereDocSpace = false; // for: SCALAR [whitespace] '<<'
unsigned int bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0;
- unsigned int bkend;
sc.Complete();
styler.Flush();
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
@@ -1196,7 +1411,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
// keywords always forced as /PATTERN/: split, if, elsif, while
// everything else /PATTERN/ unless digit/space immediately after '/'
// for '//', defined-or favoured unless special keywords
- bkend = bk + 1;
+ unsigned int bkend = bk + 1;
while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) {
bk--;
}
diff --git a/plugins/scintilla/scintilla/LexPowerPro.cxx b/plugins/scintilla/scintilla/LexPowerPro.cxx
index 89bce58..e8a7a66 100644
--- a/plugins/scintilla/scintilla/LexPowerPro.cxx
+++ b/plugins/scintilla/scintilla/LexPowerPro.cxx
@@ -155,7 +155,7 @@ static void ColourisePowerProDoc(unsigned int startPos, int length, int initStyl
if ((sc.ch > 0) && setWord.Contains(sc.ch))
{
strcpy(s_save,s);
- int tp = strlen(s_save);
+ int tp = static_cast<int>(strlen(s_save));
if (tp < 99) {
s_save[tp] = static_cast<char>(tolower(sc.ch));
s_save[tp+1] = '\0';
diff --git a/plugins/scintilla/scintilla/LexPython.cxx b/plugins/scintilla/scintilla/LexPython.cxx
index 70db1ec..fedc312 100644
--- a/plugins/scintilla/scintilla/LexPython.cxx
+++ b/plugins/scintilla/scintilla/LexPython.cxx
@@ -165,6 +165,11 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
// Set to 1 to allow strings to span newline characters.
bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;
+ // property lexer.python.keywords2.no.sub.identifiers
+ // When enabled, it will not style keywords2 items that are used as a sub-identifier.
+ // Example: when set, will not highlight "foo.open" when "open" is a keywords2 item.
+ const bool keywords2NoSubIdentifiers = styler.GetPropertyInt("lexer.python.keywords2.no.sub.identifiers") != 0;
+
initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) {
initStyle = SCE_P_DEFAULT;
@@ -264,7 +269,16 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
}
} else if (keywords2.InList(s)) {
- style = SCE_P_WORD2;
+ if (keywords2NoSubIdentifiers) {
+ // We don't want to highlight keywords2
+ // that are used as a sub-identifier,
+ // i.e. not open in "foo.open".
+ int pos = styler.GetStartSegment() - 1;
+ if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.'))
+ style = SCE_P_WORD2;
+ } else {
+ style = SCE_P_WORD2;
+ }
}
sc.ChangeState(style);
sc.SetState(SCE_P_DEFAULT);
@@ -414,12 +428,8 @@ static bool IsQuoteLine(int line, Accessor &styler) {
static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
const int maxPos = startPos + length;
- const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
- const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
-
- // property fold.comment.python
- // This option enables folding multi-line comments when using the Python lexer.
- const bool foldComment = styler.GetPropertyInt("fold.comment.python") != 0;
+ const int maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line
+ const int docLines = styler.GetLine(styler.Length()); // Available last line
// property fold.quotes.python
// This option enables folding multi-line quoted strings when using the Python lexer.
@@ -450,14 +460,11 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
if (lineCurrent >= 1)
prev_state = styler.StyleAt(startPos - 1) & 31;
int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE));
- int prevComment = 0;
- if (lineCurrent >= 1)
- prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
// Process all characters to end of requested range or end of any triple quote
- // or comment that hangs over the end of the range. Cap processing in all cases
- // to end of document (in case of unclosed quote or comment at end).
- while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote || prevComment)) {
+ //that hangs over the end of the range. Cap processing in all cases
+ // to end of document (in case of unclosed quote at end).
+ while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote)) {
// Gather info
int lev = indentCurrent;
@@ -467,16 +474,13 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
- int style = styler.StyleAt(styler.LineStart(lineNext)) & 31;
+ int lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext);
+ int style = styler.StyleAt(lookAtPos) & 31;
quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
const int quote_start = (quote && !prevQuote);
const int quote_continue = (quote && prevQuote);
- const int comment = foldComment && IsCommentLine(lineCurrent, styler);
- const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
- IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
- const int comment_continue = (comment && prevComment);
- if ((!quote || !prevQuote) && !comment)
+ if (!quote || !prevQuote)
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
if (quote)
indentNext = indentCurrentLevel;
@@ -489,12 +493,6 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
} else if (quote_continue || prevQuote) {
// Add level to rest of lines in the string
lev = lev + 1;
- } else if (comment_start) {
- // Place fold point at start of a block of comments
- lev |= SC_FOLDLEVELHEADERFLAG;
- } else if (comment_continue) {
- // Add level to rest of lines in the block
- lev = lev + 1;
}
// Skip past any blank lines for next indent level info; we skip also
@@ -542,18 +540,17 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
}
}
- // Set fold header on non-quote/non-comment line
- if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
+ // Set fold header on non-quote line
+ if (!quote && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
lev |= SC_FOLDLEVELHEADERFLAG;
}
- // Keep track of triple quote and block comment state of previous line
+ // Keep track of triple quote state of previous line
prevQuote = quote;
- prevComment = comment_start || comment_continue;
// Set fold level for this line and move to next line
- styler.SetLevel(lineCurrent, lev);
+ styler.SetLevel(lineCurrent, foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG);
indentCurrent = indentNext;
lineCurrent = lineNext;
}
diff --git a/plugins/scintilla/scintilla/LexTeX.cxx b/plugins/scintilla/scintilla/LexTeX.cxx
index 7b79670..062c7ab 100644
--- a/plugins/scintilla/scintilla/LexTeX.cxx
+++ b/plugins/scintilla/scintilla/LexTeX.cxx
@@ -222,7 +222,7 @@ static void ColouriseTeXDoc(
sc.ForwardSetState(SCE_TEX_TEXT) ;
} else {
sc.GetCurrent(key, sizeof(key)-1) ;
- k = strlen(key) ;
+ k = static_cast<int>(strlen(key)) ;
memmove(key,key+1,k) ; // shift left over escape token
key[k] = '\0' ;
k-- ;
diff --git a/plugins/scintilla/scintilla/LexVHDL.cxx b/plugins/scintilla/scintilla/LexVHDL.cxx
index 58bcd1a..5580b3c 100644
--- a/plugins/scintilla/scintilla/LexVHDL.cxx
+++ b/plugins/scintilla/scintilla/LexVHDL.cxx
@@ -235,7 +235,7 @@ static void FoldNoBoxVHDLDoc(
}
}
}
- for(j=j+strlen(prevWord); j<endPos; j++)
+ for(j=j+static_cast<unsigned int>(strlen(prevWord)); j<endPos; j++)
{
char ch = styler.SafeGetCharAt(j);
int style = styler.StyleAt(j);
diff --git a/plugins/scintilla/scintilla/LexVerilog.cxx b/plugins/scintilla/scintilla/LexVerilog.cxx
index 8de04ff..ed39c2b 100644
--- a/plugins/scintilla/scintilla/LexVerilog.cxx
+++ b/plugins/scintilla/scintilla/LexVerilog.cxx
@@ -29,7 +29,7 @@ using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
- return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
+ return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\''|| ch == '$');
}
static inline bool IsAWordStart(const int ch) {
@@ -269,24 +269,36 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
if (styler.Match(j, "case") ||
styler.Match(j, "casex") ||
styler.Match(j, "casez") ||
+ styler.Match(j, "class") ||
styler.Match(j, "function") ||
- styler.Match(j, "fork") ||
- styler.Match(j, "table") ||
- styler.Match(j, "task") ||
styler.Match(j, "generate") ||
- styler.Match(j, "specify") ||
+ styler.Match(j, "covergroup") ||
+ styler.Match(j, "package") ||
styler.Match(j, "primitive") ||
+ styler.Match(j, "program") ||
+ styler.Match(j, "sequence") ||
+ styler.Match(j, "specify") ||
+ styler.Match(j, "table") ||
+ styler.Match(j, "task") ||
+ styler.Match(j, "fork") ||
(styler.Match(j, "module") && foldAtModule) ||
styler.Match(j, "begin")) {
levelNext++;
} else if (styler.Match(j, "endcase") ||
+ styler.Match(j, "endclass") ||
styler.Match(j, "endfunction") ||
- styler.Match(j, "join") ||
- styler.Match(j, "endtask") ||
styler.Match(j, "endgenerate") ||
- styler.Match(j, "endtable") ||
- styler.Match(j, "endspecify") ||
+ styler.Match(j, "endgroup") ||
+ styler.Match(j, "endpackage") ||
styler.Match(j, "endprimitive") ||
+ styler.Match(j, "endprogram") ||
+ styler.Match(j, "endsequence") ||
+ styler.Match(j, "endspecify") ||
+ styler.Match(j, "endtable") ||
+ styler.Match(j, "endtask") ||
+ styler.Match(j, "join") ||
+ styler.Match(j, "join_any") ||
+ styler.Match(j, "join_none") ||
(styler.Match(j, "endmodule") && foldAtModule) ||
(styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j+3)))) {
levelNext--;
diff --git a/plugins/scintilla/scintilla/LineMarker.cxx b/plugins/scintilla/scintilla/LineMarker.cxx
index 73410e2..b2b7cea 100644
--- a/plugins/scintilla/scintilla/LineMarker.cxx
+++ b/plugins/scintilla/scintilla/LineMarker.cxx
@@ -7,6 +7,9 @@
#include <string.h>
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "Scintilla.h"
@@ -38,6 +41,12 @@ void LineMarker::SetXPM(const char *const *linesForm) {
markType = SC_MARK_PIXMAP;
}
+void LineMarker::SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage) {
+ delete image;
+ image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, pixelsRGBAImage);
+ markType = SC_MARK_RGBAIMAGE;
+}
+
static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {
PRectangle rc;
rc.left = centreX - armSize;
@@ -75,10 +84,9 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
switch (tFold) {
case LineMarker::head :
+ case LineMarker::headWithTail :
head = backSelected;
tail = backSelected;
- if (markType == SC_MARK_VLINE)
- body = backSelected;
break;
case LineMarker::body :
head = backSelected;
@@ -98,6 +106,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
pxpm->Draw(surface, rcWhole);
return;
}
+ if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
+ surface->DrawRGBAImage(rcWhole, image->GetWidth(), image->GetHeight(), image->Pixels());
+ return;
+ }
// Restrict most shapes a bit
PRectangle rc = rcWhole;
rc.top++;
@@ -186,7 +198,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
} else if (markType == SC_MARK_VLINE) {
surface->PenColour(body.allocated);
- surface->MoveTo(centreX, rcWhole.top + blobSize - (rcWhole.bottom - rcWhole.top)/2);
+ surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, rcWhole.bottom);
} else if (markType == SC_MARK_LCORNER) {
@@ -232,7 +244,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
DrawPlus(surface, centreX, centreY, blobSize, tail.allocated);
} else if (markType == SC_MARK_BOXPLUSCONNECTED) {
- surface->PenColour(body.allocated);
+ if (tFold == LineMarker::headWithTail)
+ surface->PenColour(tail.allocated);
+ else
+ surface->PenColour(body.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
@@ -290,10 +305,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
DrawPlus(surface, centreX, centreY, blobSize, tail.allocated);
} else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {
- surface->PenColour(body.allocated);
+ if (tFold == LineMarker::headWithTail)
+ surface->PenColour(tail.allocated);
+ else
+ surface->PenColour(body.allocated);
surface->MoveTo(centreX, centreY + blobSize);
surface->LineTo(centreX, rcWhole.bottom);
+ surface->PenColour(body.allocated);
surface->MoveTo(centreX, rcWhole.top);
surface->LineTo(centreX, centreY - blobSize);
diff --git a/plugins/scintilla/scintilla/LineMarker.h b/plugins/scintilla/scintilla/LineMarker.h
index 39c38fa..6477a1f 100644
--- a/plugins/scintilla/scintilla/LineMarker.h
+++ b/plugins/scintilla/scintilla/LineMarker.h
@@ -17,7 +17,7 @@ namespace Scintilla {
*/
class LineMarker {
public:
- enum typeOfFold { undefined, head, body, tail };
+ enum typeOfFold { undefined, head, body, tail, headWithTail };
int markType;
ColourPair fore;
@@ -25,6 +25,7 @@ public:
ColourPair backSelected;
int alpha;
XPM *pxpm;
+ RGBAImage *image;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
@@ -32,6 +33,7 @@ public:
backSelected = ColourDesired(0xff,0x00,0x00);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
+ image = NULL;
}
LineMarker(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as real copy constructor
@@ -41,9 +43,11 @@ public:
backSelected = ColourDesired(0xff,0x00,0x00);
alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
+ image = NULL;
}
~LineMarker() {
delete pxpm;
+ delete image;
}
LineMarker &operator=(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as real assignment operator
@@ -54,11 +58,14 @@ public:
alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
+ delete image;
+ image = NULL;
return *this;
}
void RefreshColourPalette(Palette &pal, bool want);
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
+ void SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold);
};
diff --git a/plugins/scintilla/scintilla/Makefile.am b/plugins/scintilla/scintilla/Makefile.am
index 0df2e3b..700f2c0 100644
--- a/plugins/scintilla/scintilla/Makefile.am
+++ b/plugins/scintilla/scintilla/Makefile.am
@@ -121,6 +121,11 @@ update-scintilla:
cd $(srcdir); \
cp scintilla/gtk/*.cxx .; \
cp scintilla/gtk/*.h .; \
+ cp scintilla/gtk/*.list h.; \
+ cp scintilla/lexers/*.cxx .; \
+ cp scintilla/lexers/*.h .; \
+ cp scintilla/lexlib/*.cxx .; \
+ cp scintilla/lexlib/*.h .; \
cp scintilla/src/*.cxx .; \
cp scintilla/src/*.h .; \
cp scintilla/include/*.h include; \
diff --git a/plugins/scintilla/scintilla/PerLine.cxx b/plugins/scintilla/scintilla/PerLine.cxx
index 8fc6e25..7d961a8 100644
--- a/plugins/scintilla/scintilla/PerLine.cxx
+++ b/plugins/scintilla/scintilla/PerLine.cxx
@@ -425,10 +425,10 @@ void LineAnnotation::SetText(int line, const char *text) {
if (annotations[line]) {
delete []annotations[line];
}
- annotations[line] = AllocateAnnotation(strlen(text), style);
+ annotations[line] = AllocateAnnotation(static_cast<int>(strlen(text)), style);
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = static_cast<short>(style);
- pah->length = strlen(text);
+ pah->length = static_cast<int>(strlen(text));
pah->lines = static_cast<short>(NumberLines(text));
memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length);
} else {
diff --git a/plugins/scintilla/scintilla/PlatGTK.cxx b/plugins/scintilla/scintilla/PlatGTK.cxx
index f589d5e..850f201 100644
--- a/plugins/scintilla/scintilla/PlatGTK.cxx
+++ b/plugins/scintilla/scintilla/PlatGTK.cxx
@@ -9,6 +9,9 @@
#include <stddef.h>
#include <math.h>
+#include <vector>
+#include <map>
+
#include <glib.h>
#include <gmodule.h>
#include <gdk/gdk.h>
@@ -40,8 +43,28 @@
#define IS_WIDGET_FOCUSSED(w) (GTK_WIDGET_HAS_FOCUS(w))
#endif
-#if GTK_CHECK_VERSION(2,22,0)
#define USE_CAIRO 1
+
+#ifdef USE_CAIRO
+
+static cairo_surface_t *CreateSimilarSurface(GdkWindow *window, cairo_content_t content, int width, int height) {
+#if GTK_CHECK_VERSION(2,22,0)
+ return gdk_window_create_similar_surface(window, content, width, height);
+#else
+ cairo_surface_t *window_surface, *surface;
+
+ g_return_val_if_fail(GDK_IS_WINDOW(window), NULL);
+
+ window_surface = GDK_DRAWABLE_GET_CLASS(window)->ref_cairo_surface(window);
+
+ surface = cairo_surface_create_similar(window_surface, content, width, height);
+
+ cairo_surface_destroy(window_surface);
+
+ return surface;
+#endif
+}
+
#endif
static GdkWindow *WindowFromWidget(GtkWidget *w) {
@@ -296,9 +319,11 @@ void Palette::Allocate(Window &w) {
paletteNew[iPal].blue = entries[iPal].desired.GetBlue() * (65535 / 255);
paletteNew[iPal].pixel = entries[iPal].desired.AsLong();
}
+#ifndef USE_CAIRO
gdk_colormap_alloc_colors(gtk_widget_get_colormap(PWidget(w)),
paletteNew, allocatedLen, FALSE, TRUE,
successPalette);
+#endif
for (iPal = 0; iPal < used; iPal++) {
entries[iPal].allocated.Set(paletteNew[iPal].pixel);
}
@@ -771,6 +796,7 @@ public:
void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags);
+ void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
void Copy(PRectangle rc, Point from, Surface &surfaceSource);
@@ -984,8 +1010,8 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
PLATFORM_ASSERT(layout);
#ifdef USE_CAIRO
if (height > 0 && width > 0)
- psurf = gdk_window_create_similar_surface(
- gtk_widget_get_window(PWidget(wid)),
+ psurf = CreateSimilarSurface(
+ WindowFromWidget(PWidget(wid)),
CAIRO_CONTENT_COLOR_ALPHA, width, height);
#else
if (height > 0 && width > 0)
@@ -1015,18 +1041,10 @@ void SurfaceImpl::PenColour(ColourAllocated fore) {
#ifdef USE_CAIRO
if (context) {
ColourDesired cdFore(fore.AsLong());
-#if GTK_CHECK_VERSION(3,0,0)
- // Colours appear inverted - possibly because palette no longer used
cairo_set_source_rgb(context,
cdFore.GetRed() / 255.0,
cdFore.GetGreen() / 255.0,
cdFore.GetBlue() / 255.0);
-#else
- cairo_set_source_rgb(context,
- cdFore.GetBlue() / 255.0,
- cdFore.GetGreen() / 255.0,
- cdFore.GetRed() / 255.0);
-#endif
}
#else
if (gc) {
@@ -1236,7 +1254,12 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) {
double degrees = M_PI / 180.0;
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
cairo_new_sub_path(context);
+#else
+ // First arc is in the top-right corner and starts from a point on the top line
+ cairo_move_to(context, left + width - radius, top);
+#endif
cairo_arc(context, left + width - radius, top + radius, radius, -90 * degrees, 0 * degrees);
cairo_arc(context, left + width - radius, top + height - radius, radius, 0 * degrees, 90 * degrees);
cairo_arc(context, left + radius, top + height - radius, radius, 90 * degrees, 180 * degrees);
@@ -1266,8 +1289,6 @@ static guint32 u32FromRGBA(guint8 r, guint8 g, guint8 b, guint8 a) {
return converter.val;
}
-#endif
-
static unsigned int GetRValue(unsigned int co) {
return (co >> 16) & 0xff;
}
@@ -1280,24 +1301,34 @@ static unsigned int GetBValue(unsigned int co) {
return co & 0xff;
}
+#endif
+
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags) {
#ifdef USE_CAIRO
if (context && rc.Width() > 0) {
+ ColourDesired cdFill(fill.AsLong());
cairo_set_source_rgba(context,
- GetRValue(fill.AsLong()) / 255.0,
- GetGValue(fill.AsLong()) / 255.0,
- GetBValue(fill.AsLong()) / 255.0,
+ cdFill.GetRed() / 255.0,
+ cdFill.GetGreen() / 255.0,
+ cdFill.GetBlue() / 255.0,
alphaFill / 255.0);
- PathRoundRectangle(context, rc.left + 1.0, rc.top+1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0, cornerSize);
+ if (cornerSize > 0)
+ PathRoundRectangle(context, rc.left + 1.0, rc.top + 1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0, cornerSize);
+ else
+ cairo_rectangle(context, rc.left + 1.0, rc.top + 1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0);
cairo_fill(context);
+ ColourDesired cdOutline(outline.AsLong());
cairo_set_source_rgba(context,
- GetRValue(outline.AsLong()) / 255.0,
- GetGValue(outline.AsLong()) / 255.0,
- GetBValue(outline.AsLong()) / 255.0,
+ cdOutline.GetRed() / 255.0,
+ cdOutline.GetGreen() / 255.0,
+ cdOutline.GetBlue() / 255.0,
alphaOutline / 255.0);
- PathRoundRectangle(context, rc.left +0.5, rc.top+0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1, cornerSize);
+ if (cornerSize > 0)
+ PathRoundRectangle(context, rc.left + 0.5, rc.top + 0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1, cornerSize);
+ else
+ cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1);
cairo_stroke(context);
}
#else
@@ -1343,6 +1374,51 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated
#endif
}
+void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
+ if (rc.Width() > width)
+ rc.left += (rc.Width() - width) / 2;
+ rc.right = rc.left + width;
+ if (rc.Height() > height)
+ rc.top += (rc.Height() - height) / 2;
+ rc.bottom = rc.top + height;
+
+#ifdef USE_CAIRO
+ int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width);
+ int ucs = stride * height;
+ std::vector<unsigned char> image(ucs);
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ unsigned char *pixel = &image[0] + y*stride + x * 4;
+ unsigned char alpha = pixelsImage[3];
+ pixel[2] = (*pixelsImage++) * alpha / 255;
+ pixel[1] = (*pixelsImage++) * alpha / 255;
+ pixel[0] = (*pixelsImage++) * alpha / 255;
+ pixel[3] = *pixelsImage++;
+ }
+ }
+
+ cairo_surface_t *psurf = 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_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
+ cairo_fill(context);
+
+ cairo_surface_destroy(psurf);
+#else
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data(pixelsImage,
+ GDK_COLORSPACE_RGB,
+ TRUE,
+ 8,
+ width,
+ height,
+ width * 4,
+ NULL,
+ NULL);
+ gdk_draw_pixbuf(drawable, gc, pixbuf,
+ 0,0, rc.left,rc.top, width,height, GDK_RGB_DITHER_NORMAL, 0, 0);
+ g_object_unref(pixbuf);
+#endif
+}
+
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(back);
#ifdef USE_CAIRO
@@ -1524,7 +1600,6 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
int xText = rc.left;
if (PFont(font_)->pfd) {
char *utfForm = 0;
- bool useGFree = false;
if (et == UTF8) {
pango_layout_set_text(layout, s, len);
} else {
@@ -1558,11 +1633,7 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
#else
gdk_draw_layout_line(drawable, gc, xText, ybase, pll);
#endif
- if (useGFree) {
- g_free(utfForm);
- } else {
- delete []utfForm;
- }
+ delete []utfForm;
return;
}
#ifndef DISABLE_GDK_FONT
@@ -1740,7 +1811,6 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
}
if (positionsCalculated < 1 ) {
// Either Latin1 or DBCS conversion failed so treat as Latin1.
- bool useGFree = false;
SetConverter(PFont(font_)->characterSet);
char *utfForm = UTF8FromIconv(conv, s, len);
if (!utfForm) {
@@ -1762,11 +1832,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positi
}
clusterStart = clusterEnd;
}
- if (useGFree) {
- g_free(utfForm);
- } else {
- delete []utfForm;
- }
+ delete []utfForm;
PLATFORM_ASSERT(i == lenPositions);
}
}
@@ -1842,7 +1908,6 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
char *utfForm = 0;
pango_layout_set_font_description(layout, PFont(font_)->pfd);
PangoRectangle pos;
- bool useGFree = false;
if (et == UTF8) {
pango_layout_set_text(layout, s, len);
} else {
@@ -1865,11 +1930,7 @@ int SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
PangoLayoutLine *pangoLine = pango_layout_get_line(layout,0);
#endif
pango_layout_line_get_extents(pangoLine, NULL, &pos);
- if (useGFree) {
- g_free(utfForm);
- } else {
- delete []utfForm;
- }
+ delete []utfForm;
return PANGO_PIXELS(pos.width);
}
#ifndef DISABLE_GDK_FONT
@@ -2171,7 +2232,11 @@ void Window::SetCursor(Cursor curs) {
if (WindowFromWidget(PWidget(wid)))
gdk_window_set_cursor(WindowFromWidget(PWidget(wid)), gdkCurs);
+#if GTK_CHECK_VERSION(3,0,0)
+ g_object_unref(gdkCurs);
+#else
gdk_cursor_unref(gdkCurs);
+#endif
}
void Window::SetTitle(const char *s) {
@@ -2206,8 +2271,10 @@ PRectangle Window::GetMonitorRect(Point pt) {
#endif
}
+typedef std::map<int, RGBAImage*> ImageMap;
+
struct ListImage {
- const char *xpm_data;
+ const RGBAImage *rgba_data;
GdkPixbuf *pixbuf;
};
@@ -2235,7 +2302,7 @@ class ListBoxX : public ListBox {
WindowID scroller;
void *pixhash;
GtkCellRenderer* pixbuf_renderer;
- XPMSet xset;
+ RGBAImageSet images;
int desiredVisibleRows;
unsigned int maxItemCharacters;
unsigned int aveCharWidth;
@@ -2267,7 +2334,9 @@ public:
virtual int GetSelection();
virtual int Find(const char *prefix);
virtual void GetValue(int n, char *value, int len);
+ void RegisterRGBA(int type, RGBAImage *image);
virtual void RegisterImage(int type, const char *xpm_data);
+ virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage);
virtual void ClearRegisteredImages();
virtual void SetDoubleClickAction(CallBackAction action, void *data) {
doubleClickAction = action;
@@ -2492,25 +2561,21 @@ void ListBoxX::Clear() {
}
static void init_pixmap(ListImage *list_image) {
- const char *textForm = list_image->xpm_data;
- const char * const * xpm_lineform = reinterpret_cast<const char * const *>(textForm);
- const char **xpm_lineformfromtext = 0;
- // The XPM data can be either in atext form as will be read from a file
- // or in a line form (array of char *) as will be used for images defined in code.
- // Test for text form and convert to line form
- if ((0 == memcmp(textForm, "/* X", 4)) && (0 == memcmp(textForm, "/* XPM */", 9))) {
- // Test done is two parts to avoid possibility of overstepping the memory
- // if memcmp implemented strangely. Must be 4 bytes at least at destination.
- xpm_lineformfromtext = XPM::LinesFormFromTextForm(textForm);
- xpm_lineform = xpm_lineformfromtext;
- }
-
- // Drop any existing pixmap/bitmap as data may have changed
- if (list_image->pixbuf)
- g_object_unref(list_image->pixbuf);
- list_image->pixbuf =
- gdk_pixbuf_new_from_xpm_data((const gchar**)xpm_lineform);
- delete []xpm_lineformfromtext;
+ if (list_image->rgba_data) {
+ // Drop any existing pixmap/bitmap as data may have changed
+ if (list_image->pixbuf)
+ g_object_unref(list_image->pixbuf);
+ list_image->pixbuf =
+ gdk_pixbuf_new_from_data(list_image->rgba_data->Pixels(),
+ GDK_COLORSPACE_RGB,
+ TRUE,
+ 8,
+ list_image->rgba_data->GetWidth(),
+ list_image->rgba_data->GetHeight(),
+ list_image->rgba_data->GetWidth() * 4,
+ NULL,
+ NULL);
+ }
}
#define SPACING 5
@@ -2678,13 +2743,8 @@ void ListBoxX::GetValue(int n, char *value, int len) {
#pragma warning(disable: 4127)
#endif
-void ListBoxX::RegisterImage(int type, const char *xpm_data) {
- g_return_if_fail(xpm_data);
-
- // Saved and use the saved copy so caller's copy can disappear.
- xset.Add(type, xpm_data);
- XPM *pxpm = xset.Get(type);
- xpm_data = reinterpret_cast<const char *>(pxpm->InLinesForm());
+void ListBoxX::RegisterRGBA(int type, RGBAImage *image) {
+ images.Add(type, image);
if (!pixhash) {
pixhash = g_hash_table_new(g_direct_hash, g_direct_equal);
@@ -2696,17 +2756,27 @@ void ListBoxX::RegisterImage(int type, const char *xpm_data) {
if (list_image->pixbuf)
g_object_unref(list_image->pixbuf);
list_image->pixbuf = NULL;
- list_image->xpm_data = xpm_data;
+ list_image->rgba_data = image;
} else {
list_image = g_new0(ListImage, 1);
- list_image->xpm_data = xpm_data;
+ list_image->rgba_data = image;
g_hash_table_insert((GHashTable *) pixhash, GINT_TO_POINTER(type),
(gpointer) list_image);
}
}
+void ListBoxX::RegisterImage(int type, const char *xpm_data) {
+ g_return_if_fail(xpm_data);
+ XPM xpmImage(xpm_data);
+ RegisterRGBA(type, new RGBAImage(xpmImage));
+}
+
+void ListBoxX::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) {
+ RegisterRGBA(type, new RGBAImage(width, height, pixelsImage));
+}
+
void ListBoxX::ClearRegisteredImages() {
- xset.Clear();
+ images.Clear();
}
void ListBoxX::SetList(const char *listText, char separator, char typesep) {
@@ -2902,7 +2972,8 @@ bool Platform::IsDBCSLeadByte(int codePage, char ch) {
case 932:
// Shift_jis
return ((uch >= 0x81) && (uch <= 0x9F)) ||
- ((uch >= 0xE0) && (uch <= 0xEF));
+ ((uch >= 0xE0) && (uch <= 0xFC));
+ // Lead bytes F0 to FC may be a Microsoft addition.
case 936:
// GBK
return (uch >= 0x81) && (uch <= 0xFE);
diff --git a/plugins/scintilla/scintilla/PositionCache.cxx b/plugins/scintilla/scintilla/PositionCache.cxx
index e59c126..2105c29 100644
--- a/plugins/scintilla/scintilla/PositionCache.cxx
+++ b/plugins/scintilla/scintilla/PositionCache.cxx
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include <map>
#include "Platform.h"
@@ -541,16 +542,16 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_,
}
}
-int PositionCacheEntry::Hash(unsigned int styleNumber, const char *s, unsigned int len) {
+int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) {
unsigned int ret = s[0] << 7;
- for (unsigned int i=0; i<len; i++) {
+ for (unsigned int i=0; i<len_; i++) {
ret *= 1000003;
ret ^= s[i];
}
ret *= 1000003;
- ret ^= len;
+ ret ^= len_;
ret *= 1000003;
- ret ^= styleNumber;
+ ret ^= styleNumber_;
return ret;
}
@@ -604,11 +605,11 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned
// Two way associative: try two probe positions.
int hashValue = PositionCacheEntry::Hash(styleNumber, s, len);
- probe = hashValue % size;
+ probe = static_cast<int>(hashValue % size);
if (pces[probe].Retrieve(styleNumber, s, len, positions)) {
return;
}
- int probe2 = (hashValue * 37) % size;
+ int probe2 = static_cast<int>((hashValue * 37) % size);
if (pces[probe2].Retrieve(styleNumber, s, len, positions)) {
return;
}
diff --git a/plugins/scintilla/scintilla/PositionCache.h b/plugins/scintilla/scintilla/PositionCache.h
index 6abec6e..c6076ea 100644
--- a/plugins/scintilla/scintilla/PositionCache.h
+++ b/plugins/scintilla/scintilla/PositionCache.h
@@ -110,7 +110,7 @@ public:
void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock);
void Clear();
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const;
- static int Hash(unsigned int styleNumber, const char *s, unsigned int len);
+ static int Hash(unsigned int styleNumber_, const char *s, unsigned int len);
bool NewerThan(const PositionCacheEntry &other) const;
void ResetClock();
};
diff --git a/plugins/scintilla/scintilla/PropSetSimple.cxx b/plugins/scintilla/scintilla/PropSetSimple.cxx
index 6942f6e..ce2031f 100644
--- a/plugins/scintilla/scintilla/PropSetSimple.cxx
+++ b/plugins/scintilla/scintilla/PropSetSimple.cxx
@@ -61,9 +61,10 @@ void PropSetSimple::Set(const char *keyVal) {
endVal++;
const char *eqAt = strchr(keyVal, '=');
if (eqAt) {
- Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1);
+ Set(keyVal, eqAt + 1, static_cast<int>(eqAt-keyVal),
+ static_cast<int>(endVal - eqAt - 1));
} else if (*keyVal) { // No '=' so assume '=1'
- Set(keyVal, "1", endVal-keyVal, 1);
+ Set(keyVal, "1", static_cast<int>(endVal-keyVal), 1);
}
}
@@ -150,7 +151,7 @@ char *PropSetSimple::Expanded(const char *key) const {
int PropSetSimple::GetExpanded(const char *key, char *result) const {
char *val = Expanded(key);
- const int n = strlen(val);
+ const int n = static_cast<int>(strlen(val));
if (result) {
strcpy(result, val);
}
diff --git a/plugins/scintilla/scintilla/RESearch.cxx b/plugins/scintilla/scintilla/RESearch.cxx
index f26375f..ffcc58d 100644
--- a/plugins/scintilla/scintilla/RESearch.cxx
+++ b/plugins/scintilla/scintilla/RESearch.cxx
@@ -321,7 +321,7 @@ void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) {
}
}
-const unsigned char escapeValue(unsigned char ch) {
+unsigned char escapeValue(unsigned char ch) {
switch (ch) {
case 'a': return '\a';
case 'b': return '\b';
@@ -888,10 +888,10 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
return NOTFOUND;
break;
case BOT:
- bopat[*ap++] = lp;
+ bopat[static_cast<int>(*ap++)] = lp;
break;
case EOT:
- eopat[*ap++] = lp;
+ eopat[static_cast<int>(*ap++)] = lp;
break;
case BOW:
if ((lp!=bol && iswordc(ci.CharAt(lp-1))) || !iswordc(ci.CharAt(lp)))
diff --git a/plugins/scintilla/scintilla/RunStyles.cxx b/plugins/scintilla/scintilla/RunStyles.cxx
index 460d5d2..643d2fb 100644
--- a/plugins/scintilla/scintilla/RunStyles.cxx
+++ b/plugins/scintilla/scintilla/RunStyles.cxx
@@ -21,7 +21,7 @@ using namespace Scintilla;
#endif
// Find the first run at a position
-int RunStyles::RunFromPosition(int position) {
+int RunStyles::RunFromPosition(int position) const {
int run = starts->PartitionFromPosition(position);
// Go to first element with this position
while ((run > 0) && (position == starts->PositionFromPartition(run-1))) {
@@ -147,6 +147,8 @@ bool RunStyles::FillRange(int &position, int value, int &fillLength) {
runEnd = RunFromPosition(end);
RemoveRunIfSameAsPrevious(runEnd);
RemoveRunIfSameAsPrevious(runStart);
+ runEnd = RunFromPosition(end);
+ RemoveRunIfEmpty(runEnd);
return true;
} else {
return false;
@@ -216,3 +218,33 @@ void RunStyles::DeleteRange(int position, int deleteLength) {
}
}
+int RunStyles::Runs() const {
+ return starts->Partitions();
+}
+
+bool RunStyles::AllSame() const {
+ for (int run = 1; run < starts->Partitions(); run++) {
+ if (styles->ValueAt(run) != styles->ValueAt(run - 1))
+ return false;
+ }
+ return true;
+}
+
+bool RunStyles::AllSameAs(int value) const {
+ return AllSame() && (styles->ValueAt(0) == value);
+}
+
+int RunStyles::Find(int value, int start) const {
+ if (start < Length()) {
+ int run = start ? RunFromPosition(start) : 0;
+ if (styles->ValueAt(run) == value)
+ return start;
+ run++;
+ while (run < starts->Partitions()) {
+ if (styles->ValueAt(run) == value)
+ return starts->PositionFromPartition(run);
+ run++;
+ }
+ }
+ return -1;
+}
diff --git a/plugins/scintilla/scintilla/RunStyles.h b/plugins/scintilla/scintilla/RunStyles.h
index 0a333ca..a3efd93 100644
--- a/plugins/scintilla/scintilla/RunStyles.h
+++ b/plugins/scintilla/scintilla/RunStyles.h
@@ -15,10 +15,10 @@ namespace Scintilla {
#endif
class RunStyles {
-public:
+private:
Partitioning *starts;
SplitVector<int> *styles;
- int RunFromPosition(int position);
+ int RunFromPosition(int position) const;
int SplitRun(int position);
void RemoveRun(int run);
void RemoveRunIfEmpty(int run);
@@ -37,6 +37,10 @@ public:
void InsertSpace(int position, int insertLength);
void DeleteAll();
void DeleteRange(int position, int deleteLength);
+ int Runs() const;
+ bool AllSame() const;
+ bool AllSameAs(int value) const;
+ int Find(int value, int start) const;
};
#ifdef SCI_NAMESPACE
diff --git a/plugins/scintilla/scintilla/ScintillaBase.cxx b/plugins/scintilla/scintilla/ScintillaBase.cxx
index 3de4a45..da6b03e 100644
--- a/plugins/scintilla/scintilla/ScintillaBase.cxx
+++ b/plugins/scintilla/scintilla/ScintillaBase.cxx
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include <map>
#include "Platform.h"
@@ -204,7 +205,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
if (ac.chooseSingle && (listType == 0)) {
if (list && !strchr(list, ac.GetSeparator())) {
const char *typeSep = strchr(list, ac.GetTypesep());
- size_t lenInsert = (typeSep) ? (typeSep-list) : strlen(list);
+ int lenInsert = typeSep ?
+ static_cast<int>(typeSep-list) : static_cast<int>(strlen(list));
if (ac.ignoreCase) {
SetEmptySelection(sel.MainCaret() - lenEntered);
pdoc->DeleteChars(sel.MainCaret(), lenEntered);
@@ -393,7 +395,7 @@ int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) {
ac.lb->GetValue(item, selected, sizeof(selected));
if (buffer != NULL)
strcpy(buffer, selected);
- return strlen(selected);
+ return static_cast<int>(strlen(selected));
}
}
if (buffer != NULL)
@@ -760,6 +762,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
break;
+ case SCI_REGISTERRGBAIMAGE:
+ ac.lb->RegisterRGBAImage(wParam, sizeRGBAImage.x, sizeRGBAImage.y, reinterpret_cast<unsigned char *>(lParam));
+ break;
+
case SCI_CLEARREGISTEREDIMAGES:
ac.lb->ClearRegisteredImages();
break;
diff --git a/plugins/scintilla/scintilla/ScintillaGTK.cxx b/plugins/scintilla/scintilla/ScintillaGTK.cxx
index 5682fde..6f1f92f 100644
--- a/plugins/scintilla/scintilla/ScintillaGTK.cxx
+++ b/plugins/scintilla/scintilla/ScintillaGTK.cxx
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include <map>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -20,7 +21,7 @@
#include "Platform.h"
#if PLAT_GTK_WIN32
-#include "windows.h"
+#include <windows.h>
#endif
#include "ILexer.h"
@@ -73,9 +74,7 @@
#define IS_WIDGET_VISIBLE(w) (GTK_WIDGET_VISIBLE(w))
#endif
-#if GTK_CHECK_VERSION(2,22,0)
#define USE_CAIRO 1
-#endif
static GdkWindow *WindowFromWidget(GtkWidget *w) {
#if GTK_CHECK_VERSION(3,0,0)
@@ -270,8 +269,13 @@ private:
gboolean KeyThis(GdkEventKey *event);
static gboolean KeyPress(GtkWidget *widget, GdkEventKey *event);
static gboolean KeyRelease(GtkWidget *widget, GdkEventKey *event);
+#if GTK_CHECK_VERSION(3,0,0)
+ gboolean DrawPreeditThis(GtkWidget *widget, cairo_t *cr);
+ static gboolean DrawPreedit(GtkWidget *widget, cairo_t *cr, ScintillaGTK *sciThis);
+#else
gboolean ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose);
static gboolean ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis);
+#endif
void CommitThis(char *str);
static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis);
void PreeditChangedThis();
@@ -401,6 +405,14 @@ ScintillaGTK::~ScintillaGTK() {
g_idle_remove_by_data(this);
}
+static void UnRefCursor(GdkCursor *cursor) {
+#if GTK_CHECK_VERSION(3,0,0)
+ g_object_unref(cursor);
+#else
+ gdk_cursor_unref(cursor);
+#endif
+}
+
void ScintillaGTK::RealizeThis(GtkWidget *widget) {
//Platform::DebugPrintf("ScintillaGTK::realize this\n");
#if GTK_CHECK_VERSION(2,20,0)
@@ -432,25 +444,30 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) {
gtk_widget_set_window(widget, gdk_window_new(gtk_widget_get_parent_window(widget), &attrs,
GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_CURSOR));
gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
- gdk_window_set_background(gtk_widget_get_window(widget),
- &(gtk_widget_get_style(widget)->bg[GTK_STATE_NORMAL]));
+ GtkStyleContext *styleContext = gtk_widget_get_style_context(widget);
+ if (styleContext) {
+ GdkRGBA colourBackWidget;
+ gtk_style_context_get_background_color(styleContext, GTK_STATE_FLAG_NORMAL, &colourBackWidget);
+ gdk_window_set_background_rgba(gtk_widget_get_window(widget), &colourBackWidget);
+ }
gdk_window_show(gtk_widget_get_window(widget));
- gdk_cursor_unref(cursor);
- // Deprecated: should chain up to parent class' "realize" implementation
- gtk_widget_style_attach(widget);
+ UnRefCursor(cursor);
#else
widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), &attrs,
GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR);
gdk_window_set_user_data(widget->window, widget);
+ widget->style = gtk_style_attach(widget->style, widget->window);
gdk_window_set_background(widget->window, &widget->style->bg[GTK_STATE_NORMAL]);
gdk_window_show(widget->window);
- gdk_cursor_unref(cursor);
- widget->style = gtk_style_attach(widget->style, widget->window);
+ UnRefCursor(cursor);
#endif
wPreedit = gtk_window_new(GTK_WINDOW_POPUP);
wPreeditDraw = gtk_drawing_area_new();
GtkWidget *predrw = PWidget(wPreeditDraw); // No code inside the G_OBJECT macro
-#if !GTK_CHECK_VERSION(3,0,0)
+#if GTK_CHECK_VERSION(3,0,0)
+ g_signal_connect(G_OBJECT(predrw), "draw",
+ G_CALLBACK(DrawPreedit), this);
+#else
g_signal_connect(G_OBJECT(predrw), "expose_event",
G_CALLBACK(ExposePreedit), this);
#endif
@@ -476,15 +493,15 @@ void ScintillaGTK::RealizeThis(GtkWidget *widget) {
cursor = gdk_cursor_new(GDK_XTERM);
gdk_window_set_cursor(PWindow(wText), cursor);
- gdk_cursor_unref(cursor);
+ UnRefCursor(cursor);
cursor = gdk_cursor_new(GDK_LEFT_PTR);
gdk_window_set_cursor(PWindow(scrollbarv), cursor);
- gdk_cursor_unref(cursor);
+ UnRefCursor(cursor);
cursor = gdk_cursor_new(GDK_LEFT_PTR);
gdk_window_set_cursor(PWindow(scrollbarh), cursor);
- gdk_cursor_unref(cursor);
+ UnRefCursor(cursor);
gtk_selection_add_targets(widget, GDK_SELECTION_PRIMARY,
clipboardCopyTargets, nClipboardCopyTargets);
@@ -2200,7 +2217,7 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) {
bool ctrl = (event->state & GDK_CONTROL_MASK) != 0;
bool alt = (event->state & GDK_MOD1_MASK) != 0;
guint key = event->keyval;
- if (ctrl && (key < 128))
+ if ((ctrl || alt) && (key < 128))
key = toupper(key);
#if GTK_CHECK_VERSION(3,0,0)
else if (!ctrl && (key >= GDK_KEY_KP_Multiply && key <= GDK_KEY_KP_9))
@@ -2214,7 +2231,17 @@ gboolean ScintillaGTK::KeyThis(GdkEventKey *event) {
key = KeyTranslate(key);
bool consumed = false;
+#if !(PLAT_GTK_MACOSX)
bool added = KeyDown(key, shift, ctrl, alt, &consumed) != 0;
+#else
+ bool meta = ctrl;
+ ctrl = alt;
+ alt = (event->state & GDK_MOD5_MASK) != 0;
+ bool added = KeyDownWithModifiers(key, (shift ? SCI_SHIFT : 0) |
+ (ctrl ? SCI_CTRL : 0) |
+ (alt ? SCI_ALT : 0) |
+ (meta ? SCI_META : 0), &consumed) != 0;
+#endif
if (!consumed)
consumed = added;
//fprintf(stderr, "SK-key: %d %x %x\n",event->keyval, event->state, consumed);
@@ -2236,11 +2263,45 @@ gboolean ScintillaGTK::KeyPress(GtkWidget *widget, GdkEventKey *event) {
return sciThis->KeyThis(event);
}
-gboolean ScintillaGTK::KeyRelease(GtkWidget *, GdkEventKey * /*event*/) {
+gboolean ScintillaGTK::KeyRelease(GtkWidget *widget, GdkEventKey *event) {
//Platform::DebugPrintf("SC-keyrel: %d %x %3s\n",event->keyval, event->state, event->string);
+ ScintillaGTK *sciThis = ScintillaFromWidget(widget);
+ if (gtk_im_context_filter_keypress(sciThis->im_context, event)) {
+ return TRUE;
+ }
return FALSE;
}
+#if GTK_CHECK_VERSION(3,0,0)
+
+gboolean ScintillaGTK::DrawPreeditThis(GtkWidget *widget, cairo_t *cr) {
+ try {
+ gchar *str;
+ gint cursor_pos;
+ PangoAttrList *attrs;
+
+ gtk_im_context_get_preedit_string(im_context, &str, &attrs, &cursor_pos);
+ PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str);
+ pango_layout_set_attributes(layout, attrs);
+
+ cairo_move_to(cr, 0, 0);
+ pango_cairo_show_layout(cr, layout);
+
+ g_free(str);
+ pango_attr_list_unref(attrs);
+ g_object_unref(layout);
+ } catch (...) {
+ errorStatus = SC_STATUS_FAILURE;
+ }
+ return TRUE;
+}
+
+gboolean ScintillaGTK::DrawPreedit(GtkWidget *widget, cairo_t *cr, ScintillaGTK *sciThis) {
+ return sciThis->DrawPreeditThis(widget, cr);
+}
+
+#else
+
gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose) {
try {
gchar *str;
@@ -2251,7 +2312,12 @@ gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose)
PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str);
pango_layout_set_attributes(layout, attrs);
-#ifndef USE_CAIRO
+#ifdef USE_CAIRO
+ cairo_t *context = gdk_cairo_create(reinterpret_cast<GdkDrawable *>(WindowFromWidget(widget)));
+ cairo_move_to(context, 0, 0);
+ pango_cairo_show_layout(context, layout);
+ cairo_destroy(context);
+#else
GdkGC *gc = gdk_gc_new(widget->window);
GdkColor color[2] = { {0, 0x0000, 0x0000, 0x0000},
{0, 0xffff, 0xffff, 0xffff}
@@ -2281,6 +2347,8 @@ gboolean ScintillaGTK::ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, Sci
return sciThis->ExposePreeditThis(widget, ose);
}
+#endif
+
void ScintillaGTK::CommitThis(char *utfVal) {
try {
//~ fprintf(stderr, "Commit '%s'\n", utfVal);
diff --git a/plugins/scintilla/scintilla/SparseState.h b/plugins/scintilla/scintilla/SparseState.h
index 655d742..08ff104 100644
--- a/plugins/scintilla/scintilla/SparseState.h
+++ b/plugins/scintilla/scintilla/SparseState.h
@@ -92,7 +92,7 @@ public:
changed = true;
}
typename stateVector::const_iterator startOther = other.states.begin();
- if (!states.empty() && states.back().value == startOther->value)
+ if (!states.empty() && !other.states.empty() && states.back().value == startOther->value)
++startOther;
if (startOther != other.states.end()) {
states.insert(states.end(), startOther, other.states.end());
diff --git a/plugins/scintilla/scintilla/Style.cxx b/plugins/scintilla/scintilla/Style.cxx
index 25efcd6..fc250f0 100644
--- a/plugins/scintilla/scintilla/Style.cxx
+++ b/plugins/scintilla/scintilla/Style.cxx
@@ -54,13 +54,13 @@ void FontMeasurements::Clear() {
sizeZoomed = 2;
}
-Style::Style() {
+Style::Style() : FontSpecification() {
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,
false, false, false, false, caseMixed, true, true, false);
}
-Style::Style(const Style &source) {
+Style::Style(const Style &source) : FontSpecification(), FontMeasurements() {
Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),
0, 0, 0,
false, false, false, false, caseMixed, true, true, false);
@@ -142,8 +142,8 @@ void Style::ClearTo(const Style &source) {
void Style::Copy(Font &font_, const FontMeasurements &fm_) {
font.MakeAlias(font_);
- (FontMeasurements &)(*this) = fm_;
#if PLAT_WX
- ascent = surface.Ascent(font);
+ font.SetAscent(fm_.ascent);
#endif
+ (FontMeasurements &)(*this) = fm_;
}
diff --git a/plugins/scintilla/scintilla/StyleContext.h b/plugins/scintilla/scintilla/StyleContext.h
index 15d216b..c2d223e 100644
--- a/plugins/scintilla/scintilla/StyleContext.h
+++ b/plugins/scintilla/scintilla/StyleContext.h
@@ -55,7 +55,6 @@ public:
styler(styler_),
endPos(startPos + length),
currentPos(startPos),
- atLineStart(true),
atLineEnd(false),
state(initStyle & chMask), // Mask off all bits which aren't in the chMask.
chPrev(0),
@@ -63,6 +62,7 @@ public:
chNext(0) {
styler.StartAt(startPos, chMask);
styler.StartSegment(startPos);
+ atLineStart = static_cast<unsigned int>(styler.LineStart(styler.GetLine(startPos))) == startPos;
unsigned int pos = currentPos;
ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
if (styler.IsLeadByte(static_cast<char>(ch))) {
diff --git a/plugins/scintilla/scintilla/ViewStyle.cxx b/plugins/scintilla/scintilla/ViewStyle.cxx
index 58e0ede..9ba69b1 100644
--- a/plugins/scintilla/scintilla/ViewStyle.cxx
+++ b/plugins/scintilla/scintilla/ViewStyle.cxx
@@ -7,6 +7,9 @@
#include <string.h>
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "Scintilla.h"
@@ -78,6 +81,7 @@ FontRealised::FontRealised(const FontSpecification &fs) {
}
FontRealised::~FontRealised() {
+ font.Release();
delete frNext;
frNext = 0;
}
diff --git a/plugins/scintilla/scintilla/WordList.cxx b/plugins/scintilla/scintilla/WordList.cxx
index cda35ec..9c2c965 100644
--- a/plugins/scintilla/scintilla/WordList.cxx
+++ b/plugins/scintilla/scintilla/WordList.cxx
@@ -11,6 +11,8 @@
#include <stdio.h>
#include <stdarg.h>
+#include <algorithm>
+
#include "WordList.h"
#ifdef SCI_NAMESPACE
@@ -86,22 +88,34 @@ void WordList::Clear() {
len = 0;
}
-extern "C" int cmpString(const void *a1, const void *a2) {
- // Can't work out the correct incantation to use modern casts here
- return strcmp(*(char **)(a1), *(char **)(a2));
+#ifdef _MSC_VER
+
+static bool cmpWords(const char *a, const char *b) {
+ return strcmp(a, b) == -1;
+}
+
+#else
+
+static int cmpWords(const void *a, const void *b) {
+ return strcmp(*static_cast<const char * const *>(a), *static_cast<const char * const *>(b));
}
static void SortWordList(char **words, unsigned int len) {
- qsort(reinterpret_cast<void *>(words), len, sizeof(*words),
- cmpString);
+ qsort(reinterpret_cast<void *>(words), len, sizeof(*words), cmpWords);
}
+#endif
+
void WordList::Set(const char *s) {
Clear();
list = new char[strlen(s) + 1];
strcpy(list, s);
words = ArrayFromWordList(list, &len, onlyLineEnds);
+#ifdef _MSC_VER
+ std::sort(words, words + len, cmpWords);
+#else
SortWordList(words, len);
+#endif
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
@@ -121,7 +135,7 @@ bool WordList::InList(const char *s) const {
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
- while ((unsigned char)words[j][0] == firstChar) {
+ while (static_cast<unsigned char>(words[j][0]) == firstChar) {
if (s[1] == words[j][1]) {
const char *a = words[j] + 1;
const char *b = s + 1;
@@ -163,7 +177,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const {
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
- while (words[j][0] == firstChar) {
+ while (static_cast<unsigned char>(words[j][0]) == firstChar) {
bool isSubword = false;
int start = 1;
if (words[j][1] == marker) {
diff --git a/plugins/scintilla/scintilla/XPM.cxx b/plugins/scintilla/scintilla/XPM.cxx
index d1389ef..f0277c6 100644
--- a/plugins/scintilla/scintilla/XPM.cxx
+++ b/plugins/scintilla/scintilla/XPM.cxx
@@ -8,6 +8,13 @@
#include <string.h>
#include <stdlib.h>
+#ifdef _MSC_VER
+#pragma warning(disable: 4786)
+#endif
+
+#include <vector>
+#include <map>
+
#include "Platform.h"
#include "XPM.h"
@@ -38,6 +45,10 @@ static size_t MeasureLength(const char *s) {
return i;
}
+ColourDesired XPM::ColourDesiredFromCode(int ch) const {
+ return colourCodeTable[ch]->desired;
+}
+
ColourAllocated XPM::ColourFromCode(int ch) const {
return colourCodeTable[ch]->allocated;
#ifdef SLOW
@@ -200,6 +211,21 @@ void XPM::Draw(Surface *surface, PRectangle &rc) {
}
}
+void XPM::PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const {
+ if (!data || !codes || !colours || !lines || (x<0) || (x >= width) || (y<0) || (y >= height)) {
+ colour = 0;
+ transparent = true;
+ return;
+ }
+ int code = lines[y+nColours+1][x];
+ transparent = code == codeTransparent;
+ if (transparent) {
+ colour = 0;
+ } else {
+ colour = ColourDesiredFromCode(code).AsLong();
+ }
+}
+
const char **XPM::LinesFormFromTextForm(const char *textForm) {
// Build the lines form out of the text form
const char **linesForm = 0;
@@ -261,14 +287,14 @@ void XPMSet::Clear() {
width = -1;
}
-void XPMSet::Add(int id, const char *textForm) {
+void XPMSet::Add(int ident, const char *textForm) {
// Invalidate cached dimensions
height = -1;
width = -1;
// Replace if this id already present
for (int i = 0; i < len; i++) {
- if (set[i]->GetId() == id) {
+ if (set[i]->GetId() == ident) {
set[i]->Init(textForm);
set[i]->CopyDesiredColours();
return;
@@ -278,7 +304,7 @@ void XPMSet::Add(int id, const char *textForm) {
// Not present, so add to end
XPM *pxpm = new XPM(textForm);
if (pxpm) {
- pxpm->SetId(id);
+ pxpm->SetId(ident);
pxpm->CopyDesiredColours();
if (len == maximum) {
maximum += 64;
@@ -294,9 +320,9 @@ void XPMSet::Add(int id, const char *textForm) {
}
}
-XPM *XPMSet::Get(int id) {
+XPM *XPMSet::Get(int ident) {
for (int i = 0; i < len; i++) {
- if (set[i]->GetId() == id) {
+ if (set[i]->GetId() == ident) {
return set[i];
}
}
@@ -324,3 +350,110 @@ int XPMSet::GetWidth() {
}
return (width > 0) ? width : 0;
}
+
+RGBAImage::RGBAImage(int width_, int height_, const unsigned char *pixels_) :
+ height(height_), width(width_) {
+ if (pixels_) {
+ pixelBytes.assign(pixels_, pixels_ + CountBytes());
+ } else {
+ pixelBytes.resize(CountBytes());
+ }
+}
+
+RGBAImage::RGBAImage(const XPM &xpm) {
+ height = xpm.GetHeight();
+ width = xpm.GetWidth();
+ pixelBytes.resize(CountBytes());
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ ColourDesired colour;
+ bool transparent = false;
+ xpm.PixelAt(x, y, colour, transparent);
+ SetPixel(x, y, colour, transparent ? 0 : 255);
+ }
+ }
+}
+
+RGBAImage::~RGBAImage() {
+}
+
+int RGBAImage::CountBytes() const {
+ return width * height * 4;
+}
+
+const unsigned char *RGBAImage::Pixels() const {
+ return &pixelBytes[0];
+}
+
+void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) {
+ unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4;
+ // RGBA
+ pixel[0] = colour.GetRed();
+ pixel[1] = colour.GetGreen();
+ pixel[2] = colour.GetBlue();
+ pixel[3] = alpha;
+}
+
+RGBAImageSet::RGBAImageSet() : height(-1), width(-1){
+}
+
+RGBAImageSet::~RGBAImageSet() {
+ Clear();
+}
+
+/// Remove all images.
+void RGBAImageSet::Clear() {
+ for (ImageMap::iterator it=images.begin(); it != images.end(); ++it) {
+ delete it->second;
+ it->second = 0;
+ }
+ images.clear();
+ height = -1;
+ width = -1;
+}
+
+/// Add an image.
+void RGBAImageSet::Add(int ident, RGBAImage *image) {
+ ImageMap::iterator it=images.find(ident);
+ if (it == images.end()) {
+ images[ident] = image;
+ } else {
+ delete it->second;
+ it->second = image;
+ }
+ height = -1;
+ width = -1;
+}
+
+/// Get image by id.
+RGBAImage *RGBAImageSet::Get(int ident) {
+ ImageMap::iterator it = images.find(ident);
+ if (it != images.end()) {
+ return it->second;
+ }
+ return NULL;
+}
+
+/// Give the largest height of the set.
+int RGBAImageSet::GetHeight() const {
+ if (height < 0) {
+ for (ImageMap::const_iterator it=images.begin(); it != images.end(); ++it) {
+ if (height < it->second->GetHeight()) {
+ height = it->second->GetHeight();
+ }
+ }
+ }
+ return (height > 0) ? height : 0;
+}
+
+/// Give the largest width of the set.
+int RGBAImageSet::GetWidth() const {
+ if (width < 0) {
+ for (ImageMap::const_iterator it=images.begin(); it != images.end(); ++it) {
+ if (width < it->second->GetWidth()) {
+ width = it->second->GetWidth();
+ }
+ }
+ }
+ return (width > 0) ? width : 0;
+}
diff --git a/plugins/scintilla/scintilla/XPM.h b/plugins/scintilla/scintilla/XPM.h
index cb05aae..b9c7308 100644
--- a/plugins/scintilla/scintilla/XPM.h
+++ b/plugins/scintilla/scintilla/XPM.h
@@ -24,6 +24,7 @@ class XPM {
char codeTransparent;
char *codes;
ColourPair *colours;
+ ColourDesired ColourDesiredFromCode(int ch) const;
ColourAllocated ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x);
char **lines;
@@ -46,6 +47,7 @@ public:
int GetId() const { return pid; }
int GetHeight() const { return height; }
int GetWidth() const { return width; }
+ void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const;
static const char **LinesFormFromTextForm(const char *textForm);
};
@@ -64,15 +66,59 @@ public:
/// Remove all XPMs.
void Clear();
/// Add a XPM.
- void Add(int id, const char *textForm);
+ void Add(int ident, const char *textForm);
/// Get XPM by id.
- XPM *Get(int id);
+ XPM *Get(int ident);
/// Give the largest height of the set.
int GetHeight();
/// Give the largest width of the set.
int GetWidth();
};
+/**
+ * An translucent image stoed as a sequence of RGBA bytes.
+ */
+class RGBAImage {
+ // Private so RGBAImage objects can not be copied
+ RGBAImage(const RGBAImage &);
+ RGBAImage &operator=(const RGBAImage &);
+ int height;
+ int width;
+ std::vector<unsigned char> pixelBytes;
+public:
+ RGBAImage(int width_, int height_, const unsigned char *pixels_);
+ RGBAImage(const XPM &xpm);
+ virtual ~RGBAImage();
+ int GetHeight() const { return height; }
+ int GetWidth() const { return width; }
+ int CountBytes() const;
+ const unsigned char *Pixels() const;
+ void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);
+};
+
+/**
+ * A collection of RGBAImage pixmaps indexed by integer id.
+ */
+class RGBAImageSet {
+ typedef std::map<int, RGBAImage*> ImageMap;
+ ImageMap images;
+ mutable int height; ///< Memorize largest height of the set.
+ mutable int width; ///< Memorize largest width of the set.
+public:
+ RGBAImageSet();
+ ~RGBAImageSet();
+ /// Remove all images.
+ void Clear();
+ /// Add an image.
+ void Add(int ident, RGBAImage *image);
+ /// Get image by id.
+ RGBAImage *Get(int ident);
+ /// Give the largest height of the set.
+ int GetHeight() const;
+ /// Give the largest width of the set.
+ int GetWidth() const;
+};
+
#ifdef SCI_NAMESPACE
}
#endif
diff --git a/plugins/scintilla/scintilla/include/Platform.h b/plugins/scintilla/scintilla/include/Platform.h
index fd36a32..b0f3de0 100644
--- a/plugins/scintilla/scintilla/include/Platform.h
+++ b/plugins/scintilla/scintilla/include/Platform.h
@@ -16,6 +16,7 @@
#define PLAT_GTK 0
#define PLAT_GTK_WIN32 0
+#define PLAT_GTK_MACOSX 0
#define PLAT_MACOSX 0
#define PLAT_WIN 0
#define PLAT_WX 0
@@ -38,6 +39,11 @@
#define PLAT_GTK_WIN32 1
#endif
+#if defined(__APPLE__)
+#undef PLAT_GTK_MACOSX
+#define PLAT_GTK_MACOSX 1
+#endif
+
#elif defined(__APPLE__)
#undef PLAT_MACOSX
@@ -301,6 +307,9 @@ public:
FontID GetID() { return fid; }
// Alias another font - caller guarantees not to Release
void SetID(FontID fid_) { fid = fid_; }
+#if PLAT_WX
+ void SetAscent(int ascent_) { ascent = ascent_; }
+#endif
friend class Surface;
friend class SurfaceImpl;
};
@@ -336,6 +345,7 @@ public:
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
ColourAllocated outline, int alphaOutline, int flags)=0;
+ virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
@@ -443,6 +453,7 @@ public:
virtual int Find(const char *prefix)=0;
virtual void GetValue(int n, char *value, int len)=0;
virtual void RegisterImage(int type, const char *xpm_data)=0;
+ virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void ClearRegisteredImages()=0;
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
virtual void SetList(const char* list, char separator, char typesep)=0;
diff --git a/plugins/scintilla/scintilla/include/SciLexer.h b/plugins/scintilla/scintilla/include/SciLexer.h
index 1d5b69e..e8805f2 100644
--- a/plugins/scintilla/scintilla/include/SciLexer.h
+++ b/plugins/scintilla/scintilla/include/SciLexer.h
@@ -344,6 +344,16 @@
#define SCE_PL_SUB_PROTOTYPE 40
#define SCE_PL_FORMAT_IDENT 41
#define SCE_PL_FORMAT 42
+#define SCE_PL_STRING_VAR 43
+#define SCE_PL_XLAT 44
+#define SCE_PL_REGEX_VAR 54
+#define SCE_PL_REGSUBST_VAR 55
+#define SCE_PL_BACKTICKS_VAR 57
+#define SCE_PL_HERE_QQ_VAR 61
+#define SCE_PL_HERE_QX_VAR 62
+#define SCE_PL_STRING_QQ_VAR 64
+#define SCE_PL_STRING_QX_VAR 65
+#define SCE_PL_STRING_QR_VAR 66
#define SCE_RB_DEFAULT 0
#define SCE_RB_ERROR 1
#define SCE_RB_COMMENTLINE 2
@@ -408,6 +418,14 @@
#define SCE_L_TAG 2
#define SCE_L_MATH 3
#define SCE_L_COMMENT 4
+#define SCE_L_TAG2 5
+#define SCE_L_MATH2 6
+#define SCE_L_COMMENT2 7
+#define SCE_L_VERBATIM 8
+#define SCE_L_SHORTCMD 9
+#define SCE_L_SPECIAL 10
+#define SCE_L_CMDOPT 11
+#define SCE_L_ERROR 12
#define SCE_LUA_DEFAULT 0
#define SCE_LUA_COMMENT 1
#define SCE_LUA_COMMENTLINE 2
@@ -428,6 +446,7 @@
#define SCE_LUA_WORD6 17
#define SCE_LUA_WORD7 18
#define SCE_LUA_WORD8 19
+#define SCE_LUA_LABEL 20
#define SCE_ERR_DEFAULT 0
#define SCE_ERR_PYTHON 1
#define SCE_ERR_GCC 2
diff --git a/plugins/scintilla/scintilla/include/Scintilla.h b/plugins/scintilla/scintilla/include/Scintilla.h
index 0700736..bc4927a 100644
--- a/plugins/scintilla/scintilla/include/Scintilla.h
+++ b/plugins/scintilla/scintilla/include/Scintilla.h
@@ -130,6 +130,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_LEFTRECT 27
#define SC_MARK_AVAILABLE 28
#define SC_MARK_UNDERLINE 29
+#define SC_MARK_RGBAIMAGE 30
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@@ -254,6 +255,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_BOX 6
#define INDIC_ROUNDBOX 7
#define INDIC_STRAIGHTBOX 8
+#define INDIC_DASH 9
+#define INDIC_DOTS 10
+#define INDIC_SQUIGGLELOW 11
+#define INDIC_DOTBOX 12
#define INDIC_MAX 31
#define INDIC_CONTAINER 8
#define INDIC0_MASK 0x20
@@ -337,6 +342,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETSELECTIONSTART 2143
#define SCI_SETSELECTIONEND 2144
#define SCI_GETSELECTIONEND 2145
+#define SCI_SETEMPTYSELECTION 2556
#define SCI_SETPRINTMAGNIFICATION 2146
#define SCI_GETPRINTMAGNIFICATION 2147
#define SC_PRINT_NORMAL 0
@@ -734,6 +740,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARGINTEXTCLEARALL 2536
#define SCI_MARGINSETSTYLEOFFSET 2537
#define SCI_MARGINGETSTYLEOFFSET 2538
+#define SC_MARGINOPTION_NONE 0
+#define SC_MARGINOPTION_SUBLINESELECT 1
+#define SCI_SETMARGINOPTIONS 2539
+#define SCI_GETMARGINOPTIONS 2557
#define SCI_ANNOTATIONSETTEXT 2540
#define SCI_ANNOTATIONGETTEXT 2541
#define SCI_ANNOTATIONSETSTYLE 2542
@@ -807,6 +817,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_VERTICALCENTRECARET 2619
#define SCI_MOVESELECTEDLINESUP 2620
#define SCI_MOVESELECTEDLINESDOWN 2621
+#define SCI_SETIDENTIFIER 2622
+#define SCI_GETIDENTIFIER 2623
+#define SCI_RGBAIMAGESETWIDTH 2624
+#define SCI_RGBAIMAGESETHEIGHT 2625
+#define SCI_MARKERDEFINERGBAIMAGE 2626
+#define SCI_REGISTERRGBAIMAGE 2627
+#define SCI_SCROLLTOSTART 2628
+#define SCI_SCROLLTOEND 2629
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@@ -883,6 +901,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCMOD_CTRL 2
#define SCMOD_ALT 4
#define SCMOD_SUPER 8
+#define SCMOD_META 16
#define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002
diff --git a/plugins/scintilla/scintilla/include/Scintilla.iface b/plugins/scintilla/scintilla/include/Scintilla.iface
index 8cd3ab5..9530f42 100644
--- a/plugins/scintilla/scintilla/include/Scintilla.iface
+++ b/plugins/scintilla/scintilla/include/Scintilla.iface
@@ -268,6 +268,7 @@ val SC_MARK_FULLRECT=26
val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
val SC_MARK_UNDERLINE=29
+val SC_MARK_RGBAIMAGE=30
val SC_MARK_CHARACTER=10000
@@ -551,6 +552,10 @@ val INDIC_HIDDEN=5
val INDIC_BOX=6
val INDIC_ROUNDBOX=7
val INDIC_STRAIGHTBOX=8
+val INDIC_DASH=9
+val INDIC_DOTS=10
+val INDIC_SQUIGGLELOW=11
+val INDIC_DOTBOX=12
val INDIC_MAX=31
val INDIC_CONTAINER=8
val INDIC0_MASK=0x20
@@ -798,6 +803,9 @@ set void SetSelectionEnd=2144(position pos,)
# Returns the position at the end of the selection.
get position GetSelectionEnd=2145(,)
+# Set caret to a position, while removing any existing selection.
+fun void SetEmptySelection=2556(position pos,)
+
# Sets the print magnification added to the point size of each style for printing.
set void SetPrintMagnification=2146(int magnification,)
@@ -1945,6 +1953,16 @@ set void MarginSetStyleOffset=2537(int style,)
# Get the start of the range of style numbers used for margin text
get int MarginGetStyleOffset=2538(,)
+enu MarginOption=SC_MARGINOPTION_
+val SC_MARGINOPTION_NONE=0
+val SC_MARGINOPTION_SUBLINESELECT=1
+
+# Set the margin options.
+set void SetMarginOptions=2539(int marginOptions,)
+
+# Get the margin options.
+get int GetMarginOptions=2557(,)
+
# Set the annotation text for a line
set void AnnotationSetText=2540(int line, string text)
@@ -2131,6 +2149,32 @@ fun void MoveSelectedLinesUp=2620(,)
# Move the selected lines down one line, shifting the line below before the selection
fun void MoveSelectedLinesDown=2621(,)
+# Set the identifier reported as idFrom in notification messages.
+set void SetIdentifier=2622(int identifier,)
+
+# Get the identifier.
+get int GetIdentifier=2623(,)
+
+# Set the width for future RGBA image data.
+set void RGBAImageSetWidth=2624(int width,)
+
+# Set the height for future RGBA image data.
+set void RGBAImageSetHeight=2625(int height,)
+
+# Define a marker from RGBA data.
+# It has the width and height from RGBAImageSetWidth/Height
+fun void MarkerDefineRGBAImage=2626(int markerNumber, string pixels)
+
+# Register an RGBA image for use in autocompletion lists.
+# It has the width and height from RGBAImageSetWidth/Height
+fun void RegisterRGBAImage=2627(int type, string pixels)
+
+# Scroll to start of document.
+fun void ScrollToStart=2628(,)
+
+# Scroll to end of document.
+fun void ScrollToEnd=2629(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@@ -2272,6 +2316,7 @@ val SCMOD_SHIFT=1
val SCMOD_CTRL=2
val SCMOD_ALT=4
val SCMOD_SUPER=8
+val SCMOD_META=16
################################################
# For SciLexer.h
@@ -2638,6 +2683,16 @@ val SCE_PL_POD_VERB=31
val SCE_PL_SUB_PROTOTYPE=40
val SCE_PL_FORMAT_IDENT=41
val SCE_PL_FORMAT=42
+val SCE_PL_STRING_VAR=43
+val SCE_PL_XLAT=44
+val SCE_PL_REGEX_VAR=54
+val SCE_PL_REGSUBST_VAR=55
+val SCE_PL_BACKTICKS_VAR=57
+val SCE_PL_HERE_QQ_VAR=61
+val SCE_PL_HERE_QX_VAR=62
+val SCE_PL_STRING_QQ_VAR=64
+val SCE_PL_STRING_QX_VAR=65
+val SCE_PL_STRING_QR_VAR=66
# Lexical states for SCLEX_RUBY
lex Ruby=SCLEX_RUBY SCE_RB_
val SCE_RB_DEFAULT=0
@@ -2712,6 +2767,14 @@ val SCE_L_COMMAND=1
val SCE_L_TAG=2
val SCE_L_MATH=3
val SCE_L_COMMENT=4
+val SCE_L_TAG2=5
+val SCE_L_MATH2=6
+val SCE_L_COMMENT2=7
+val SCE_L_VERBATIM=8
+val SCE_L_SHORTCMD=9
+val SCE_L_SPECIAL=10
+val SCE_L_CMDOPT=11
+val SCE_L_ERROR=12
# Lexical states for SCLEX_LUA
lex Lua=SCLEX_LUA SCE_LUA_
val SCE_LUA_DEFAULT=0
@@ -2734,6 +2797,7 @@ val SCE_LUA_WORD5=16
val SCE_LUA_WORD6=17
val SCE_LUA_WORD7=18
val SCE_LUA_WORD8=19
+val SCE_LUA_LABEL=20
# Lexical states for SCLEX_ERRORLIST
lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
val SCE_ERR_DEFAULT=0
diff --git a/plugins/scintilla/scintilla/patches/scintilla-64-bit.diff b/plugins/scintilla/scintilla/patches/scintilla-64-bit.diff
index 76debdc..771181e 100644
--- a/plugins/scintilla/scintilla/patches/scintilla-64-bit.diff
+++ b/plugins/scintilla/scintilla/patches/scintilla-64-bit.diff
@@ -1,5 +1,6 @@
---- scintilla/include/Scintilla.h 2011-05-21 22:36:30.346130001 +0200
-+++ include/Scintilla.h 2011-05-22 19:33:32.031959002 +0200
+diff -u3 include/Scintilla.orig.h include/Scintilla.h
+--- include/Scintilla.orig.h 2011-08-01 04:49:04.000000000 +0200
++++ include/Scintilla.h 2011-09-17 10:54:12.743040993 +0200
@@ -32,6 +32,11 @@
#if defined(_WIN32)
#include <basetsd.h>
diff --git a/plugins/scintilla/scintilla/patches/scintilla-pango-always.diff b/plugins/scintilla/scintilla/patches/scintilla-pango-always.diff
index 6079ba7..1f05f06 100644
--- a/plugins/scintilla/scintilla/patches/scintilla-pango-always.diff
+++ b/plugins/scintilla/scintilla/patches/scintilla-pango-always.diff
@@ -1,6 +1,7 @@
---- scintilla/gtk/PlatGTK.cxx 2011-05-21 22:36:30.332130001 +0200
-+++ PlatGTK.cxx 2011-05-22 19:40:17.540959001 +0200
-@@ -694,6 +694,16 @@
+diff -u3 scintilla/gtk/PlatGTK.orig.cxx scintilla/PlatGTK.cxx
+--- scintilla/gtk/PlatGTK.orig.cxx 2011-09-16 11:13:20.000000000 +0200
++++ scintilla/PlatGTK.cxx 2011-09-17 10:33:32.458041001 +0200
+@@ -719,6 +719,16 @@
}
return new FontHandle(newid);
#else
diff --git a/plugins/scintilla/scintilla/patches/scintilla-remove-deprecated.diff b/plugins/scintilla/scintilla/patches/scintilla-remove-deprecated.diff
index 7a76719..19885fe 100644
--- a/plugins/scintilla/scintilla/patches/scintilla-remove-deprecated.diff
+++ b/plugins/scintilla/scintilla/patches/scintilla-remove-deprecated.diff
@@ -1,6 +1,6 @@
-diff -u3 scintilla/include/ScintillaWidget.h include/ScintillaWidget.h
---- scintilla/include/ScintillaWidget.h 2011-05-21 22:36:30.352130001 +0200
-+++ include/ScintillaWidget.h 2011-05-22 19:45:53.725959000 +0200
+diff -u3 include/ScintillaWidget.orig.h include/ScintillaWidget.h
+--- include/ScintillaWidget.orig.h 2011-08-01 04:49:04.000000000 +0200
++++ include/ScintillaWidget.h 2011-09-17 09:38:24.315041004 +0200
@@ -16,8 +16,8 @@
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]