Bug 111 - Editor completely messes up the source code
Summary: Editor completely messes up the source code
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.6 RC 1
Hardware: Macintosh Mac OS
: Low normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2011-07-29 10:13 UTC by guivho
Modified: 2011-11-10 05:00 UTC (History)
3 users (show)

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


Attachments
Layout before and after pressing enter (257.64 KB, image/png)
2011-07-29 10:13 UTC, guivho
Details
Demo project and png's with Before and after situations (160.56 KB, application/text)
2011-08-21 14:35 UTC, guivho
Details


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:
Status:
RESOLVED FIXED

Description guivho 2011-07-29 10:13:26 UTC
Created attachment 33 [details]
Layout before and after pressing enter

This is a bug on MD 2.6b3 running on an iMac with OSX 10.6.8

It occurs both with and without vi-mode.
I just put my cursor at the end of a source line and hit enter.

Rather than inserting a blank line, it completely messes up the code.
I added two clips to demonstrate this awkward problem.

The 'before' screen shows the code as it is. I put the cursor at the end of the first line in the method (so behind 'var stackTrace = new StackTrace(true);' and hit enter. That's the only key I touch, and the result can be seen in the 'after' clip.

MonoDevelop is completely unusable with this error.

When I activate the VI behaviour, switch to insert mode at the end of the line, I get the same behaviour when hitting enter.
Comment 1 Miguel de Icaza [MSFT] 2011-07-29 16:52:03 UTC
Does this happen with any block of text, or just in some files, like this one?

If it happens only in a few, please trim out your project to only contain the file that has the problem and attach the result.
Comment 2 Mike Krüger 2011-07-30 00:22:43 UTC
Two questions:

1) Is auto formatting enabled ? (if yes, disable it - does it still happen ?)
2) Does this happen in other files as well ? Try a simple console project.

if it just happens in this case/file I would like to have the project to fix the bug.
Comment 3 guivho 2011-07-30 03:02:58 UTC
Miguel and Mike,

It only happens if On-the-fly formatting is enabled.
It does not always happen. I failed to create a little project to demonstrate it.
I'm mailing a one source library project which does exhibit the problem.
Just insert a line after existing statements and you'll see the problem.

Molly.
Comment 4 guivho 2011-08-21 14:35:13 UTC
Created attachment 161 [details]
Demo project and png's with Before and after situations

I just installed RC1 on my Mac, and the editor problem is still there.
I attach a zip file with a demo project.
Just open the Extensions.cs file and add a return at the end of line 32
and the result is that line 32 disappears and the return statement on
line 33 gets indented by about 11 columns. This line 33 also gets a red
wavy underline, which is not really correct. It still is a valid
statement.
You can see the Before and After situations in the two png's that are in
the zip file.
Comment 5 guivho 2011-09-08 03:01:31 UTC
I installed the official 2.6 release on my iMac. 
'Enable on the fly code formatting' still messes up the code.
You can use attachment 161 [details] (see my previous comment) to verify the problem.
Comment 6 Mike Krüger 2011-09-08 03:13:23 UTC
I had not really much time working on the formatter - but I can verify the issue with your test project. 

I'll look at it.

Thanks
Comment 7 guivho 2011-09-08 03:21:17 UTC
Hey Mike, there's no urgency. 
I just wanted to signal that this is still an issue.
Guivho.
Comment 8 Mike Krüger 2011-11-10 05:00:27 UTC
Closing this one (2.8 has a new formatting engine).