Author: fejj
Date: 2007-07-27 13:17:58 -0400 (Fri, 27 Jul 2007)
New Revision: 82873

Modified:
   trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
   
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
   
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
Log:
2007-07-27  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (IndentLine): If
        no text was inserted, simply return instead of spending time
        readjusting the cursor position unnecessarily.



Modified: trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-07-27 
17:11:45 UTC (rev 82872)
+++ trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-07-27 
17:17:58 UTC (rev 82873)
@@ -1,3 +1,9 @@
+2007-07-27  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs (IndentLine): If
+       no text was inserted, simply return instead of spending time
+       readjusting the cursor position unnecessarily.
+
 2007-07-25  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MonoDevelop.SourceEditor.addin.xml: Add commands to the TextEditor

Modified: 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
===================================================================
--- 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
        2007-07-27 17:11:45 UTC (rev 82872)
+++ 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
        2007-07-27 17:17:58 UTC (rev 82873)
@@ -665,17 +665,9 @@
 
                public char GetCharAt (int offset)
                {
-                       /*if (offset < 0)
-                         offset = 0;
-                         TextIter begin_iter = GetIterAtOffset (offset);
-                         TextIter next_iter = begin_iter;
-                         next_iter.ForwardChar ();
-                         string text = GetText (begin_iter, next_iter, true);
-                         if (text != null && text.Length >= 1)
-                         return text[0];*/
-                       //New test implementation
                        if (offset < 0)
                                offset = 0;
+                       
                        TextIter iter = GetIterAtOffset (offset);
                        if (iter.Equals (TextIter.Zero))
                                return ' ';

Modified: 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
===================================================================
--- 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
  2007-07-27 17:11:45 UTC (rev 82872)
+++ 
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
  2007-07-27 17:17:58 UTC (rev 82873)
@@ -494,11 +494,11 @@
                        buf.EndUserAction ();
                }
                
-               public int FindPrevWordStart (string doc, int offset)
+               int FindPrevWordStart (string doc, int offset)
                {
-                       for ( offset-- ; offset >= 0 ; offset--)
-                       {
-                               if (System.Char.IsWhiteSpace (doc, offset)) 
break;
+                       for (offset--; offset >= 0; offset--) {
+                               if (Char.IsWhiteSpace (doc, offset))
+                                       break;
                        }
                        return ++offset;
                }
@@ -520,12 +520,13 @@
                        return start;
                }
 
-               public string GetLeadingWhiteSpace (int line) {
+               public string GetLeadingWhiteSpace (int line)
+               {
                        string lineText = ThisEditor.GetLineText (line + 1);
                        int index = 0;
-                       while (index < lineText.Length && 
System.Char.IsWhiteSpace (lineText[index])) {
-                               index++;
-                       }
+                       while (index < lineText.Length && 
System.Char.IsWhiteSpace (lineText[index]))
+                               index++;
+                       
                        return index > 0 ? lineText.Substring (0, index) : "";
                }
 
@@ -645,12 +646,15 @@
                public void IndentLine ()
                {
                        TextIter iter = buf.GetIterAtMark (buf.InsertMark);
-
+                       
                        // preserve offset in line
-                       int offset = 0;
-                       int chars = fmtr.IndentLine (ThisEditor, iter.Line + 1, 
IndentString);
-                       offset += chars;
-
+                       int n, offset = 0;
+                       
+                       if ((n = fmtr.IndentLine (ThisEditor, iter.Line + 1, 
IndentString)) == 0)
+                               return;
+                       
+                       offset += n;
+                       
                        // FIXME: not quite right yet
                        // restore the offset
                        TextIter nl = buf.GetIterAtMark (buf.InsertMark);

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

Reply via email to