Bug 682466

Summary: Rendering corruption and jumping in text editor
Product: [Mono] MonoDevelop Reporter: Michael Hutchinson <mhutchinson>
Component: texteditorAssignee: Mike Krueger <mkrueger>
Status: RESOLVED FIXED QA Contact: MD Bugs <monodevelop-bugs>
Severity: Major    
Priority: P5 - None CC: ibboard, jclancey
Version: SVN   
Target Milestone: ---   
Hardware: x86   
OS: Mac OS X 10.6   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Michael Hutchinson 2011-03-24 20:32:02 UTC
When I type anything in a class body in the text editor, it immediately unfolds the header comment, and the editor "jumps", and the editor's rendering is majorly corrupted.

http://screencast.com/t/K0K7S1SVYga
Comment 1 Michael Hutchinson 2011-03-24 21:49:36 UTC
In addition, the document often overruns the last line number (and not selectable).

Cutting a substantial part of the buffer causes MD to crash:

ERROR [2011-03-24 17:36:57Z]: Unhandled Exception
System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.TextEditor.Document.LogicalToVisualLine (Int32 logicalLine) [0x0001f] in /Users/michael/Mono/md-clean/main/src/core/Mono.Texteditor/Mono.TextEditor/Document.cs:1263 
  at Mono.TextEditor.TextEditor.UpdateAdjustments () [0x00000] in /Users/michael/Mono/md-clean/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs:1461 
  at Mono.TextEditor.TextEditor.OnExposeEvent (Gdk.EventExpose e) [0x0000d] in /Users/michael/Mono/md-clean/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs:1475 
  at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000] in <filename unknown>:0
Comment 2 Michael Hutchinson 2011-03-26 22:12:37 UTC
*** Bug 682867 has been marked as a duplicate of this bug. ***
Comment 3 Mike Krueger 2011-03-28 07:39:43 UTC
I thought I did handle the folding correctly - but missed that update case. 

fixed & added to the unit tests.
Comment 4 IB Board 2011-03-29 19:28:28 UTC
I think this is still occurring in some cases. Rather than folding/unfolding code, try deleting a method including its folded doc comments and then undo it - the rendering breaks. Close the file, open it again, expand the doc, delete the method including the *expanded* doc and then undo it - all seems fine.
Comment 5 IB Board 2011-04-03 19:36:43 UTC
This is definitely still occurring for me in some situations. The basic situation is better, but there are still use cases where it happens. I'll try and track down a few more instructions on how to recreate above and beyond comment 4.
Comment 6 IB Board 2011-04-04 19:23:50 UTC
Formatting code seems to break it at the moment. Fold the comments, format the code and then see things shuffle around as they did before (even if no formatting needed changing)
Comment 7 Mike Krueger 2011-04-13 08:17:47 UTC
fixed. It seems that I broke the folding - again -. 

I've extended the unit test suite quite a bit - I hope I got all cases this time.
Comment 8 Mike Krueger 2011-04-13 08:20:05 UTC
*** Bug 687029 has been marked as a duplicate of this bug. ***