aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/Indicators.pngbin4172 -> 11206 bytes
-rw-r--r--doc/ScintillaDoc.html16
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--include/Scintilla.h2
-rw-r--r--include/Scintilla.iface2
-rw-r--r--src/EditView.cxx25
-rw-r--r--src/Indicator.cxx15
-rw-r--r--src/Indicator.h2
8 files changed, 58 insertions, 8 deletions
diff --git a/doc/Indicators.png b/doc/Indicators.png
index b67566eaf..a1f68679a 100644
--- a/doc/Indicators.png
+++ b/doc/Indicators.png
Binary files differ
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index adf3b9907..333a7f865 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -4339,6 +4339,22 @@ struct Sci_TextToFind {
<td>Change the colour of the text to the indicator's fore colour.</td>
</tr>
+ <tr>
+ <td align="left"><code>INDIC_POINT</code></td>
+
+ <td align="center">18</td>
+
+ <td>Draw a triangle below the start of the indicator range.</td>
+ </tr>
+
+ <tr>
+ <td align="left"><code>INDIC_POINTCHARACTER</code></td>
+
+ <td align="center">19</td>
+
+ <td>Draw a triangle below the centre of the first character of the indicator range.</td>
+ </tr>
+
</tbody>
</table>
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 9f3b28179..79a3cfe00 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -527,6 +527,10 @@
Accessibility supported on GTK+.
</li>
<li>
+ INDIC_POINT and INDIC_POINTCHARACTER indicators added to display small arrows
+ underneath positions or characters.
+ </li>
+ <li>
Baan folder accomodates main sections and lexer fixes definition of SCE_BAAN_FUNCDEF.
</li>
<li>
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 9fd519f6d..dd643e9ea 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -287,6 +287,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_COMPOSITIONTHIN 15
#define INDIC_FULLBOX 16
#define INDIC_TEXTFORE 17
+#define INDIC_POINT 18
+#define INDIC_POINTCHARACTER 19
#define INDIC_IME 32
#define INDIC_IME_MAX 35
#define INDIC_MAX 35
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index de0d88142..6bb4da9b5 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -626,6 +626,8 @@ val INDIC_COMPOSITIONTHICK=14
val INDIC_COMPOSITIONTHIN=15
val INDIC_FULLBOX=16
val INDIC_TEXTFORE=17
+val INDIC_POINT=18
+val INDIC_POINTCHARACTER=19
val INDIC_IME=32
val INDIC_IME_MAX=35
val INDIC_MAX=35
diff --git a/src/EditView.cxx b/src/EditView.cxx
index e6cd8fcfe..3bca3b58b 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -963,14 +963,23 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
}
static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw,
- const LineLayout *ll, int xStart, PRectangle rcLine, int subLine, Indicator::DrawState drawState, int value) {
+ const LineLayout *ll, int xStart, PRectangle rcLine, int secondCharacter, int subLine, Indicator::DrawState drawState, int value) {
const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)];
PRectangle rcIndic(
ll->positions[startPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent,
ll->positions[endPos] + xStart - subLineStart,
rcLine.top + vsDraw.maxAscent + 3);
- vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, drawState, value);
+ PRectangle rcFirstCharacter = rcIndic;
+ // Allow full descent space for character indicators
+ rcFirstCharacter.bottom = rcLine.top + vsDraw.maxAscent + vsDraw.maxDescent;
+ if (secondCharacter >= 0) {
+ rcFirstCharacter.right = ll->positions[secondCharacter] + xStart - subLineStart;
+ } else {
+ // Indicator continued from earlier line so make an empty box and don't draw
+ rcFirstCharacter.right = rcFirstCharacter.left;
+ }
+ vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, rcFirstCharacter, drawState, value);
}
static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
@@ -993,8 +1002,9 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
rangeRun.ContainsCharacter(hoverIndicatorPos);
const int value = deco->rs.ValueAt(startPos);
Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal;
+ const int posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1);
DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart,
- surface, vsDraw, ll, xStart, rcLine, subLine, drawState, value);
+ surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value);
startPos = endPos;
if (!deco->rs.ValueAt(startPos)) {
startPos = deco->rs.EndRun(startPos);
@@ -1012,13 +1022,15 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS
if (rangeLine.ContainsCharacter(model.braces[0])) {
int braceOffset = model.braces[0] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
- DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1);
+ const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart;
+ DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1);
}
}
if (rangeLine.ContainsCharacter(model.braces[1])) {
int braceOffset = model.braces[1] - posLineStart;
if (braceOffset < ll->numCharsInLine) {
- DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1);
+ const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart;
+ DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1);
}
}
}
@@ -1878,7 +1890,8 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
ll->SetBracesHighlight(rangeLine, model.braces, static_cast<char>(model.bracesMatchStyle),
static_cast<int>(model.highlightGuideColumn * vsDraw.spaceWidth), bracesIgnoreStyle);
- if (leftTextOverlap && bufferedDraw) {
+ if (leftTextOverlap && (bufferedDraw || ((phasesDraw < phasesMultiple) && (*it & drawBack)))) {
+ // Clear the left margin
PRectangle rcSpacer = rcLine;
rcSpacer.right = rcSpacer.left;
rcSpacer.left -= 1;
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 4bc25a815..c23ae4e17 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -24,7 +24,7 @@ static PRectangle PixelGridAlign(const PRectangle &rc) {
return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom));
}
-void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const {
+void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const {
StyleAndColour sacDraw = sacNormal;
if (Flags() & SC_INDICFLAG_VALUEFORE) {
sacDraw.fore = value & SC_INDICVALUEMASK;
@@ -170,6 +170,19 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
} else if (sacDraw.style == INDIC_COMPOSITIONTHIN) {
PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1);
surface->FillRectangle(rcComposition, sacDraw.fore);
+ } else if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) {
+ if (rcCharacter.Width() >= 0.1) {
+ const int pixelHeight = static_cast<int>(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase
+ const XYPOSITION x = (sacDraw.style == INDIC_POINT) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2);
+ const int ix = static_cast<int>(x + 0.5f);
+ const int iy = static_cast<int>(rc.top + 1.0f);
+ Point pts[] = {
+ Point::FromInts(ix - pixelHeight, iy + pixelHeight), // Left
+ Point::FromInts(ix + pixelHeight, iy + pixelHeight), // Right
+ Point::FromInts(ix, iy) // Top
+ };
+ surface->Polygon(pts, 3, sacDraw.fore, sacDraw.fore);
+ }
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(static_cast<int>(rc.left), ymid);
surface->LineTo(static_cast<int>(rc.right), ymid);
diff --git a/src/Indicator.h b/src/Indicator.h
index c22ec71c6..9b887df9d 100644
--- a/src/Indicator.h
+++ b/src/Indicator.h
@@ -40,7 +40,7 @@ public:
Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) {
}
- void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const;
+ void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const;
bool IsDynamic() const {
return !(sacNormal == sacHover);
}