[Mono-bugs] [Bug 388115] TextBox: when content copied, lines breaks are doubled

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat May 10 08:49:43 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=388115

User andyhume32 at yahoo.co.uk added comment
https://bugzilla.novell.com/show_bug.cgi?id=388115#c2





--- Comment #2 from Andy Hume <andyhume32 at yahoo.co.uk>  2008-05-10 06:49:42 MST ---
Created an attachment (id=214174)
 --> (https://bugzilla.novell.com/attachment.cgi?id=214174)
Repro

TextBoxBase.Copy uses the SelectedText property, so I did some testing of it
and the other string properties.  That shows  that handling of multiline text
is broken in various ways.  It shows that the problem with copy-to-clipboard is
actually in get_SelectedText.   set_Lines is particularly broken also.


The testing covered only TextBox's own insertion of newline characters. 
It did not cover setting/pasting text containing platform, and different,
newline characters.  (On user text entry and set_Lines, is the expected
behaviour that TextBox adds Environment.NewLine between the lines?)

1) Repro app.  Enter two lines e.g. tttT, uuuU, no final newline
* MSFT
Text: Length: 10 Value: >tttT\r\nuuuU< Chars: 't', 't', 't', 'T', \r, \n, 'u',
'u', 'u', U',  
Lines: Count: 2, 'tttT', 'uuuU'
SelectAll & .SelectedText: same as .Text

* Mono
Text Length: 9 Value: >tttT\nuuuU<
Lines Count: 2, 'tttT', 'uuuU'
SelectAll & .SelectedText: 11, tttT\n\r\nuuuU !! double newlines, \n+\r\n

2) Repro app.  Hit <Set Lines>:
* MSFT
Text: similar to above, with content a,b obviously.
Lines: similar to above.
SelectedText: similar to above.

* Mono
Text: 8, aaaAbbbB. !! no newlines
Lines:  3, 'aaa', 'bbb', ''  !! extra trailing blank line
Select All: On first action, cursor jumps to start.  On second, highlight
appears with: !! Last char of each line missing, etc.
SelectedText: empty!!, or: 12, both!! lines end with \r\n

3) Repro app, empty TextBox, hit <Append Lines> multiple times.
MSFT: repeated w,x,w,x,w,x,etc lines as expected.
Mono: First time ok (apparently).  Second time, appends with blank between, and
first section lines are both short of their last letter!!  Third time crash!!:
[[
Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of
range.

at System.Text.StringBuilder.ToString (int,int) <0x0004c>
at System.Windows.Forms.Line.TextWithoutEnding () <0x00045>
at System.Windows.Forms.TextBoxBase.get_Lines () <0x0010a>
at (wrapper remoting-invoke-with-check)
System.Windows.Forms.TextBoxBase.get_Lines () <0x00036>
at <>c__CompilerGenerated1.<DoTextBoxForm>c__7 (object,System.EventArgs)
<0x00017>
at System.Windows.Forms.Control.OnClick (System.EventArgs) <0x00050>
at System.Windows.Forms.Button.OnClick (System.EventArgs) <0x00037>
… ...
]]


-- 
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.


More information about the mono-bugs mailing list