Author: mkrueger Date: 2008-02-19 14:02:51 -0500 (Tue, 19 Feb 2008) New Revision: 96173
Added: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs Log: * Mono.TextEditor/DefaultEditActions.cs, Mono.TextEditor/TextEditorData.cs, Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs: Fixed "Bug 362983 - Text selected with Select All can't be unselected" Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog =================================================================== --- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-19 18:42:34 UTC (rev 96172) +++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-19 19:02:51 UTC (rev 96173) @@ -1,5 +1,11 @@ 2008-02-19 Mike Krüger <[EMAIL PROTECTED]> + * Mono.TextEditor/DefaultEditActions.cs, Mono.TextEditor/TextEditorData.cs, + Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs: + Fixed "Bug 362983 - Text selected with Select All can't be unselected" + +2008-02-19 Mike Krüger <[EMAIL PROTECTED]> + * Mono.TextEditor.Tests/Mono.TextEditor.Tests.pidb: Copy to primary clipboard is now lazy (Improves performance for large selections). Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs =================================================================== --- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs 2008-02-19 18:42:34 UTC (rev 96172) +++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/DefaultEditActions.cs 2008-02-19 19:02:51 UTC (rev 96173) @@ -318,6 +318,7 @@ data.SelectionAnchor = 0; new CaretMoveToDocumentEnd ().Run (data); data.ExtendSelectionTo (data.Document.Length); + data.Caret.PreserveSelection = false; data.Caret.AutoScrollToCaret = true; } } Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs =================================================================== --- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs 2008-02-19 18:42:34 UTC (rev 96172) +++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs 2008-02-19 19:02:51 UTC (rev 96173) @@ -214,6 +214,8 @@ public void ClearSelection () { + if (!this.IsSomethingSelected) + return; this.selectionAnchor = -1; this.selectionRange = null; OnSelectionChanged (EventArgs.Empty); Added: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs =================================================================== --- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs 2008-02-19 18:42:34 UTC (rev 96172) +++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs 2008-02-19 19:02:51 UTC (rev 96173) @@ -0,0 +1,85 @@ +// +// SelectionSelectAllTests.cs +// +// Author: +// Mike Krüger <[EMAIL PROTECTED]> +// +// Copyright (C) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using NUnit.Framework; + +namespace Mono.TextEditor.Tests +{ + [TestFixture()] + public class SelectionSelectAllTests + { + [Test()] + public void TestSelectAll () + { + TextEditorData data = new Mono.TextEditor.TextEditorData (); + data.Document.Text = +@"123456789 +123456789 +123456789 +123456789 +123456789 +123456789"; + + Assert.IsFalse (data.IsSomethingSelected); + new SelectionSelectAll ().Run (data); + Assert.IsTrue (data.IsSomethingSelected); + + Assert.AreEqual (data.SelectionRange.Offset, 0); + Assert.AreEqual (data.SelectionRange.EndOffset, data.Document.Length); + Assert.AreEqual (data.SelectionRange.EndOffset, data.Caret.Offset); + } + + + // Bug 362983 - Text selected with Select All can't be unselected + // Open a file, press ctrl+a to select all text. Move the cursor or click anywhere + // in the file. The selection is never erased. + [Test()] + public void TestSelectAllBug362983 () + { + TextEditorData data = new Mono.TextEditor.TextEditorData (); + data.Document.Text = "Test"; + Assert.IsFalse (data.IsSomethingSelected); + new SelectionSelectAll ().Run (data); + Assert.IsTrue (data.IsSomethingSelected); + data.Caret.Offset = 0; + Assert.IsFalse (data.IsSomethingSelected); + } + + [TestFixtureSetUp] + public void SetUp() + { + Gtk.Application.Init (); + } + + [TestFixtureTearDown] + public void Dispose() + { + } + } +} Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp =================================================================== --- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp 2008-02-19 18:42:34 UTC (rev 96172) +++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Tests/Mono.TextEditor.Tests.mdp 2008-02-19 19:02:51 UTC (rev 96173) @@ -22,6 +22,7 @@ <File name="Mono.TextEditor.Tests/DocumentTests.cs" subtype="Code" buildaction="Compile" /> <File name="Mono.TextEditor.Tests/SelectionTests.cs" subtype="Code" buildaction="Compile" /> <File name="Mono.TextEditor.Tests.DefaultEditActions/RemoveTabTests.cs" subtype="Code" buildaction="Compile" /> + <File name="Mono.TextEditor.Tests.DefaultEditActions/SelectionSelectAllTests.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Project" localcopy="True" refto="Mono.TextEditor" /> _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches