Author: mkrueger
Date: 2008-02-08 20:34:50 -0500 (Fri, 08 Feb 2008)
New Revision: 95318

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Caret.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
Log:
* Mono.TextEditor/TextEditor.cs, Mono.TextEditor/Caret.cs: Overwrite
  mode now works.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-09 
01:26:00 UTC (rev 95317)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-09 
01:34:50 UTC (rev 95318)
@@ -1,5 +1,10 @@
 2008-02-09  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/TextEditor.cs, Mono.TextEditor/Caret.cs: Overwrite 
mode
+         now works.
+
+2008-02-09  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/TextEditor.cs: Fixed caret drawing bug (occurred when
          caret was in line with foldings).
 

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Caret.cs
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Caret.cs  
2008-02-09 01:26:00 UTC (rev 95317)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Caret.cs  
2008-02-09 01:34:50 UTC (rev 95318)
@@ -33,7 +33,7 @@
        {
                DocumentLocation location;
                bool preserveSelection = false;
-               bool isInInsertMode = false;
+               bool isInInsertMode = true;
                bool autoScrollToCaret = true;
                Document document;
 

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-09 01:26:00 UTC (rev 95317)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-09 01:34:50 UTC (rev 95318)
@@ -424,7 +424,12 @@
                                this.textEditorData.DeleteSelectedText ();
                                char ch = (char)key;
                                if (!char.IsControl (ch)) {
-                                       Buffer.Insert (Caret.Offset, new 
StringBuilder (ch.ToString()));
+                                       LineSegment line = Document.GetLine 
(Caret.Line);
+                                       if (Caret.IsInInsertMode 
|| Caret.Column >= line.EditableLength) {
+                                               Buffer.Insert (Caret.Offset, 
new StringBuilder (ch.ToString()));
+                                       } else {
+                                               Buffer.Replace (Caret.Offset, 
1, new StringBuilder (ch.ToString()));
+                                       }
                                        bool autoScroll = 
Caret.AutoScrollToCaret;
                                        Caret.Column++;
                                        Caret.AutoScrollToCaret = autoScroll;
@@ -827,9 +832,9 @@
                                return;
                        gc.RgbFgColor = ColorStyle.Caret;
                        if (Caret.IsInInsertMode) {
-                               win.DrawRectangle (gc, false, new Gdk.Rectangle 
(x, y, this.charWidth, LineHeight));
+                               win.DrawLine (gc, x, y, x, y + LineHeight);
                        } else {
-                               win.DrawLine (gc, x, y, x, y + LineHeight);
+                               win.DrawRectangle (gc, false, new Gdk.Rectangle 
(x, y, this.charWidth, LineHeight - 1));
                        }
                }
                

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

Reply via email to