diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 76 | 
1 files changed, 40 insertions, 36 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 2c613090c..165bc9fc2 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -478,44 +478,48 @@ void Editor::Redraw() {  }  void Editor::RedrawSelMargin(int line, bool allAfter) { -	bool abandonDraw = false; -	if (!wMargin.GetID())	// Margin in main window so may need to abandon and retry -		abandonDraw = AbandonPaint(); -	if (!abandonDraw) { -		if (vs.maskInLine) { -			Redraw(); -		} else { -			PRectangle rcSelMargin = GetClientRectangle(); -			rcSelMargin.right = rcSelMargin.left + vs.fixedColumnWidth; -			if (line != -1) { -				PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0); - -				// Inflate line rectangle if there are image markers with height larger than line height -				if (vs.largestMarkerHeight > vs.lineHeight) { -					int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2; -					rcLine.top -= delta; -					rcLine.bottom += delta; -					if (rcLine.top < rcSelMargin.top) -						rcLine.top = rcSelMargin.top; -					if (rcLine.bottom > rcSelMargin.bottom) -						rcLine.bottom = rcSelMargin.bottom; -				} - -				rcSelMargin.top = rcLine.top; -				if (!allAfter) -					rcSelMargin.bottom = rcLine.bottom; -				if (rcSelMargin.Empty()) -					return; -			} -			if (wMargin.GetID()) { -				Point ptOrigin = GetVisibleOriginInMain(); -				rcSelMargin.Move(-ptOrigin.x, -ptOrigin.y); -				wMargin.InvalidateRectangle(rcSelMargin); -			} else { -				wMain.InvalidateRectangle(rcSelMargin); -			} +	const bool markersInText = vs.maskInLine != 0; +	if (!wMargin.GetID() || markersInText) {	// May affect text area so may need to abandon and retry +		if (AbandonPaint()) { +			return;  		}  	} +	if (wMargin.GetID() && markersInText) { +		Redraw(); +		return; +	} +	PRectangle rcMarkers = GetClientRectangle(); +	if (!markersInText) { +		// Normal case: just draw the margin +		rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth; +	} +	if (line != -1) { +		PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0); + +		// Inflate line rectangle if there are image markers with height larger than line height +		if (vs.largestMarkerHeight > vs.lineHeight) { +			int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2; +			rcLine.top -= delta; +			rcLine.bottom += delta; +			if (rcLine.top < rcMarkers.top) +				rcLine.top = rcMarkers.top; +			if (rcLine.bottom > rcMarkers.bottom) +				rcLine.bottom = rcMarkers.bottom; +		} + +		rcMarkers.top = rcLine.top; +		if (!allAfter) +			rcMarkers.bottom = rcLine.bottom; +		if (rcMarkers.Empty()) +			return; +	} +	if (wMargin.GetID()) { +		Point ptOrigin = GetVisibleOriginInMain(); +		rcMarkers.Move(-ptOrigin.x, -ptOrigin.y); +		wMargin.InvalidateRectangle(rcMarkers); +	} else { +		wMain.InvalidateRectangle(rcMarkers); +	}  }  PRectangle Editor::RectangleFromRange(Range r, int overlap) { | 
