2009-09-08 Carlos Alberto Cortez <calberto.cortez@gmail.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / RichTextBox.cs
index 135dd401c722d485561433b19840065d87611200..437e81062aef9227891a9e15d6a6a1ac3aa03037 100644 (file)
@@ -1744,9 +1744,8 @@ namespace System.Windows.Forms {
 
                        rtf_chars += rtf_line.Length;
 
-
-
-                       if (rtf_cursor_x == 0) {
+                       // Only add a new line in the document if we need to - reuse otherwise
+                       if (rtf_cursor_x == 0 && rtf_cursor_y > document.Lines) {
                                if (newline && rtf_line.ToString ().EndsWith (Environment.NewLine) == false)
                                        rtf_line.Append (Environment.NewLine);