Author: lluis
Date: 2007-02-10 19:02:41 -0500 (Sat, 10 Feb 2007)
New Revision: 72591
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
Log:
* MonoDevelop.SourceEditor.Gui/SourceEditorView.cs,
MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs,
MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: Allow
indenting single lines. Fixes bug #80717.
Modified: trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-02-10
22:35:35 UTC (rev 72590)
+++ trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-02-11
00:02:41 UTC (rev 72591)
@@ -1,3 +1,10 @@
+2007-02-11 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs,
+ MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs,
+ MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs: Allow
+ indenting single lines. Fixes bug #80717.
+
2007-02-10 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Gui/SourceEditorWidget.cs: Make sure markers
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs
2007-02-10 22:35:35 UTC (rev 72590)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Actions/DefaultEditActions.cs
2007-02-11 00:02:41 UTC (rev 72591)
@@ -73,7 +73,7 @@
{
public override void Execute (SourceEditorView sourceView)
{
- if (!sourceView.IndentSelection (true))
+ if (!sourceView.IndentSelection (true, true))
PassToBase = true;
}
}
@@ -82,7 +82,7 @@
{
public override void Execute (SourceEditorView sourceView)
{
- if (!sourceView.IndentSelection (false) &&
!sourceView.InsertTemplate ())
+ if (!sourceView.IndentSelection (false, true) &&
!sourceView.InsertTemplate ())
PassToBase = true;
}
}
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs
2007-02-10 22:35:35 UTC (rev 72590)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs
2007-02-11 00:02:41 UTC (rev 72591)
@@ -633,12 +633,12 @@
void ICodeStyleOperations.IndentSelection ()
{
- se.View.IndentSelection (false);
+ se.View.IndentSelection (false, false);
}
void ICodeStyleOperations.UnIndentSelection ()
{
- se.View.IndentSelection (true);
+ se.View.IndentSelection (true, false);
}
#endregion
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
2007-02-10 22:35:35 UTC (rev 72590)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs
2007-02-11 00:02:41 UTC (rev 72591)
@@ -547,27 +547,33 @@
#region Indentation
- public bool IndentSelection (bool unindent)
+ public bool IndentSelection (bool unindent, bool
requireLineSelection)
{
TextIter begin, end;
- if (!buf.GetSelectionBounds (out begin, out end))
- return false;
+ bool hasSelection = buf.GetSelectionBounds (out begin,
out end);
+ if (!hasSelection) {
+ if (requireLineSelection)
+ return false;
+ else
+ begin = end = buf.GetIterAtMark
(buf.InsertMark);
+ }
int y0 = begin.Line, y1 = end.Line;
+
+ if (requireLineSelection && y0 == y1)
+ return false;
// If last line isn't selected, it's illogical to
indent it.
- if (end.StartsLine())
+ if (end.StartsLine() && hasSelection && y0 != y1)
y1--;
- if (y0 == y1)
- return false;
-
using (AtomicUndo a = new AtomicUndo (buf)) {
if (unindent)
UnIndentLines (y0, y1);
else
IndentLines (y0, y1);
- SelectLines (y0, y1);
+ if (hasSelection)
+ SelectLines (y0, y1);
}
return true;
@@ -645,10 +651,13 @@
void SelectLines (int y0, int y1)
{
Buffer.PlaceCursor (Buffer.GetIterAtLine (y0));
-
- TextIter end = Buffer.GetIterAtLine (y1);
- end.ForwardToLineEnd ();
- Buffer.MoveMark ("selection_bound", end);
+
+ if (y1 < Buffer.EndIter.Line) {
+ TextIter end = Buffer.GetIterAtLine (y1 + 1);
+ end.LineOffset = 0;
+ Buffer.MoveMark ("selection_bound", end);
+ } else
+ Buffer.MoveMark ("selection_bound",
Buffer.EndIter);
}
#endregion
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches