From c6c5cf6b4a6798c010d85100fa6dc8fad65c47c3 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 10 Jul 2008 09:41:33 +0000 Subject: [PATCH] Prevent user from deleting the console pad prompt. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3202 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs index fcebc9edc0..50b3e90de1 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs @@ -61,6 +61,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { this.Document.Insert(this.Document.TextLength, "> "); this.ActiveTextAreaControl.Caret.Position = this.Document.OffsetToPosition(this.Document.TextLength); + this.Document.UndoStack.ClearAll(); // prevent user from undoing the prompt insertion } string GetLastLineText() @@ -73,7 +74,12 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { // All lines except the last one are read-only int codeStart = this.Document.PositionToOffset(new TextLocation(2, this.Document.LineSegmentCollection.Count - 1)); + // make document read-only if caret is before codeStart or there is a selection before codeStart this.Document.ReadOnly = (this.ActiveTextAreaControl.Caret.Offset < codeStart); + foreach (ISelection selection in this.ActiveTextAreaControl.SelectionManager.SelectionCollection) { + if (selection.Offset < codeStart) + this.Document.ReadOnly = true; + } if (keys == Keys.Back) { if (this.ActiveTextAreaControl.Caret.Offset <= codeStart) {