aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-04-26 07:53:21 +1000
committerNeil <nyamatongwe@gmail.com>2019-04-26 07:53:21 +1000
commit94750763850b4cb8051a7ee155ca403322726e44 (patch)
treee36a8a5e01ac9723b9157611c49ff74f6576099c
parentb655ec9fbc090306549d632f27468a58211c3c60 (diff)
downloadscintilla-mirror-94750763850b4cb8051a7ee155ca403322726e44.tar.gz
Feature [feature-requests:#1238]. Simplify camel case forcing by checking only
for upper and lower case characters instead of current word characters. This changes behaviour for words like "_word" -> "_Word" instead of remaining "_word" but that doesn't matter for this feature's intended use which is to allow display of ASCII-only keywords in the user's preferred casing (else/ELSE/Else) for languages with case-insensitive keywords.
-rw-r--r--doc/ScintillaHistory.html6
-rw-r--r--lexlib/CharacterSet.h4
-rw-r--r--src/Document.cxx8
-rw-r--r--src/Document.h1
-rw-r--r--src/EditView.cxx8
5 files changed, 14 insertions, 13 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index cff81ed87..0bd92761d 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -563,6 +563,12 @@
<li>
Fix bug where changing identifier sets in lexers preserved previous identifiers.
</li>
+ <li>
+ Changed behaviour of SCI_STYLESETCASE(*,SC_CASE_CAMEL) so that it only treats 'a-zA-Z'
+ as word characters because this covers the feature's intended use (viewing case-insensitive ASCII-only
+ keywords in a specified casing style) and simplifies the behaviour and code.
+ <a href="https://sourceforge.net/p/scintilla/feature-requests/1238/">Feature #1238</a>.
+ </li>
</ul>
<h3>
<a href="https://www.scintilla.org/scite415.zip">Release 4.1.5</a>
diff --git a/lexlib/CharacterSet.h b/lexlib/CharacterSet.h
index 358f6bed3..0470e446c 100644
--- a/lexlib/CharacterSet.h
+++ b/lexlib/CharacterSet.h
@@ -135,6 +135,10 @@ inline bool IsUpperCase(int ch) {
return (ch >= 'A') && (ch <= 'Z');
}
+inline bool IsUpperOrLowerCase(int ch) {
+ return IsUpperCase(ch) || IsLowerCase(ch);
+}
+
inline bool IsAlphaNumeric(int ch) {
return
((ch >= '0') && (ch <= '9')) ||
diff --git a/src/Document.cxx b/src/Document.cxx
index 72dae5f5b..b825823bd 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1695,14 +1695,6 @@ Sci::Position Document::ParaDown(Sci::Position pos) const {
return LineEnd(line-1);
}
-bool Document::IsASCIIWordByte(unsigned char ch) const {
- if (IsASCII(ch)) {
- return charClass.GetClass(ch) == CharClassify::ccWord;
- } else {
- return false;
- }
-}
-
CharClassify::cc Document::WordCharacterClass(unsigned int ch) const {
if (dbcsCodePage && (!UTF8IsAscii(ch))) {
if (SC_CP_UTF8 == dbcsCodePage) {
diff --git a/src/Document.h b/src/Document.h
index c5b078a72..0482c6c0e 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -482,7 +482,6 @@ public:
bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData);
- bool IsASCIIWordByte(unsigned char ch) const;
CharClassify::cc WordCharacterClass(unsigned int ch) const;
bool IsWordPartSeparator(unsigned int ch) const;
Sci::Position WordPartLeft(Sci::Position pos) const;
diff --git a/src/EditView.cxx b/src/EditView.cxx
index ffeb20648..c4370632b 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -387,8 +387,8 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
allSame = allSame &&
(ll->chars[numCharsInLine] == MakeUpperCase(chDoc));
else { // Style::caseCamel
- if ((model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine])) &&
- ((numCharsInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine - 1])))) {
+ if ((IsUpperOrLowerCase(ll->chars[numCharsInLine])) &&
+ ((numCharsInLine == 0) || (!IsUpperOrLowerCase(ll->chars[numCharsInLine - 1])))) {
allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc));
} else {
allSame = allSame && (ll->chars[numCharsInLine] == MakeLowerCase(chDoc));
@@ -434,8 +434,8 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower)
ll->chars[charInLine] = MakeLowerCase(chDoc);
else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) {
- if ((model.pdoc->IsASCIIWordByte(ll->chars[charInLine])) &&
- ((charInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[charInLine - 1])))) {
+ if ((IsUpperOrLowerCase(ll->chars[charInLine])) &&
+ ((charInLine == 0) || (!IsUpperOrLowerCase(ll->chars[charInLine - 1])))) {
ll->chars[charInLine] = MakeUpperCase(chDoc);
} else {
ll->chars[charInLine] = MakeLowerCase(chDoc);