Opened 7 years ago

Closed 7 years ago

#162 closed defect (invalid)

ListView>>contents returns CR in a String by default

Reported by: patrik.svestka@… Owned by:
Priority: major Milestone:
Component: default Keywords:
Cc: Also affects CVS HEAD (eXept version): no

Description

When loading tests e.g. textView contents:'This text is to continue '. The ListView used always changes the String in the StringCollection to contain CR character at the String's end.

Attachments (1)

libwidg_fix_1_of_1_rev_dbfcd6a6cf68_Issue__162__ListView__contents_returns_CR_in_a_String_by_default.patch (12.8 KB ) - added by patrik.svestka@… 7 years ago.
Fixing the CR at the EditTextView

Download all attachments as: .zip

Change History (7)

comment:1 by patrik.svestka@…, 7 years ago

This should fix the need to use the ( ..., Character CR) when testing EditTextView. All what is needed is to tell the EditTextView that you don't want to use lineEndCR - textView lineEndCR: false.

If you want to use the CR during the tests you can switch it back on with textView lineEndCR: true.

The tests have been adjusted to fit the new reality.

comment:2 by patrik.svestka@…, 7 years ago

Status: newtesting

comment:3 by jan vrany, 7 years ago

Status: testingneeds_work

After applying the patch, following test fails:

test_02
    textView contents: 'Hello,


here is Smalltalk X'.
    self assert: textView contents = ('Hello,


here is Smalltalk X')      

Note the newlines in string literal.

Looking at the patch, this is not surprising - you simply pass nil as a line end to asStringWith:from:to:compressTabs:final: which effectively discards all new lines.

The question is what's the problem you're trying to solve.

The St/X editor automatically adds a newline after last line, hence the ...' , Character cr) in tests. That's fine - most editors have a setting to do (or not) so. If it really bother you, then you need to change only last parameter to asStringWith:from:to:compressTabs:final: to either line end sequence (if you want to add new line at the end of last line) or nil (if you do not).

That being said, the (new) instvar name lineEndCR is cimpletely misleading, it should be something like addNewLineAfterLastLine. Accessor should have proper comment what's an effect of having there true and false (false would - I guess - mean to strip the last line end). This is easy (and fine with me).

One may want to have tree-value setting - add newline, keep as it is and strip newline - this would be lot more tricky to achieve.

That being said, this patch have to be reworked. Please also edit the ticket summary and description to clearly state what's the problem (would be easier to search year later)

comment:4 by patrik.svestka@…, 7 years ago

Status: needs_worktesting

comment:5 by patrik.svestka@…, 7 years ago

Status: testingneeds_work

comment:6 by patrik.svestka@…, 7 years ago

Resolution: invalid
Status: needs_workclosed
Note: See TracTickets for help on using tickets.