Author: mkrueger
Date: 2008-02-03 07:13:39 -0500 (Sun, 03 Feb 2008)
New Revision: 94675

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSplitter.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
Log:
* Mono.TextEditor/LineSplitter.cs, Mono.TextEditor/TextEditor.cs,
  Mono.TextEditor/GutterMargin.cs: Gutter redraws on width changes.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-03 
12:12:24 UTC (rev 94674)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-03 
12:13:39 UTC (rev 94675)
@@ -1,5 +1,10 @@
 2008-02-03  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/LineSplitter.cs, Mono.TextEditor/TextEditor.cs,
+         Mono.TextEditor/GutterMargin.cs: Gutter redraws on width changes.
+
+2008-02-03  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/LineSplitter.cs: Added some safety checks.
 
 2008-02-01  Mike Krüger <[EMAIL PROTECTED]> 

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   2008-02-03 12:12:24 UTC (rev 94674)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   2008-02-03 12:13:39 UTC (rev 94675)
@@ -42,8 +42,22 @@
                        layout = new Pango.Layout (editor.PangoContext);
                        TextEditorOptions.Changed += OptionsChanged;
                        OptionsChanged (this, EventArgs.Empty);
+                       editor.TextEditorData.Document.Splitter.LinesInserted 
+= LineCountChanged;
+                       editor.TextEditorData.Document.Splitter.LinesRemoved += 
LineCountChanged;
                }
                
+               int oldWidth = 1;
+               void LineCountChanged (object sender, LineEventArgs args)
+               {
+                       int newWidth = (int)System.Math.Log10 
(editor.TextEditorData.Document.Splitter.LineCount);
+                       if (oldWidth != newWidth) {
+                               editor.TextEditorData.Document.RequestUpdate 
(new UpdateAll ());
+                               
editor.TextEditorData.Document.CommitDocumentUpdate ();
+                               oldWidth = newWidth;
+                       }
+                       
+               }
+               
                protected virtual void OptionsChanged (object sender, EventArgs 
args)
                {
                        layout.FontDescription = TextEditorOptions.Options.Font;

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSplitter.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSplitter.cs
   2008-02-03 12:12:24 UTC (rev 94674)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/LineSplitter.cs
   2008-02-03 12:13:39 UTC (rev 94675)
@@ -86,7 +86,7 @@
                {
                        if (args.Count > 0)
                                TextRemove (args.Offset, args.Count);
-                       if (args.Value != null && args.Count > 0)
+                       if (args.Value != null && args.Value.Length > 0)
                                TextInsert (args.Offset, args.Value);
                }
 

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-03 12:12:24 UTC (rev 94674)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-03 12:13:39 UTC (rev 94675)
@@ -780,7 +780,7 @@
                {
                        SyntaxMode mode = Document.SyntaxMode != null && 
TextEditorOptions.Options.EnableSyntaxHighlighting ? Document.SyntaxMode : 
SyntaxMode.Default;
                        Chunk[] chunks = mode.GetChunks (Document, 
TextEditorData.ColorStyle, line, offset, length);
-                       int start  = offset;
+//                     int start  = offset;
                        int xStart = xPos;
                        offset = line.Offset + line.EditableLength - offset;
                        Gdk.Color selectedTextColor = ColorStyle.SelectedFg;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to