aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
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;