Bug 4274 - Adding a comment below a collapse comment block will cause code below the comment to show up incorrectly.
Summary: Adding a comment below a collapse comment block will cause code below the com...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-04-05 17:11 UTC by David Ferguson
Modified: 2012-04-07 14:02 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David Ferguson 2012-04-05 17:11:55 UTC
Description of Problem:

If I have a comment block that is collapsed and a I comment a line of code directly below the comment block, the collapsed comment block will then include the newly commented line in its comment block resulting in the newly comment block disappearing.  However, if you start moving the cursor down subsequent lines, you'll see the text editor display the wrong text due to the comment line being consumed by the collapsed comment block.

Steps to reproduce the problem:
1. Put the following code in a method:

   1         //var x = 1;
   2         //var y = x + 1;
   3         var y = x;
   5         Console.WriteLine("Test1");
   6         Console.WriteLine("Test2");
   7         Console.WriteLine("Test3");

2. Collapse the comment block at 'var x = 1;' (Line 1)

3. Comment Line 3 using //  (You'll notice a character disappear)

4. Move the cursor with arrow keys to Line 2 (Line 3 will then disappear)

5. Move the cursor to Line 3 again, then to Line 4.  You'll now see Console.WriteLine("Test1"); appearing twice.

Actual Results:

The text editor will display:

[//var  x = 1; ...]


If you continue to move the cursor down, you'll see something like:

[//var  x = 1; ...]


Expected Results:

The text editor should either not allow comment blocks to pull additional comments into the collapsed section, or it should take that into account when navigating lines.  At the very least, duplicate 'ghost' code shouldn't be seen.

How often does this happen? 


Additional Information:

Moving focus away from MD and back causes the text editor to reset its state correctly.
Comment 1 Simon Lindgren 2012-04-05 17:48:19 UTC
There is an additional probably related issue with documentation comments:

Start with:

namespace Bug4274
	/// <summary>
	/// Main class.
	/// </summary>
	class MainClass

1. Collapse the doc comment
2. Move the cursor to the "class MainClass" line
3. Move the cursor to the first position on the line, and then one more char to the left
4. Press enter to get a new line of doc comment.

The issue:
After a second, a phantom char 's' appears to the right of the cursor. Pressing delete removes the newline. Stepping to the right results in the previously described behavior.

Additional observation:
Pressing enter repeatedly and then expanding the doc comment shows that the lines are added to the comment as expected. No 's' chars are included.
Comment 2 Mike Krüger 2012-04-07 14:02:54 UTC