From 8d49281805d033bc8e6ca0da7ef74ed6de37d25f Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 30 Jun 2015 14:06:48 +1000 Subject: Added SC_CASE_CAMEL to the case mode style attribute. --- doc/ScintillaDoc.html | 4 ++-- doc/ScintillaHistory.html | 3 +++ include/Scintilla.h | 1 + include/Scintilla.iface | 1 + src/EditView.cxx | 18 +++++++++++++++++- src/Style.h | 2 +- 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 6e3bab3a6..ed0429efc 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2699,8 +2699,8 @@ struct Sci_TextToFind {

SCI_STYLESETCASE(int styleNumber, int caseMode)
SCI_STYLEGETCASE(int styleNumber)
The value of caseMode determines how text is displayed. You can set upper case - (SC_CASE_UPPER, 1) or lower case (SC_CASE_LOWER, 2) or display - normally (SC_CASE_MIXED, 0). This does not change the stored text, only how it is + (SC_CASE_UPPER, 1) or lower case (SC_CASE_LOWER, 2) or camel case (SC_CASE_CAMEL, 3) + or display normally (SC_CASE_MIXED, 0). This does not change the stored text, only how it is displayed.

SCI_STYLESETVISIBLE(int styleNumber, bool visible)
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index e0954a858..f2e9528eb 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -498,6 +498,9 @@ This change in behaviours is conditional on setting the SCI_SETADDITIONALSELECTIONTYPING property.

  • + The case mode style attribute can now be SC_CASE_CAMEL. +
  • +
  • On Cocoa fix problems with positioning of autocompletion lists near screen edge or under dock. Cancel autocompletion when window moved. Bug #1740. diff --git a/include/Scintilla.h b/include/Scintilla.h index 50deb755e..7244bded8 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -217,6 +217,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CASE_MIXED 0 #define SC_CASE_UPPER 1 #define SC_CASE_LOWER 2 +#define SC_CASE_CAMEL 3 #define SCI_STYLEGETFORE 2481 #define SCI_STYLEGETBACK 2482 #define SCI_STYLEGETBOLD 2483 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 9a084785a..818a2ca38 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -462,6 +462,7 @@ enu CaseVisible=SC_CASE_ val SC_CASE_MIXED=0 val SC_CASE_UPPER=1 val SC_CASE_LOWER=2 +val SC_CASE_CAMEL=3 # Get the foreground colour of a style. get colour StyleGetFore=2481(int style,) 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(tolower(chDoc))); - else // Style::caseUpper + else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) allSame = allSame && (ll->chars[numCharsInLine] == static_cast(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(toupper(chDoc))); + } else { + allSame = allSame && (ll->chars[numCharsInLine] == static_cast(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(toupper(chDoc)); else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) ll->chars[charInLine] = static_cast(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(toupper(chDoc)); + } else { + ll->chars[charInLine] = static_cast(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; -- cgit v1.2.3