aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html8
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--src/EditView.cxx16
-rw-r--r--src/ViewStyle.cxx6
-rw-r--r--src/ViewStyle.h4
7 files changed, 28 insertions, 11 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 263628f4c..e77c064c3 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -2224,6 +2224,14 @@ struct Sci_TextToFind {
<td>White space used for indentation is displayed normally but after the first visible
character, it is shown as dots and arrows.</td>
</tr>
+
+ <tr>
+ <th align="left"><code>SCWS_VISIBLEONLYININDENT</code></th>
+
+ <td>3</td>
+
+ <td>White space used for indentation is displayed as dots and arrows.</td>
+ </tr>
</tbody>
</table>
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index b3225f3a7..de0656980 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -494,6 +494,9 @@
Released 15 September 2015.
</li>
<li>
+ Whitespace may be made visible just in indentation.
+ </li>
+ <li>
The Scintilla framework on Cocoa now contains version numbers.
</li>
<li>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index b5e3e9bc0..e3443409b 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -73,6 +73,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCWS_INVISIBLE 0
#define SCWS_VISIBLEALWAYS 1
#define SCWS_VISIBLEAFTERINDENT 2
+#define SCWS_VISIBLEONLYININDENT 3
#define SCI_GETVIEWWS 2020
#define SCI_SETVIEWWS 2021
#define SCI_POSITIONFROMPOINT 2022
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index d7a39e92d..ad50a2aaf 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -159,6 +159,7 @@ enu WhiteSpace=SCWS_
val SCWS_INVISIBLE=0
val SCWS_VISIBLEALWAYS=1
val SCWS_VISIBLEAFTERINDENT=2
+val SCWS_VISIBLEONLYININDENT=3
# Are white space characters currently visible?
# Returns one of SCWS_* constants.
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 072a715f4..23fca07af 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -1301,8 +1301,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi
if (ts.representation) {
if (ll->chars[i] == '\t') {
// Tab display
- if (drawWhitespaceBackground &&
- (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways))
+ if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation))
textBack = vsDraw.whitespaceColours.back;
} else {
// Blob display
@@ -1316,8 +1315,7 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi
(inIndentation && vsDraw.viewIndentationGuides == ivReal)) {
for (int cpos = 0; cpos <= i - ts.start; cpos++) {
if (ll->chars[cpos + ts.start] == ' ') {
- if (drawWhitespaceBackground &&
- (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
+ if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) {
PRectangle rcSpace(
ll->positions[cpos + ts.start] + xStart - static_cast<XYPOSITION>(subLineStart),
rcSegment.top,
@@ -1503,8 +1501,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
if (ll->chars[i] == '\t') {
// Tab display
if (phasesDraw == phasesOne) {
- if (drawWhitespaceBackground &&
- (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways))
+ if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation))
textBack = vsDraw.whitespaceColours.back;
surface->FillRectangle(rcSegment, textBack);
}
@@ -1520,7 +1517,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
}
if (vsDraw.viewWhitespace != wsInvisible) {
- if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {
+ if (vsDraw.WhiteSpaceVisible(inIndentation)) {
if (vsDraw.whitespaceColours.fore.isSet)
textFore = vsDraw.whitespaceColours.fore;
surface->PenColour(textFore);
@@ -1568,10 +1565,9 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
if (vsDraw.viewWhitespace != wsInvisible) {
if (vsDraw.whitespaceColours.fore.isSet)
textFore = vsDraw.whitespaceColours.fore;
- if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {
+ if (vsDraw.WhiteSpaceVisible(inIndentation)) {
XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2;
- if ((phasesDraw == phasesOne) && drawWhitespaceBackground &&
- (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) {
+ if ((phasesDraw == phasesOne) && drawWhitespaceBackground) {
textBack = vsDraw.whitespaceColours.back;
PRectangle rcSpace(
ll->positions[cpos + ts.start] + xStart - static_cast<XYPOSITION>(subLineStart),
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index e8bf51363..9416ddcc6 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -512,6 +512,12 @@ bool ViewStyle::WhitespaceBackgroundDrawn() const {
return (viewWhitespace != wsInvisible) && (whitespaceColours.back.isSet);
}
+bool ViewStyle::WhiteSpaceVisible(bool inIndent) const {
+ return !inIndent && viewWhitespace == wsVisibleAfterIndent ||
+ inIndent && viewWhitespace == wsVisibleOnlyInIndent ||
+ viewWhitespace == wsVisibleAlways;
+}
+
ColourDesired ViewStyle::WrapColour() const {
if (whitespaceColours.fore.isSet)
return whitespaceColours.fore;
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 242e7e38e..d5a9d5b71 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -52,7 +52,7 @@ public:
enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth};
-enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2};
+enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2, wsVisibleOnlyInIndent=3};
typedef std::map<FontSpecification, FontRealised *> FontMap;
@@ -185,6 +185,8 @@ public:
bool SetWrapVisualStartIndent(int wrapVisualStartIndent_);
bool SetWrapIndentMode(int wrapIndentMode_);
+ bool WhiteSpaceVisible(bool inIndent) const;
+
private:
void AllocStyles(size_t sizeNew);
void CreateAndAddFont(const FontSpecification &fs);