https://bugzilla.novell.com/show_bug.cgi?id=661904
https://bugzilla.novell.com/show_bug.cgi?id=661904#c0 Summary: RichTextBox.Rtf misinterprets concluding "\par" when .Multiline = False and displays !! exclamation marks Classification: Mono Product: Mono: Class Libraries Version: 2.8.x Platform: x86-64 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: Windows.Forms AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=406617) --> (http://bugzilla.novell.com/attachment.cgi?id=406617) complete VB.NET project. Test by running bin\Release\Test003RichTextBox.exe with Mono. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDC; .NET4.0C) The RichTextBox.Rtf code usually concludes with a "\par", even if it is used in a single-line RichTextBox. For example, an empty single-line RichTextBox has the following .Rtf code: {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} \viewkind4\uc1\pard\f0\fs17\par } However, when I *set* RichTextBox.Rtf to exactly this string, and then read what is in RichTextBox.Rtf, under Mono I get {\rtf1\ansi\ansicpg1252\deff0\deflang1033 {\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} {\*\generator Mono RichTextBox;}\pard\f0\fs16 \par \par } Thus, Mono has added a "\par" tag at the end of the .Rtf code. The two "\par" tags are displayed in Mono as two odd-looking exclamation marks. Setting this latter string to RichTextBox.Rtf again, will add yet another "\par" at the end (and more exclamation marks in the display). Reproducible: Always Steps to Reproduce: 1. Create a Windows Form1 with * One RichTextBox control, setting RichTextBox1.Multiline = False * One large TextBox control, setting TextBox1.Multline = True (make the control at least 10-15 lines high!) * One Button Here's the VB.NET designer code: <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub Private components As System.ComponentModel.IContainer <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.RichTextBox1 = New System.Windows.Forms.RichTextBox Me.TextBox1 = New System.Windows.Forms.TextBox Me.Button1 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'RichTextBox1 ' Me.RichTextBox1.Location = New System.Drawing.Point(21, 21) Me.RichTextBox1.Multiline = False Me.RichTextBox1.Name = "RichTextBox1" Me.RichTextBox1.Size = New System.Drawing.Size(479, 26) Me.RichTextBox1.TabIndex = 0 Me.RichTextBox1.Text = "" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(22, 61) Me.TextBox1.Multiline = True Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(477, 187) Me.TextBox1.TabIndex = 1 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(514, 21) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 2 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(611, 262) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.RichTextBox1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button End Class 2. Add the following VB.NET code to Form1: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TextBox1.Text = RichTextBox1.Rtf End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click RichTextBox1.Rtf = RichTextBox1.Rtf TextBox1.Text = RichTextBox1.Rtf End Sub 3. Start the programme and click the button several times. Actual Results: The textbox displays the RichTextBox.Rtf code. If run under Mono, another "/par" is added at the end of the code with every button click. In the RichTextBox line, with every button click more exclamation marks appear (although we never entered any text to the RichTextBox!) Expected Results: The RichTextBox should remain empty (instead of showing exclamation marks), and the TextBox should always show the same .Rtf code with always exactly one "/par" at the end (which is what happens if the .exe is run using .NET without Mono). The reported bug appears on Windows and Mac (sorry, I could not test Linux) As a workaround, things work if you remove every "\par" tag (and every Cr/Lf character) that precedes the concluding "}" in the .Rtf code before setting RichTextBox.Rtf. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
