Browse Source

Fixed SD2-606: Scrolling search window to the left corrupts text

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@904 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
a2e8ac5a5c
  1. 28
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/DrawableLine.cs
  2. 4
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

28
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/DrawableLine.cs

@ -133,7 +133,7 @@ namespace ICSharpCode.TextEditor @@ -133,7 +133,7 @@ namespace ICSharpCode.TextEditor
return spaceSize;
}
public void DrawLine(Graphics g, ref float xPos, float yPos)
public void DrawLine(Graphics g, ref float xPos, float xOffset, float yPos)
{
SizeF spaceSize = GetSpaceSize(g);
foreach (SimpleTextWord word in words) {
@ -149,14 +149,36 @@ namespace ICSharpCode.TextEditor @@ -149,14 +149,36 @@ namespace ICSharpCode.TextEditor
case TextWordType.Word:
xPos += DrawDocumentWord(g,
word.Word,
new PointF(xPos, yPos),
new PointF(xPos + xOffset, yPos),
word.Bold ? boldMonospacedFont : monospacedFont,
word.Color
);
break;
}
}
}
public float MeasureWidth(Graphics g, float xPos)
{
SizeF spaceSize = GetSpaceSize(g);
foreach (SimpleTextWord word in words) {
switch (word.Type) {
case TextWordType.Space:
xPos += spaceSize.Width;
break;
case TextWordType.Tab:
float tabWidth = spaceSize.Width * 4;
xPos += tabWidth;
xPos = (int)((xPos + 2) / tabWidth) * tabWidth;
break;
case TextWordType.Word:
if (word.Word != null && word.Word.Length > 0) {
xPos += g.MeasureString(word.Word, word.Bold ? boldMonospacedFont : monospacedFont, 32768, sf).Width;
}
break;
}
}
return xPos;
}
}
}

4
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

@ -94,11 +94,13 @@ namespace SearchAndReplace @@ -94,11 +94,13 @@ namespace SearchAndReplace
if (specialText != null) {
DrawText(g, specialText, Brushes.Black, Font, ref x, e.Bounds.Y);
} else {
drawableLine.DrawLine(g, ref x, e.Bounds.Y);
x -= e.Bounds.X;
drawableLine.DrawLine(g, ref x, e.Bounds.X, e.Bounds.Y);
}
if (ShowFileName) {
float tabWidth = drawableLine.GetSpaceSize(g).Width * 6;
x = (int)((int)((x + 2 + tabWidth) / tabWidth) * tabWidth);
x += e.Bounds.X;
DrawText(g,
FileNameText,
Brushes.Gray,

Loading…
Cancel
Save