Skip to content

Commit e1e6c35

Browse files
committed
fixed some selection bugs
1 parent 9c8daf0 commit e1e6c35

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

RetailCoder.VBE/Inspections/QualifiedModuleName.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,10 @@ public QualifiedModuleName(string project, string module)
1818

1919
private readonly string _module;
2020
public string ModuleName { get { return _module; } }
21+
22+
public override string ToString()
23+
{
24+
return _project + "." + _module;
25+
}
2126
}
2227
}

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerDockablePresenter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Rubberduck.UI.ToDoItems
1313
{
14-
/// <summary> (Not COM visible) Presenter for the Todo Explorer. </summary>
14+
/// <summary>
15+
/// Presenter for the todo-items explorer.
16+
/// </summary>
1517
[ComVisible(false)]
1618
public class ToDoExplorerDockablePresenter : DockablePresenterBase
1719
{

RetailCoder.VBE/VBA/Nodes/CommentNode.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,13 @@ public CommentNode(string comment, QualifiedSelection qualifiedSelection)
1717

1818
private readonly QualifiedSelection _qualifiedSelection;
1919
public QualifiedSelection QualifiedSelection { get { return _qualifiedSelection; } }
20+
21+
/// <summary>
22+
/// Returns the comment text.
23+
/// </summary>
24+
public override string ToString()
25+
{
26+
return _comment;
27+
}
2028
}
2129
}

RetailCoder.VBE/VBA/VBParser.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public IEnumerable<CommentNode> ParseComments(VBComponent component)
8080
var continuing = false;
8181

8282
var startLine = 0;
83-
int startColumn;
8483

8584
for (var i = 0; i < code.Length; i++)
8685
{
@@ -90,23 +89,25 @@ public IEnumerable<CommentNode> ParseComments(VBComponent component)
9089
if (continuing || line.HasComment(out index))
9190
{
9291
startLine = continuing ? startLine : i;
93-
startColumn = index;
9492

93+
var startColumn = index;
9594
var commentLength = line.Length - index;
9695

9796
continuing = line.EndsWith("_");
9897
if (!continuing)
9998
{
100-
commentBuilder.Append(line.Substring(startColumn, commentLength).Trim());
101-
var selection = new Selection(startLine + 1, startColumn + 1, i, line.Length);
102-
yield return new CommentNode(commentBuilder.ToString(), new QualifiedSelection(qualifiedName, selection));
99+
commentBuilder.Append(line.Substring(startColumn, commentLength).TrimStart());
100+
var selection = new Selection(startLine + 1, startColumn + 1, i + 1, line.Length);
101+
102+
var result = new CommentNode(commentBuilder.ToString(), new QualifiedSelection(qualifiedName, selection));
103103
commentBuilder.Clear();
104+
105+
yield return result;
104106
}
105107
else
106108
{
107-
// ignore line continuations in comment text:
108-
109-
commentBuilder.Append(line.Remove(line.Length - 1).TrimStart());
109+
// ignore line continuations in comment text; take commentLength - 1:
110+
commentBuilder.Append(line.Substring(startColumn, commentLength - 1).TrimStart());
110111
}
111112
}
112113
}

0 commit comments

Comments
 (0)