diff --git a/scintilla/doc/ScintillaHistory.html b/scintilla/doc/ScintillaHistory.html
index 6667c855..843c9bc3 100644
--- a/scintilla/doc/ScintillaHistory.html
+++ b/scintilla/doc/ScintillaHistory.html
@@ -450,6 +450,23 @@
Icons Copyright(C) 1998 by Dean S. Jones
+
+
+ -
+ Released 12 December 2013.
+
+ -
+ C++ lexer fixes bug where keyword followed immediately by quoted string continued
+ keyword style.
+ Bug #1564.
+
+ -
+ Fix hotspot clicking where area was off by half a character width.
+ Bug #1562.
+
+
diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h
index 4a1d788f..4439bb6f 100644
--- a/scintilla/include/SciLexer.h
+++ b/scintilla/include/SciLexer.h
@@ -1569,7 +1569,6 @@
#define SCE_COFFEESCRIPT_GLOBALCLASS 19
#define SCE_COFFEESCRIPT_STRINGRAW 20
#define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21
-#define SCE_COFFEESCRIPT_HASHQUOTEDSTRING 22
#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
diff --git a/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h
index 13670f72..38fd4eaa 100644
--- a/scintilla/include/Scintilla.h
+++ b/scintilla/include/Scintilla.h
@@ -358,8 +358,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
#define SCI_SETPRINTCOLOURMODE 2148
#define SCI_GETPRINTCOLOURMODE 2149
-#define SCFIND_WHOLEWORD 2
-#define SCFIND_MATCHCASE 4
+#define SCFIND_WHOLEWORD 0x2
+#define SCFIND_MATCHCASE 0x4
#define SCFIND_WORDSTART 0x00100000
#define SCFIND_REGEXP 0x00200000
#define SCFIND_POSIX 0x00400000
diff --git a/scintilla/lexers/LexCPP.cxx b/scintilla/lexers/LexCPP.cxx
index d4eaf93a..76a47e05 100644
--- a/scintilla/lexers/LexCPP.cxx
+++ b/scintilla/lexers/LexCPP.cxx
@@ -336,7 +336,7 @@ class LexerCPP : public ILexerWithSubStyles {
enum { ssIdentifier, ssDocKeyword };
SubStyles subStyles;
public:
- LexerCPP(bool caseSensitive_) :
+ explicit LexerCPP(bool caseSensitive_) :
caseSensitive(caseSensitive_),
setWord(CharacterSet::setAlphaNum, "._", 0x80, true),
setNegationOp(CharacterSet::setNone, "!"),
@@ -376,7 +376,7 @@ class LexerCPP : public ILexerWithSubStyles {
int SCI_METHOD LineEndTypesSupported() {
return SC_LINE_END_TYPE_UNICODE;
- };
+ }
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
return subStyles.Allocate(styleBase, numberStyles);
@@ -485,7 +485,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
// Functor used to truncate history
struct After {
int line;
- After(int line_) : line(line_) {}
+ explicit After(int line_) : line(line_) {}
bool operator()(PPDefinition &p) const {
return p.line > line;
}
@@ -683,6 +683,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
else
sc.ChangeState(SCE_C_CHARACTER|activitySet);
+ } else {
+ sc.SetState(SCE_C_DEFAULT | activitySet);
}
} else {
sc.SetState(SCE_C_DEFAULT|activitySet);
diff --git a/scintilla/lexers/LexCoffeeScript.cxx b/scintilla/lexers/LexCoffeeScript.cxx
index 2c79aa13..53d9a383 100644
--- a/scintilla/lexers/LexCoffeeScript.cxx
+++ b/scintilla/lexers/LexCoffeeScript.cxx
@@ -397,7 +397,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK);
sc.Forward();
sc.Forward();
-
+
} else {
sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE);
}
diff --git a/scintilla/lexers/LexHTML.cxx b/scintilla/lexers/LexHTML.cxx
index 1b855e4e..967ebe6e 100644
--- a/scintilla/lexers/LexHTML.cxx
+++ b/scintilla/lexers/LexHTML.cxx
@@ -339,9 +339,9 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HB_IDENTIFIER;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
- if (wordIsNumber)
+ if (wordIsNumber) {
chAttr = SCE_HB_NUMBER;
- else {
+ } else {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s)) {
@@ -385,9 +385,9 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char chAttr = SCE_HPHP_DEFAULT;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
- if (wordIsNumber)
+ if (wordIsNumber) {
chAttr = SCE_HPHP_NUMBER;
- else {
+ } else {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s))
@@ -823,14 +823,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
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, "%")))) {
diff --git a/scintilla/lexers/LexOthers.cxx b/scintilla/lexers/LexOthers.cxx
index 46d448bc..8f0dc8c3 100644
--- a/scintilla/lexers/LexOthers.cxx
+++ b/scintilla/lexers/LexOthers.cxx
@@ -1037,8 +1037,9 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
state = stMsVc;
- } else
+ } else {
state = stUnrecognized;
+ }
} else {
state = stUnrecognized;
}
diff --git a/scintilla/lexers/LexPerl.cxx b/scintilla/lexers/LexPerl.cxx
index ce713b19..94c63d02 100644
--- a/scintilla/lexers/LexPerl.cxx
+++ b/scintilla/lexers/LexPerl.cxx
@@ -1185,7 +1185,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
}
switch (HereDoc.Quote) {
case '\'':
- st_new = SCE_PL_HERE_Q ;
+ st_new = SCE_PL_HERE_Q;
break;
case '"' :
st_new = SCE_PL_HERE_QQ;
diff --git a/scintilla/lexers/LexSQL.cxx b/scintilla/lexers/LexSQL.cxx
index 6a024e55..8b631d7b 100644
--- a/scintilla/lexers/LexSQL.cxx
+++ b/scintilla/lexers/LexSQL.cxx
@@ -643,7 +643,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
break;
}
}
-
+
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
diff --git a/scintilla/lexlib/Accessor.h b/scintilla/lexlib/Accessor.h
index 8b65d556..c85032c7 100644
--- a/scintilla/lexlib/Accessor.h
+++ b/scintilla/lexlib/Accessor.h
@@ -12,7 +12,7 @@
namespace Scintilla {
#endif
-enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8};
+enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 };
class Accessor;
class WordList;
diff --git a/scintilla/lexlib/LexAccessor.h b/scintilla/lexlib/LexAccessor.h
index 01fe8e68..26bc84a8 100644
--- a/scintilla/lexlib/LexAccessor.h
+++ b/scintilla/lexlib/LexAccessor.h
@@ -53,13 +53,13 @@ class LexAccessor {
}
public:
- LexAccessor(IDocument *pAccess_) :
+ explicit LexAccessor(IDocument *pAccess_) :
pAccess(pAccess_), startPos(extremePosition), endPos(0),
- codePage(pAccess->CodePage()),
+ codePage(pAccess->CodePage()),
encodingType(enc8bit),
lenDoc(pAccess->Length()),
mask(127), validLen(0), chFlags(0), chWhile(0),
- startSeg(0), startPosStyling(0),
+ startSeg(0), startPosStyling(0),
documentVersion(pAccess->Version()) {
switch (codePage) {
case 65001:
diff --git a/scintilla/lexlib/LexerModule.cxx b/scintilla/lexlib/LexerModule.cxx
index f71cb8e4..75280a77 100644
--- a/scintilla/lexlib/LexerModule.cxx
+++ b/scintilla/lexlib/LexerModule.cxx
@@ -79,7 +79,7 @@ const char *LexerModule::GetWordListDescription(int index) const {
return "";
} else {
return wordListDescriptions[index];
- }
+ }
}
int LexerModule::GetStyleBitsNeeded() const {
diff --git a/scintilla/lexlib/LexerSimple.h b/scintilla/lexlib/LexerSimple.h
index 6c79db4f..f5794bf4 100644
--- a/scintilla/lexlib/LexerSimple.h
+++ b/scintilla/lexlib/LexerSimple.h
@@ -17,7 +17,7 @@ class LexerSimple : public LexerBase {
const LexerModule *module;
std::string wordLists;
public:
- LexerSimple(const LexerModule *module_);
+ explicit LexerSimple(const LexerModule *module_);
const char * SCI_METHOD DescribeWordListSets();
void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
diff --git a/scintilla/lexlib/PropSetSimple.cxx b/scintilla/lexlib/PropSetSimple.cxx
index ef341b88..cb21e10c 100644
--- a/scintilla/lexlib/PropSetSimple.cxx
+++ b/scintilla/lexlib/PropSetSimple.cxx
@@ -61,7 +61,7 @@ void PropSetSimple::Set(const char *keyVal) {
endVal++;
const char *eqAt = strchr(keyVal, '=');
if (eqAt) {
- Set(keyVal, eqAt + 1, static_cast(eqAt-keyVal),
+ Set(keyVal, eqAt + 1, static_cast(eqAt-keyVal),
static_cast(endVal - eqAt - 1));
} else if (*keyVal) { // No '=' so assume '=1'
Set(keyVal, "1", static_cast(endVal-keyVal), 1);
diff --git a/scintilla/lexlib/SparseState.h b/scintilla/lexlib/SparseState.h
index fb3b55e6..74ac6ccd 100644
--- a/scintilla/lexlib/SparseState.h
+++ b/scintilla/lexlib/SparseState.h
@@ -38,7 +38,7 @@ class SparseState {
}
public:
- SparseState(int positionFirst_=-1) {
+ explicit SparseState(int positionFirst_=-1) {
positionFirst = positionFirst_;
}
void Set(int position, T value) {
diff --git a/scintilla/lexlib/StyleContext.h b/scintilla/lexlib/StyleContext.h
index 7c4dbafe..bd8dd6c0 100644
--- a/scintilla/lexlib/StyleContext.h
+++ b/scintilla/lexlib/StyleContext.h
@@ -28,7 +28,7 @@ class StyleContext {
IDocumentWithLineEnd *multiByteAccess;
unsigned int endPos;
unsigned int lengthDocument;
-
+
// Used for optimizing GetRelativeCharacter
unsigned int posRelative;
unsigned int currentPosLastRelative;
@@ -43,7 +43,7 @@ class StyleContext {
chNext = static_cast(styler.SafeGetCharAt(currentPos+width, 0));
widthNext = 1;
}
- // End of line determined from line end position, allowing CR, LF,
+ // End of line determined from line end position, allowing CR, LF,
// CRLF and Unicode line ends as set by document.
if (currentLine < lineDocEnd)
atLineEnd = static_cast(currentPos) >= (lineStartNext-1);
diff --git a/scintilla/lexlib/SubStyles.h b/scintilla/lexlib/SubStyles.h
index 961715c3..57910781 100644
--- a/scintilla/lexlib/SubStyles.h
+++ b/scintilla/lexlib/SubStyles.h
@@ -20,7 +20,7 @@ class WordClassifier {
public:
- WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {
+ explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) {
}
void Allocate(int firstStyle_, int lenStyles_) {
diff --git a/scintilla/lexlib/WordList.cxx b/scintilla/lexlib/WordList.cxx
index d3a32740..c9fff746 100644
--- a/scintilla/lexlib/WordList.cxx
+++ b/scintilla/lexlib/WordList.cxx
@@ -70,7 +70,7 @@ WordList::WordList(bool onlyLineEnds_) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {
}
-WordList::~WordList() {
+WordList::~WordList() {
Clear();
}
diff --git a/scintilla/lexlib/WordList.h b/scintilla/lexlib/WordList.h
index 964d1fd8..3b9421b8 100644
--- a/scintilla/lexlib/WordList.h
+++ b/scintilla/lexlib/WordList.h
@@ -22,7 +22,7 @@ class WordList {
bool onlyLineEnds; ///< Delimited by any white space or only line ends
int starts[256];
public:
- WordList(bool onlyLineEnds_ = false);
+ explicit WordList(bool onlyLineEnds_ = false);
~WordList();
operator bool() const;
bool operator!=(const WordList &other) const;
diff --git a/scintilla/src/AutoComplete.h b/scintilla/src/AutoComplete.h
index c6562d2a..1c98367e 100644
--- a/scintilla/src/AutoComplete.h
+++ b/scintilla/src/AutoComplete.h
@@ -71,7 +71,7 @@ class AutoComplete {
/// The list string contains a sequence of words separated by the separator character
void SetList(const char *list);
-
+
/// Return the position of the currently selected list item
int GetSelection() const;
diff --git a/scintilla/src/CaseConvert.cxx b/scintilla/src/CaseConvert.cxx
index 7d330788..48b7c1bf 100644
--- a/scintilla/src/CaseConvert.cxx
+++ b/scintilla/src/CaseConvert.cxx
@@ -510,7 +510,7 @@ void SetupConversions(enum CaseConversion conversion) {
int upper = symmetricCaseConversionRanges[i++];
int length = symmetricCaseConversionRanges[i++];
int pitch = symmetricCaseConversionRanges[i++];
- for (int j=0;j::iterator it =
+ std::vector::iterator it =
std::find(watchers.begin(), watchers.end(), wwud);
if (it != watchers.end())
return false;
@@ -1901,7 +1901,7 @@ bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
}
bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
- std::vector::iterator it =
+ std::vector::iterator it =
std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData));
if (it != watchers.end()) {
watchers.erase(it);
@@ -2103,7 +2103,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
*/
class BuiltinRegex : public RegexSearchBase {
public:
- BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {}
+ explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {}
virtual ~BuiltinRegex() {
}
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h
index 3a8f01fb..75fdc09f 100644
--- a/scintilla/src/Document.h
+++ b/scintilla/src/Document.h
@@ -32,7 +32,7 @@ class Range {
Position start;
Position end;
- Range(Position pos=0) :
+ explicit Range(Position pos=0) :
start(pos), end(pos) {
}
Range(Position start_, Position end_) :
@@ -165,7 +165,7 @@ class LexInterface {
ILexer *instance;
bool performingStyle; ///< Prevent reentrance
public:
- LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {
+ explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) {
}
virtual ~LexInterface() {
}
@@ -443,12 +443,12 @@ class UndoGroup {
*/
class DocModification {
public:
- int modificationType;
+ int modificationType;
int position;
- int length;
- int linesAdded; /**< Negative if lines deleted. */
- const char *text; /**< Only valid for changes to text, not for changes to style. */
- int line;
+ int length;
+ int linesAdded; /**< Negative if lines deleted. */
+ const char *text; /**< Only valid for changes to text, not for changes to style. */
+ int line;
int foldLevelNow;
int foldLevelPrev;
int annotationLinesAdded;
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index d6cd8b62..3530f8f7 100644
--- a/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -1988,7 +1988,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
}
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
- }
+ }
} else {
if (levelNum < levelNextNum) {
if (cs.GetExpanded(lineDoc)) {
@@ -1998,7 +1998,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
}
} else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
- }
+ }
}
needWhiteClosure = false;
int firstFollowupLine = cs.DocFromDisplay(cs.DisplayFromDoc(lineDoc + 1));
@@ -2300,7 +2300,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
posCache.MeasureWidths(surface, vstyle, STYLE_CONTROLCHAR, ts.representation->stringRep.c_str(),
static_cast(ts.representation->stringRep.length()), positionsRepr, pdoc);
representationWidth = positionsRepr[ts.representation->stringRep.length()-1] + vstyle.ctrlCharPadding;
- }
+ }
}
for (int ii=0; ii < ts.length; ii++)
ll->positions[ts.start + 1 + ii] = representationWidth;
@@ -3464,7 +3464,7 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS
int caretWidthOffset = 0;
PRectangle rcCaret = rcLine;
- if (posCaret.Position() == pdoc->Length()) { // At end of document
+ if (posCaret.Position() == pdoc->Length()) { // At end of document
caretAtEOF = true;
widthOverstrikeCaret = vsDraw.aveCharWidth;
} else if ((posCaret.Position() - posLineStart) >= ll->numCharsInLine) { // At end of line
@@ -4206,7 +4206,7 @@ void Editor::ClearSelection(bool retainMultipleSelections) {
sel.Range(r).End().Position())) {
pdoc->DeleteChars(sel.Range(r).Start().Position(),
sel.Range(r).Length());
- sel.Range(r) = sel.Range(r).Start();
+ sel.Range(r) = SelectionRange(sel.Range(r).Start());
}
}
}
@@ -4324,9 +4324,9 @@ void Editor::Clear() {
if (!RangeContainsProtected(sel.Range(r).caret.Position(), sel.Range(r).caret.Position() + 1)) {
if (sel.Range(r).Start().VirtualSpace()) {
if (sel.Range(r).anchor < sel.Range(r).caret)
- sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).anchor.Position(), sel.Range(r).anchor.VirtualSpace()));
+ sel.Range(r) = SelectionRange(InsertSpace(sel.Range(r).anchor.Position(), sel.Range(r).anchor.VirtualSpace()));
else
- sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace()));
+ sel.Range(r) = SelectionRange(InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace()));
}
if ((sel.Count() == 1) || !pdoc->IsPositionInLineEnd(sel.Range(r).caret.Position())) {
pdoc->DelChar(sel.Range(r).caret.Position());
@@ -4960,7 +4960,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar
case SCI_NEWLINE:
default:
// printf("Filtered out %ld of macro recording\n", iMessage);
- return ;
+ return;
}
// Send notification
@@ -5773,8 +5773,7 @@ int Editor::KeyDefault(int key, int modifiers) {
// possible hotkey combo--remember the Ctrl modifier for child nodes--is
// unwieldy, and manually handling the Windows messages would mean that we
// have to duplicate all the processing work that Scintilla does
- if (modifiers & SCI_ALT && key >= SCK_DOWN && key <= SCK_RIGHT)
- {
+ if (modifiers & SCI_ALT && key >= SCK_DOWN && key <= SCK_RIGHT) {
SCNotification scn = {0};
scn.nmhdr.code = SCN_KEY;
scn.ch = key;
@@ -6346,6 +6345,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
const bool alt = (modifiers & SCI_ALT) != 0;
SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, alt));
newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position());
+ SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false);
+ newCharPos = MovePositionOutsideChar(newCharPos, -1);
inDragDrop = ddNone;
sel.SetMoveExtends(false);
@@ -6436,8 +6437,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
//Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos);
if (doubleClick) {
NotifyDoubleClick(pt, modifiers);
- if (PositionIsHotspot(newPos.Position()))
- NotifyHotSpotDoubleClicked(newPos.Position(), modifiers);
+ if (PositionIsHotspot(newCharPos.Position()))
+ NotifyHotSpotDoubleClicked(newCharPos.Position(), modifiers);
}
} else { // Single click
if (inSelMargin) {
@@ -6466,8 +6467,8 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifie
SetMouseCapture(true);
} else {
if (PointIsHotspot(pt)) {
- NotifyHotSpotClicked(newPos.Position(), modifiers);
- hotSpotClickPos = PositionFromLocation(pt,true,false);
+ NotifyHotSpotClicked(newCharPos.Position(), modifiers);
+ hotSpotClickPos = newCharPos.Position();
}
if (!shift) {
if (PointInSelection(pt) && !SelectionEmpty())
@@ -6520,7 +6521,7 @@ bool Editor::PositionIsHotspot(int position) const {
}
bool Editor::PointIsHotspot(Point pt) {
- int pos = PositionFromLocation(pt, true);
+ int pos = PositionFromLocation(pt, true, true);
if (pos == INVALID_POSITION)
return false;
return PositionIsHotspot(pos);
@@ -6528,7 +6529,7 @@ bool Editor::PointIsHotspot(Point pt) {
void Editor::SetHotSpotRange(Point *pt) {
if (pt) {
- int pos = PositionFromLocation(*pt);
+ int pos = PositionFromLocation(*pt, false, true);
// If we don't limit this to word characters then the
// range can encompass more than the run range and then
@@ -6648,10 +6649,10 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
}
EnsureCaretVisible(false, false, true);
- if (hsStart != -1 && !PositionIsHotspot(movePos.Position()))
+ if (hsStart != -1 && !PointIsHotspot(pt))
SetHotSpotRange(NULL);
- if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,false) != hotSpotClickPos) {
+ if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) {
if (inDragDrop == ddNone) {
DisplayCursor(Window::cursorText);
}
@@ -6696,7 +6697,9 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
}
if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) {
hotSpotClickPos = INVALID_POSITION;
- NotifyHotSpotReleaseClick(newPos.Position(), ctrl ? SCI_CTRL : 0);
+ SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false);
+ newCharPos = MovePositionOutsideChar(newCharPos, -1);
+ NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0);
}
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {
@@ -7031,7 +7034,7 @@ void Editor::SetFoldExpanded(int lineDoc, bool expanded) {
void Editor::FoldLine(int line, int action) {
if (line >= 0) {
if (action == SC_FOLDACTION_TOGGLE) {
- if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) {
+ if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) {
line = pdoc->GetFoldParent(line);
if (line < 0)
return;
@@ -8458,7 +8461,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
if (wParam <= MARKER_MAX) {
vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam));
vs.CalcLargestMarkerHeight();
- };
+ }
InvalidateStyleData();
RedrawSelMargin();
break;
@@ -8479,7 +8482,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
if (wParam <= MARKER_MAX) {
vs.markers[wParam].SetRGBAImage(sizeRGBAImage, scaleRGBAImage / 100.0, reinterpret_cast(lParam));
vs.CalcLargestMarkerHeight();
- };
+ }
InvalidateStyleData();
RedrawSelMargin();
break;
diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h
index 3ec4d64d..4904c002 100644
--- a/scintilla/src/Editor.h
+++ b/scintilla/src/Editor.h
@@ -119,7 +119,7 @@ class SelectionText {
}
private:
void FixSelectionForClipboard() {
- // To avoid truncating the contents of the clipboard when pasted where the
+ // To avoid truncating the contents of the clipboard when pasted where the
// clipboard contains NUL characters, replace NUL characters by spaces.
std::replace(s.begin(), s.end(), '\0', ' ');
}
diff --git a/scintilla/src/ExternalLexer.h b/scintilla/src/ExternalLexer.h
index 21ac4900..30fd1e40 100644
--- a/scintilla/src/ExternalLexer.h
+++ b/scintilla/src/ExternalLexer.h
@@ -54,7 +54,7 @@ class LexerLibrary {
LexerMinder *last;
public:
- LexerLibrary(const char *ModuleName);
+ explicit LexerLibrary(const char *ModuleName);
~LexerLibrary();
void Release();
diff --git a/scintilla/src/Partitioning.h b/scintilla/src/Partitioning.h
index b1c24cc2..441e4b11 100644
--- a/scintilla/src/Partitioning.h
+++ b/scintilla/src/Partitioning.h
@@ -18,7 +18,7 @@ namespace Scintilla {
class SplitVectorWithRangeAdd : public SplitVector {
public:
- SplitVectorWithRangeAdd(int growSize_) {
+ explicit SplitVectorWithRangeAdd(int growSize_) {
SetGrowSize(growSize_);
ReAllocate(growSize_);
}
@@ -88,7 +88,7 @@ class Partitioning {
}
public:
- Partitioning(int growSize) {
+ explicit Partitioning(int growSize) {
Allocate(growSize);
}
diff --git a/scintilla/src/PerLine.cxx b/scintilla/src/PerLine.cxx
index ccf07c35..8db14aaf 100644
--- a/scintilla/src/PerLine.cxx
+++ b/scintilla/src/PerLine.cxx
@@ -98,7 +98,7 @@ bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) {
delete mhn;
performedDeletion = true;
if (!all)
- break;
+ break;
} else {
pmhn = &((*pmhn)->next);
}
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx
index 9cd21ed2..3db5a560 100644
--- a/scintilla/src/PositionCache.cxx
+++ b/scintilla/src/PositionCache.cxx
@@ -359,7 +359,7 @@ void SpecialRepresentations::SetRepresentation(const char *charBytes, const char
// New entry so increment for first byte
startByteHasReprs[static_cast(charBytes[0])]++;
}
- mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = value;
+ mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = Representation(value);
}
void SpecialRepresentations::ClearRepresentation(const char *charBytes) {
@@ -454,7 +454,7 @@ BreakFinder::~BreakFinder() {
TextSegment BreakFinder::Next() {
if (subBreak == -1) {
int prev = nextBreak;
- while (nextBreak < lineEnd) {
+ while (nextBreak < lineEnd) {
int charWidth = 1;
if (encodingFamily == efUnicode)
charWidth = UTF8DrawBytes(reinterpret_cast(ll->chars) + nextBreak, lineEnd - nextBreak);
diff --git a/scintilla/src/PositionCache.h b/scintilla/src/PositionCache.h
index bc439151..9d422292 100644
--- a/scintilla/src/PositionCache.h
+++ b/scintilla/src/PositionCache.h
@@ -53,7 +53,7 @@ class LineLayout {
int lines;
XYPOSITION wrapIndent; // In pixels
- LineLayout(int maxLineLength_);
+ explicit LineLayout(int maxLineLength_);
virtual ~LineLayout();
void Resize(int maxLineLength_);
void Free();
@@ -116,7 +116,7 @@ class PositionCacheEntry {
class Representation {
public:
std::string stringRep;
- Representation(const char *value="") : stringRep(value) {
+ explicit Representation(const char *value="") : stringRep(value) {
}
};
diff --git a/scintilla/src/RESearch.cxx b/scintilla/src/RESearch.cxx
index be8166bc..ccb7c1f2 100644
--- a/scintilla/src/RESearch.cxx
+++ b/scintilla/src/RESearch.cxx
@@ -333,16 +333,18 @@ static int GetHexaChar(unsigned char hd1, unsigned char hd2) {
hexValue += 16 * (hd1 - 'A' + 10);
} else if (hd1 >= 'a' && hd1 <= 'f') {
hexValue += 16 * (hd1 - 'a' + 10);
- } else
+ } else {
return -1;
+ }
if (hd2 >= '0' && hd2 <= '9') {
hexValue += hd2 - '0';
} else if (hd2 >= 'A' && hd2 <= 'F') {
hexValue += hd2 - 'A' + 10;
} else if (hd2 >= 'a' && hd2 <= 'f') {
hexValue += hd2 - 'a' + 10;
- } else
+ } else {
return -1;
+ }
return hexValue;
}
@@ -472,18 +474,18 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
break;
case '^': /* match beginning */
- if (p == pattern)
+ if (p == pattern) {
*mp++ = BOL;
- else {
+ } else {
*mp++ = CHR;
*mp++ = *p;
}
break;
case '$': /* match endofline */
- if (!*(p+1))
+ if (!*(p+1)) {
*mp++ = EOL;
- else {
+ } else {
*mp++ = CHR;
*mp++ = *p;
}
@@ -498,8 +500,9 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
mask = '\377';
i++;
p++;
- } else
+ } else {
mask = 0;
+ }
if (*p == '-') { /* real dash */
i++;
@@ -523,9 +526,9 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
i++;
c2 = static_cast(*++p);
if (c2 == '\\') {
- if (!*(p+1)) // End of RE
+ if (!*(p+1)) { // End of RE
return badpat("Missing ]");
- else {
+ } else {
i++;
p++;
int incr;
@@ -654,8 +657,9 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
if (tagc > n) {
*mp++ = static_cast(REF);
*mp++ = static_cast(n);
- } else
+ } else {
return badpat("Undetermined reference");
+ }
break;
default:
if (!posix && *p == '(') {
@@ -663,16 +667,18 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
tagstk[++tagi] = tagc;
*mp++ = BOT;
*mp++ = static_cast(tagc++);
- } else
+ } else {
return badpat("Too many \\(\\) pairs");
+ }
} else if (!posix && *p == ')') {
if (*sp == BOT)
return badpat("Null pattern inside \\(\\)");
if (tagi > 0) {
*mp++ = static_cast(EOT);
*mp++ = static_cast(tagstk[tagi--]);
- } else
+ } else {
return badpat("Unmatched \\)");
+ }
} else {
int incr;
int c = GetBackslashExpression(p, incr);
@@ -697,16 +703,18 @@ const char *RESearch::Compile(const char *pattern, int length, bool caseSensitiv
tagstk[++tagi] = tagc;
*mp++ = BOT;
*mp++ = static_cast(tagc++);
- } else
+ } else {
return badpat("Too many () pairs");
+ }
} else if (posix && *p == ')') {
if (*sp == BOT)
return badpat("Null pattern inside ()");
if (tagi > 0) {
*mp++ = static_cast(EOT);
*mp++ = static_cast(tagstk[tagi--]);
- } else
+ } else {
return badpat("Unmatched )");
+ }
} else {
unsigned char c = *p;
if (!c) // End of RE
diff --git a/scintilla/src/RESearch.h b/scintilla/src/RESearch.h
index 7dbaca59..b3dae1a7 100644
--- a/scintilla/src/RESearch.h
+++ b/scintilla/src/RESearch.h
@@ -31,7 +31,7 @@ class CharacterIndexer {
class RESearch {
public:
- RESearch(CharClassify *charClassTable);
+ explicit RESearch(CharClassify *charClassTable);
~RESearch();
void GrabMatches(CharacterIndexer &ci);
const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix);
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx
index 18f69ac3..47d41fad 100644
--- a/scintilla/src/ScintillaBase.cxx
+++ b/scintilla/src/ScintillaBase.cxx
@@ -209,7 +209,7 @@ 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());
- int lenInsert = typeSep ?
+ int lenInsert = typeSep ?
static_cast(typeSep-list) : static_cast(strlen(list));
if (ac.ignoreCase) {
// May need to convert the case before invocation, so remove lenEntered characters
@@ -486,7 +486,7 @@ class LexState : public LexInterface {
public:
int lexLanguage;
- LexState(Document *pdoc_);
+ explicit LexState(Document *pdoc_);
virtual ~LexState();
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);
diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx
index 0f9fcf32..c4486b40 100644
--- a/scintilla/src/Selection.cxx
+++ b/scintilla/src/Selection.cxx
@@ -166,7 +166,7 @@ void SelectionRange::MinimizeVirtualSpace() {
}
Selection::Selection() : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) {
- AddSelection(SelectionPosition(0));
+ AddSelection(SelectionRange(SelectionPosition(0)));
}
Selection::~Selection() {
diff --git a/scintilla/src/Selection.h b/scintilla/src/Selection.h
index 0d73b13c..7e8fb4e2 100644
--- a/scintilla/src/Selection.h
+++ b/scintilla/src/Selection.h
@@ -88,9 +88,9 @@ struct SelectionRange {
SelectionRange() : caret(), anchor() {
}
- SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
+ explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
}
- SelectionRange(int single) : caret(single), anchor(single) {
+ explicit SelectionRange(int single) : caret(single), anchor(single) {
}
SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) {
}
diff --git a/scintilla/src/SplitVector.h b/scintilla/src/SplitVector.h
index c52e84bf..0fc27ddf 100644
--- a/scintilla/src/SplitVector.h
+++ b/scintilla/src/SplitVector.h
@@ -272,7 +272,7 @@ class SplitVector {
GapTo(position);
return body + position + gapLength;
} else {
- return body + position ;
+ return body + position;
}
} else {
return body + position + gapLength;
@@ -280,7 +280,7 @@ class SplitVector {
}
int GapPosition() const {
- return part1Length;
+ return part1Length;
}
};
diff --git a/scintilla/src/UniConversion.cxx b/scintilla/src/UniConversion.cxx
index 8ec1bc45..1af5a7da 100644
--- a/scintilla/src/UniConversion.cxx
+++ b/scintilla/src/UniConversion.cxx
@@ -159,7 +159,7 @@ static int BytesFromLead(int leadByte) {
void UTF8BytesOfLeadInitialise() {
if (!initialisedBytesOfLead) {
- for (int i=0;i<256;i++) {
+ for (int i=0; i<256; i++) {
UTF8BytesOfLead[i] = BytesFromLead(i);
}
initialisedBytesOfLead = true;
diff --git a/scintilla/src/XPM.cxx b/scintilla/src/XPM.cxx
index eeadce9b..c810dc28 100644
--- a/scintilla/src/XPM.cxx
+++ b/scintilla/src/XPM.cxx
@@ -120,7 +120,7 @@ void XPM::Init(const char *const *linesForm) {
for (int y=0; y(lform[x]);
}
}
@@ -244,7 +244,7 @@ void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) {
pixel[3] = static_cast(alpha);
}
-RGBAImageSet::RGBAImageSet() : height(-1), width(-1){
+RGBAImageSet::RGBAImageSet() : height(-1), width(-1) {
}
RGBAImageSet::~RGBAImageSet() {
diff --git a/scintilla/src/XPM.h b/scintilla/src/XPM.h
index ddac02eb..a5e0c3f7 100644
--- a/scintilla/src/XPM.h
+++ b/scintilla/src/XPM.h
@@ -25,8 +25,8 @@ class XPM {
ColourDesired ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x);
public:
- XPM(const char *textForm);
- XPM(const char *const *linesForm);
+ explicit XPM(const char *textForm);
+ explicit XPM(const char *const *linesForm);
~XPM();
void Init(const char *textForm);
void Init(const char *const *linesForm);
@@ -53,7 +53,7 @@ class RGBAImage {
std::vector pixelBytes;
public:
RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_);
- RGBAImage(const XPM &xpm);
+ explicit RGBAImage(const XPM &xpm);
virtual ~RGBAImage();
int GetHeight() const { return height; }
int GetWidth() const { return width; }
@@ -62,7 +62,7 @@ class RGBAImage {
float GetScaledWidth() const { return width / scale; }
int CountBytes() const;
const unsigned char *Pixels() const;
- void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);
+ void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);
};
/**
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
index 6d60b4a2..f9b0b230 100644
--- a/scintilla/win32/PlatWin.cxx
+++ b/scintilla/win32/PlatWin.cxx
@@ -172,7 +172,7 @@ bool LoadD2D() {
else
gamma = defaultRenderingParams->GetGamma();
- pIDWriteFactory->CreateCustomRenderingParams(gamma, defaultRenderingParams->GetEnhancedContrast(), defaultRenderingParams->GetClearTypeLevel(),
+ pIDWriteFactory->CreateCustomRenderingParams(gamma, defaultRenderingParams->GetEnhancedContrast(), defaultRenderingParams->GetClearTypeLevel(),
defaultRenderingParams->GetPixelGeometry(), defaultRenderingParams->GetRenderingMode(), &customClearTypeRenderingParams);
}
}
@@ -334,7 +334,7 @@ class FontCached : Font {
LOGFONTA lf;
int technology;
int hash;
- FontCached(const FontParameters &fp);
+ explicit FontCached(const FontParameters &fp);
~FontCached() {}
bool SameAs(const FontParameters &fp);
virtual void Release();
@@ -490,7 +490,7 @@ class VarBuffer {
VarBuffer &operator=(const VarBuffer &);
public:
T *buffer;
- VarBuffer(size_t length) : buffer(0) {
+ explicit VarBuffer(size_t length) : buffer(0) {
if (length > lengthStandard) {
buffer = new T[length];
} else {
@@ -729,7 +729,7 @@ void SurfaceGDI::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired
PenColour(fore);
BrushColor(back);
std::vector outline;
- for (int i=0;i(pts[i].x), static_cast(pts[i].y)};
outline.push_back(pt);
}
@@ -834,12 +834,12 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
}
}
}
- for (int c=0;c(len);kk++) {
+ for (size_t kk=0; kk(len); kk++) {
positions[kk] = poses.buffer[kk];
}
@@ -1769,7 +1769,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *
// May be more than one byte per position
unsigned int ui = 0;
FLOAT position = 0.0f;
- for (int i=0;i utf16Folded;
UINT cp;
public:
- CaseFolderDBCS(UINT cp_) : cp(cp_) {
+ explicit CaseFolderDBCS(UINT cp_) : cp(cp_) {
StandardASCII();
}
virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) {
@@ -1492,9 +1492,9 @@ class CaseFolderDBCS : public CaseFolderTable {
// Maximum length of a case conversion is 6 bytes, 3 characters
wchar_t wFolded[20];
unsigned int charsConverted = UTF16FromUTF8(foldedUTF8,
- static_cast(strlen(foldedUTF8)),
+ static_cast(strlen(foldedUTF8)),
wFolded, sizeof(wFolded)/sizeof(wFolded[0]));
- for (size_t j=0;j(strlen(caseFolded)),
+ static_cast(strlen(caseFolded)),
wLower, sizeof(wLower)/sizeof(wLower[0]));
if (charsConverted == 1) {
char sCharacterLowered[20];
@@ -1566,7 +1566,7 @@ std::string ScintillaWin::CaseMapString(const std::string &s, int caseMapping) {
UINT cpDoc = CodePageOfDocument();
if (cpDoc == SC_CP_UTF8) {
std::string retMapped(s.length() * maxExpansionCaseConversion, 0);
- size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(),
+ size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(),
(caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower);
retMapped.resize(lenMapped);
return retMapped;
@@ -1634,7 +1634,7 @@ class GlobalMemory {
void *ptr;
GlobalMemory() : hand(0), ptr(0) {
}
- GlobalMemory(HGLOBAL hand_) : hand(hand_), ptr(0) {
+ explicit GlobalMemory(HGLOBAL hand_) : hand(hand_), ptr(0) {
if (hand) {
ptr = ::GlobalLock(hand);
}