aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-06-30 14:06:48 +1000
committerNeil <nyamatongwe@gmail.com>2015-06-30 14:06:48 +1000
commit8d49281805d033bc8e6ca0da7ef74ed6de37d25f (patch)
tree4a14588880cc980da9fa8145f91ad3944d1f42e1 /src
parent66031843422be132c581335f06f78b800eb36b01 (diff)
downloadscintilla-mirror-8d49281805d033bc8e6ca0da7ef74ed6de37d25f.tar.gz
Added SC_CASE_CAMEL to the case mode style attribute.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx18
-rw-r--r--src/Style.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 5372e3abd..e6963e56a 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -389,9 +389,17 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower)
allSame = allSame &&
(ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
- else // Style::caseUpper
+ else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper)
allSame = allSame &&
(ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+ else { // Style::caseCamel
+ if ((model.pdoc->WordCharClass(ll->chars[numCharsInLine]) == CharClassify::ccWord) &&
+ ((numCharsInLine == 0) || (model.pdoc->WordCharClass(ll->chars[numCharsInLine - 1]) != CharClassify::ccWord))) {
+ allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(toupper(chDoc)));
+ } else {
+ allSame = allSame && (ll->chars[numCharsInLine] == static_cast<char>(tolower(chDoc)));
+ }
+ }
numCharsInLine++;
}
allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled
@@ -434,6 +442,14 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
ll->chars[charInLine] = static_cast<char>(toupper(chDoc));
else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower)
ll->chars[charInLine] = static_cast<char>(tolower(chDoc));
+ else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) {
+ if ((model.pdoc->WordCharClass(ll->chars[charInLine]) == CharClassify::ccWord) &&
+ ((charInLine == 0) || (model.pdoc->WordCharClass(ll->chars[charInLine - 1]) != CharClassify::ccWord))) {
+ ll->chars[charInLine] = static_cast<char>(toupper(chDoc));
+ } else {
+ ll->chars[charInLine] = static_cast<char>(tolower(chDoc));
+ }
+ }
}
}
ll->xHighlightGuide = 0;
diff --git a/src/Style.h b/src/Style.h
index 411b11a08..cc9148af6 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -61,7 +61,7 @@ public:
ColourDesired back;
bool eolFilled;
bool underline;
- enum ecaseForced {caseMixed, caseUpper, caseLower};
+ enum ecaseForced {caseMixed, caseUpper, caseLower, caseCamel};
ecaseForced caseForce;
bool visible;
bool changeable;