Author: mhutch
Date: 2008-02-06 19:39:29 -0500 (Wed, 06 Feb 2008)
New Revision: 95102
Modified:
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/ChangeLog
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
branches/monodevelop/main/1.0/src/addins/SourceEditor2/ChangeLog
branches/monodevelop/main/1.0/src/addins/SourceEditor2/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
Log:
In src/addins/SourceEditor2:
2008-02-06 Michael Hutchinson <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Tidy up
commenting/uncommenting code, using atomic undos, and fix "Bug 325469
-
Comment and uncomment function".
* MonoDevelop.SourceEditor.addin.xml: Fix command IDs for
comment/uncomment.
In src/addins/MonoDevelop.SourceEditor:
2008-02-06 Michael Hutchinson <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Tidy up
commenting/uncommenting code, using atomic undos, and fix "Bug 325469
-
Comment and uncomment function".
* MonoDevelop.SourceEditor.addin.xml: Fix command IDs for
comment/uncomment.
Modified:
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/ChangeLog
===================================================================
--- branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/ChangeLog
2008-02-07 00:11:48 UTC (rev 95101)
+++ branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/ChangeLog
2008-02-07 00:39:29 UTC (rev 95102)
@@ -1,3 +1,10 @@
+2008-02-06 Michael Hutchinson <[EMAIL PROTECTED]>
+
+ * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Tidy up
+ commenting/uncommenting code, using atomic undos, and fix "Bug 325469
-
+ Comment and uncomment function".
+ * MonoDevelop.SourceEditor.addin.xml: Fix command IDs for
comment/uncomment.
+
2008-02-04 Mike Krüger <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs:
Implemented
Modified:
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
===================================================================
---
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
2008-02-07 00:11:48 UTC (rev 95101)
+++
branches/monodevelop/main/1.0/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
2008-02-07 00:39:29 UTC (rev 95102)
@@ -743,28 +743,29 @@
TextIter start, end;
string commentTag;
- if (!GetSelectionBounds (out start, out end))
- return;
+ if (GetSelectionBounds (out start, out end)) {
+ //selection; can contain multiple lines
+ // Don't comment lines where no chars are
actually selected (fixes bug #81632)
+ if (end.LineOffset == 0)
+ end.BackwardLine ();
+ }
- commentTag = Services.Languages.GetBindingPerFileName
(IdeApp.Workbench.ActiveDocument.FileName).CommentTag;
+ ILanguageBinding binding =
Services.Languages.GetBindingPerFileName
(IdeApp.Workbench.ActiveDocument.FileName);
+ commentTag = "//";
+ if (binding != null && binding.CommentTag != null)
+ commentTag = binding.CommentTag;
- if (commentTag == null)
- commentTag = "//";
-
- // Don't comment lines where no chars are actually
selected (fixes bug #81632)
- if (end.LineOffset == 0)
- end.BackwardLine ();
-
start.LineOffset = 0;
endMark = CreateMark (null, end, false);
-
- while (start.Line <= end.Line) {
- curMark = CreateMark (null, start, true);
- Insert (ref start, commentTag);
- start = GetIterAtMark (curMark);
- end = GetIterAtMark (endMark);
- start.ForwardLine ();
+ using (new AtomicUndo (this)) {
+ while (start.Line <= end.Line) {
+ curMark = CreateMark (null, start,
true);
+ Insert (ref start, commentTag);
+ start = GetIterAtMark (curMark);
+ end = GetIterAtMark (endMark);
+ start.ForwardLine ();
+ }
}
}
@@ -776,20 +777,12 @@
TextIter textStart;
TextIter textEnd;
GetSelectionBounds (out textStart, out textEnd);
-// if (textStart.Line == textEnd.Line)
-// { // all the code is in one line, just uncomment is
text starts with comment tag
-// textStart.LineOffset = 0;
-// textEnd = textStart;
-// textEnd.ForwardChars (commentTag.Length);
-// if (textStart.GetText (textEnd) == commentTag)
-// Delete (ref textStart, ref textEnd);
-// }
-// else
- { // uncomment the entire lines
- int numberOfLines = textStart.Line ==
textEnd.Line ? 1 : textEnd.Line - textStart.Line + 1;
- TextMark mTextStart = CreateMark (null,
textStart, true);
- TextMark mTextTmp = mTextStart;
-
+
+ int numberOfLines = textStart.Line == textEnd.Line ? 1
: textEnd.Line - textStart.Line + 1;
+ TextMark mTextStart = CreateMark (null, textStart,
true);
+ TextMark mTextTmp = mTextStart;
+
+ using (new AtomicUndo (this)) {
for (int i=0; i<numberOfLines; i++)
{
TextIter textTmp = GetIterAtMark
(mTextTmp);
Modified: branches/monodevelop/main/1.0/src/addins/SourceEditor2/ChangeLog
===================================================================
--- branches/monodevelop/main/1.0/src/addins/SourceEditor2/ChangeLog
2008-02-07 00:11:48 UTC (rev 95101)
+++ branches/monodevelop/main/1.0/src/addins/SourceEditor2/ChangeLog
2008-02-07 00:39:29 UTC (rev 95102)
@@ -1,3 +1,10 @@
+2008-02-06 Michael Hutchinson <[EMAIL PROTECTED]>
+
+ * MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs: Tidy up
+ commenting/uncommenting code, using atomic undos, and fix "Bug 325469
-
+ Comment and uncomment function".
+ * MonoDevelop.SourceEditor.addin.xml: Fix command IDs for
comment/uncomment.
+
2008-02-04 Mike Krüger <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs:
Implemented
Modified:
branches/monodevelop/main/1.0/src/addins/SourceEditor2/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
===================================================================
---
branches/monodevelop/main/1.0/src/addins/SourceEditor2/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
2008-02-07 00:11:48 UTC (rev 95101)
+++
branches/monodevelop/main/1.0/src/addins/SourceEditor2/MonoDevelop.SourceEditor.Gui/SourceEditorBuffer.cs
2008-02-07 00:39:29 UTC (rev 95102)
@@ -744,28 +744,29 @@
TextIter start, end;
string commentTag;
- if (!GetSelectionBounds (out start, out end))
- return;
+ if (GetSelectionBounds (out start, out end)) {
+ //selection; can contain multiple lines
+ // Don't comment lines where no chars are
actually selected (fixes bug #81632)
+ if (end.LineOffset == 0)
+ end.BackwardLine ();
+ }
- commentTag = Services.Languages.GetBindingPerFileName
(IdeApp.Workbench.ActiveDocument.FileName).CommentTag;
+ ILanguageBinding binding =
Services.Languages.GetBindingPerFileName
(IdeApp.Workbench.ActiveDocument.FileName);
+ commentTag = "//";
+ if (binding != null && binding.CommentTag != null)
+ commentTag = binding.CommentTag;
- if (commentTag == null)
- commentTag = "//";
-
- // Don't comment lines where no chars are actually
selected (fixes bug #81632)
- if (end.LineOffset == 0)
- end.BackwardLine ();
-
start.LineOffset = 0;
endMark = CreateMark (null, end, false);
-
- while (start.Line <= end.Line) {
- curMark = CreateMark (null, start, true);
- Insert (ref start, commentTag);
- start = GetIterAtMark (curMark);
- end = GetIterAtMark (endMark);
- start.ForwardLine ();
+ using (new AtomicUndo (this)) {
+ while (start.Line <= end.Line) {
+ curMark = CreateMark (null, start,
true);
+ Insert (ref start, commentTag);
+ start = GetIterAtMark (curMark);
+ end = GetIterAtMark (endMark);
+ start.ForwardLine ();
+ }
}
}
@@ -777,20 +778,12 @@
TextIter textStart;
TextIter textEnd;
GetSelectionBounds (out textStart, out textEnd);
-// if (textStart.Line == textEnd.Line)
-// { // all the code is in one line, just uncomment is
text starts with comment tag
-// textStart.LineOffset = 0;
-// textEnd = textStart;
-// textEnd.ForwardChars (commentTag.Length);
-// if (textStart.GetText (textEnd) == commentTag)
-// Delete (ref textStart, ref textEnd);
-// }
-// else
- { // uncomment the entire lines
- int numberOfLines = textStart.Line ==
textEnd.Line ? 1 : textEnd.Line - textStart.Line + 1;
- TextMark mTextStart = CreateMark (null,
textStart, true);
- TextMark mTextTmp = mTextStart;
-
+
+ int numberOfLines = textStart.Line == textEnd.Line ? 1
: textEnd.Line - textStart.Line + 1;
+ TextMark mTextStart = CreateMark (null, textStart,
true);
+ TextMark mTextTmp = mTextStart;
+
+ using (new AtomicUndo (this)) {
for (int i=0; i<numberOfLines; i++)
{
TextIter textTmp = GetIterAtMark
(mTextTmp);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches