Browse Source

Fixed SD2-1504: Tooltip not shown when code folded

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3756 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
efc40af0ff
  1. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaMouseHandler.cs
  2. 43
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs
  3. 6
      src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextAreaMouseHandler.cs

@ -362,7 +362,11 @@ namespace ICSharpCode.TextEditor @@ -362,7 +362,11 @@ namespace ICSharpCode.TextEditor
clickedOnSelectedText = true;
}
textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.TextView.Document, new TextLocation(marker.StartColumn, marker.StartLine), new TextLocation(marker.EndColumn, marker.EndLine)));
TextLocation startLocation = new TextLocation(marker.StartColumn, marker.StartLine);
TextLocation endLocation = new TextLocation(marker.EndColumn, marker.EndLine);
textArea.SelectionManager.SetSelection(new DefaultSelection(textArea.TextView.Document, startLocation, endLocation));
textArea.Caret.Position = startLocation;
textArea.SetDesiredColumn();
textArea.Focus();
return;
}

43
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextView.cs

@ -774,26 +774,35 @@ namespace ICSharpCode.TextEditor @@ -774,26 +774,35 @@ namespace ICSharpCode.TextEditor
int result;
using (Graphics g = textArea.CreateGraphics()) {
do {
// call GetLogicalColumnInternal to skip over text,
// then skip over fold markers
// and repeat as necessary.
// The loop terminates once the correct logical column is reached in
// GetLogicalColumnInternal or inside a fold marker.
while (true) {
LineSegment line = Document.GetLineSegment(lineNumber);
FoldMarker nextFolding = FindNextFoldedFoldingOnLineAfterColumn(lineNumber, start-1);
int end = nextFolding != null ? nextFolding.StartColumn : int.MaxValue;
result = GetLogicalColumnInternal(g, line, start, end, ref posX, visualPosX);
if (result < 0) {
// reached fold marker
lineNumber = nextFolding.EndLine;
start = nextFolding.EndColumn;
int newPosX = posX + 1 + MeasureStringWidth(g, nextFolding.FoldText, TextEditorProperties.FontContainer.RegularFont);
if (newPosX >= visualPosX) {
inFoldMarker = nextFolding;
if (IsNearerToAThanB(visualPosX, posX, newPosX))
return new TextLocation(nextFolding.StartColumn, nextFolding.StartLine);
else
return new TextLocation(nextFolding.EndColumn, nextFolding.EndLine);
}
posX = newPosX;
// break when GetLogicalColumnInternal found the result column
if (result < end)
break;
// reached fold marker
lineNumber = nextFolding.EndLine;
start = nextFolding.EndColumn;
int newPosX = posX + 1 + MeasureStringWidth(g, nextFolding.FoldText, TextEditorProperties.FontContainer.RegularFont);
if (newPosX >= visualPosX) {
inFoldMarker = nextFolding;
if (IsNearerToAThanB(visualPosX, posX, newPosX))
return new TextLocation(nextFolding.StartColumn, nextFolding.StartLine);
else
return new TextLocation(nextFolding.EndColumn, nextFolding.EndLine);
}
} while (result < 0);
posX = newPosX;
}
}
return new TextLocation(result, lineNumber);
}
@ -801,7 +810,7 @@ namespace ICSharpCode.TextEditor @@ -801,7 +810,7 @@ namespace ICSharpCode.TextEditor
int GetLogicalColumnInternal(Graphics g, LineSegment line, int start, int end, ref int drawingPos, int targetVisualPosX)
{
if (start == end)
return -1;
return end;
Debug.Assert(start < end);
Debug.Assert(drawingPos < targetVisualPosX);
@ -824,7 +833,7 @@ namespace ICSharpCode.TextEditor @@ -824,7 +833,7 @@ namespace ICSharpCode.TextEditor
for (int i = 0; i < words.Count; i++) {
TextWord word = words[i];
if (wordOffset >= end) {
return -1;
return wordOffset;
}
if (wordOffset + word.Length >= start) {
int newDrawingPos;

6
src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs

@ -89,6 +89,12 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -89,6 +89,12 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestTypeMember("void Method() { }");
}
[Test]
public void StaticMethod()
{
TestTypeMember("static void Method() { }");
}
[Test]
public void PartialModifier()
{

Loading…
Cancel
Save