Author: mhutch
Date: 2007-11-08 13:23:34 -0500 (Thu, 08 Nov 2007)
New Revision: 89222

Modified:
   trunk/monodevelop/Extras/CSharpBinding/ChangeLog
   trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
Log:
* Gui/CSharpTextEditorExtension.cs: Don't try to look back at chars
  before the beginning of the buffer when deciding how to handle
  tabs. Restructure/comment the affected code so it's easier to
  understand. Fixes "Bug 340270 - Ctrl+Tab caused exception".

Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-11-08 18:00:43 UTC 
(rev 89221)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2007-11-08 18:23:34 UTC 
(rev 89222)
@@ -1,3 +1,10 @@
+2007-11-08  Michael Hutchinson <[EMAIL PROTECTED]> 
+
+       * Gui/CSharpTextEditorExtension.cs: Don't try to look back at chars 
before
+         the beginning of the buffer when deciding how to handle tabs.
+         Restructure/comment the affected code so it's easier to understand.
+         Fixes "Bug 340270 - Ctrl+Tab caused exception".
+
 2007-11-08  Mike Krüger <[EMAIL PROTECTED]> 
 
        * Gui/CSharpTextEditorExtension.cs, Parser/Resolver.cs: Fixed "Bug 
335140 -

Modified: 
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-11-08 18:00:43 UTC (rev 89221)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs     
2007-11-08 18:23:34 UTC (rev 89222)
@@ -494,7 +494,14 @@
                                //
                                // Tab is interpreted as a reindent command 
when it's neither at the end of a line nor in a verbatim string
                                // and when a tab has just been inserted (i.e. 
not a template or an autocomplete command)
-                               if ((!indentEngine.IsInsideVerbatimString && 
(nextChar != '\n' || Editor.GetCharAt (cursor - 2) == '\n')) && 
Editor.GetCharAt (cursor -1) == '\t') {
+                               if (!indentEngine.IsInsideVerbatimString
+                                   && cursor >= 1 && Editor.GetCharAt (cursor 
- 1) == '\t' //tab was actually inserted, or in a region of tabs
+                                   && (
+                                       nextChar != '\n' // not at the end of a 
line
+                                       || (cursor >= 2 && Editor.GetCharAt 
(cursor - 2) == '\n') //unless also at the beginning of a line
+                                       )
+                                   )
+                               {
                                        Editor.DeleteText (cursor - 1, 1);
                                        reIndent = true;
                                }

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

Reply via email to