diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 2ce4380fd7..e67ded576c 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -3296,28 +3296,32 @@ var ' Range=', PtrInt(FFoldedLinesView.Ranges[CurLine]) ]); DrawHiLightMarkupToken(nil, PChar(Pointer(sLine)), Length(sLine)); - end else begin + end + {$ELSE} + if (FFoldedLinesView.Ranges[CurLine] = nil) then begin + DrawHiLightMarkupToken(nil, PChar(Pointer(sLine)), Length(sLine)); + end {$ENDIF} - fHighlighter.SetRange(FFoldedLinesView.Ranges[CurLine]); //mh 2000-10-10 - fHighlighter.SetLine(sLine, FFoldedLinesView.TextIndex[CurLine]); - // Try to concatenate as many tokens as possible to minimize the count - // of ExtTextOut calls necessary. This depends on the selection state - // or the line having special colors. For spaces the foreground color - // is ignored as well. - //debugln('>>>> PaintLines Line=',dbgs(CurLine),' rect=',dbgs(rcToken)); - while not fHighlighter.GetEol do begin - fHighlighter.GetTokenEx(sToken,nTokenLen); - attr := fHighlighter.GetTokenAttribute; - // Add Markup to the token and append it to the TokenAccu - // record. This will paint any chars already stored if there is - // a (visible) change in the attributes. - DrawHiLightMarkupToken(attr,sToken,nTokenLen); - // Let the highlighter scan the next token. - fHighlighter.Next; + else + begin + fHighlighter.SetRange(FFoldedLinesView.Ranges[CurLine]); //mh 2000-10-10 + fHighlighter.SetLine(sLine, FFoldedLinesView.TextIndex[CurLine]); + // Try to concatenate as many tokens as possible to minimize the count + // of ExtTextOut calls necessary. This depends on the selection state + // or the line having special colors. For spaces the foreground color + // is ignored as well. + //debugln('>>>> PaintLines Line=',dbgs(CurLine),' rect=',dbgs(rcToken)); + while not fHighlighter.GetEol do begin + fHighlighter.GetTokenEx(sToken,nTokenLen); + attr := fHighlighter.GetTokenAttribute; + // Add Markup to the token and append it to the TokenAccu + // record. This will paint any chars already stored if there is + // a (visible) change in the attributes. + DrawHiLightMarkupToken(attr,sToken,nTokenLen); + // Let the highlighter scan the next token. + fHighlighter.Next; + end; end; - {$IFDEF DEBUGSYNRANGE} - end; - {$ENDIF} end; // Draw anything that's left in the TokenAccu record. Fill to the end // of the invalid area with the correct colors. diff --git a/components/synedit/syneditfoldedview.pp b/components/synedit/syneditfoldedview.pp index b758c33391..6d9848c8e8 100644 --- a/components/synedit/syneditfoldedview.pp +++ b/components/synedit/syneditfoldedview.pp @@ -1642,7 +1642,8 @@ end; (* Lines *) function TSynEditFoldedView.GetLines(index : Integer) : String; begin - if (index < 0) or (index > fLinesInWindow) then exit(''); + if (index < 0) or (index > fLinesInWindow) then + exit(fLines[ScreenLineToTextIndex(Index)]); Result := fLines[fTextIndexList[index]]; end; @@ -1655,13 +1656,15 @@ end; function TSynEditFoldedView.GetRange(Index : integer) : TSynEditRange; begin - if (index < 0) or (index > fLinesInWindow) then exit(nil); + if (index < 0) or (index > fLinesInWindow) then + exit(fLines.Ranges[ScreenLineToTextIndex(Index)]); Result := fLines.Ranges[fTextIndexList[index]]; end; function TSynEditFoldedView.GetTextIndex(index : Integer) : Integer; begin - if (index < 0) or (index > fLinesInWindow) then exit(-1); + if (index < 0) or (index > fLinesInWindow) then + exit(ScreenLineToTextIndex(Index)); Result := fTextIndexList[index]; end;