I have a plugin (CR_Documentor) that can take a selected bit of text and convert it to an XML doc comment. As part of that, I run a sequence of code that looks like this:
TextView.Active.Selection.ExtendToWholeLines();
TextView.Active.Selection.Text = XmlEncode(TextView.Active.Selection.Text); // LINE "A"
for (int i = TextView.Active.Selection.StartLine; i <= TextView.Active.Selection.EndLine; i++)
{
TextView.Active.Selection.TextDocument.TabifyLine(i);
}
string[] lines = TextView.Active.Selection.Lines; // LINE "B"
As you can see, I'm extending the selection to be entirely whole lines, then I XML encode the selection (very simple string search/replace, nothing magic there). Then I run through and call Tabify() on each of the lines there. (I'm not just calling Tabify() on the whole selection because in previous versions of DXCore, that would also tabify the line AFTER the selection. I don't know if that's been fixed or not. That's not the point here, though.)
What I found is that on the line marked LINE "A" the selection is as expected - it's the entire selection, extended to whole lines.
By the time I get to LINE "B", the selection no longer includes the first line. I don't know where it went, but calling Tabify seems to have removed the first line from the selection.
If you select only one line, that means there's no selection by the time we get to LINE "B."
This works correctly in VS2008 under DXCore 2010.1 but fails in VS2010 with the same DXCore.
Steps to Reproduce:
- Create a simple Action that uses code similar to the code outlined above.
- Do something with the selection on LINE "B."
- Select a few whole lines.
- Execute the action.
Actual Results:
The action will run and the code that runs on LINE "B" will miss the first line in the selection.
Expected Results:
The action should run and the entire selection is maintained.