2
0
Эх сурвалжийг харах

* TextControl.cs: When replacing the selection move the
* selection
start/end/anchor to the end of the new text.


svn path=/trunk/mcs/; revision=67248

Jackson Harper 19 жил өмнө
parent
commit
d6267c679d

+ 5 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,8 @@
+2006-11-01  Jackson Harper  <[email protected]>
+
+	* TextControl.cs: When replacing the selection move the selection
+	start/end/anchor to the end of the new text.
+
 2006-11-01  Jackson Harper  <[email protected]>
 
 	* XplatUIWin32.cs: When setting the parent change the controls

+ 9 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs

@@ -3312,6 +3312,7 @@ if (owner.backcolor_set || (owner.Enabled && !owner.read_only)) {
 		internal void ReplaceSelection(string s) {
 			int		i;
 
+			int selection_start_pos = LineTagToCharIndex (selection_start.line, selection_start.pos);
 			// First, delete any selected text
 			if ((selection_start.pos != selection_end.pos) || (selection_start.line != selection_end.line)) {
 				if (!multiline || (selection_start.line == selection_end.line)) {
@@ -3351,13 +3352,19 @@ if (owner.backcolor_set || (owner.Enabled && !owner.read_only)) {
 				}
 			}
 
-
+			
 			Insert(selection_start.line, null, selection_start.pos, true, s);
 
+			CharIndexToLineTag(selection_start_pos + s.Length, out selection_start.line,
+					out selection_start.tag, out selection_start.pos);
+			
 			selection_end.line = selection_start.line;
 			selection_end.pos = selection_start.pos;
 			selection_end.tag = selection_start.tag;
-
+			selection_anchor.line = selection_start.line;
+			selection_anchor.pos = selection_start.pos;
+			selection_anchor.tag = selection_start.tag;
+			
 			SetSelectionVisible (false);
 		}