diff options
| author | Neil <nyamatongwe@gmail.com> | 2016-10-26 23:09:50 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2016-10-26 23:09:50 +1100 | 
| commit | 065668992566910aef274b995d8f861906d514a9 (patch) | |
| tree | 68c245a6630c79a41df63b8ad03bc92801169d29 /src/EditView.cxx | |
| parent | dbef8326ee583d3ad79941d629b4314f359765c1 (diff) | |
| download | scintilla-mirror-065668992566910aef274b995d8f861906d514a9.tar.gz | |
INDIC_POINT and INDIC_POINTCHARACTER indicators added to display small arrows
underneath positions or characters.
Diffstat (limited to 'src/EditView.cxx')
| -rw-r--r-- | src/EditView.cxx | 25 | 
1 files changed, 19 insertions, 6 deletions
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;  | 
