Fix for newlines inserted in the middle of a Carbon memo
Original Reporter info from Mantis: jonas@freepascal.org
-
Reporter name: Jonas Maebe
Original Reporter info from Mantis: jonas@freepascal.org
- Reporter name: Jonas Maebe
Description:
Carbon's classic Mac OS heritage means that it inserts a #13 (closed) character if you press "return" inside a text field.
FPC/Lazarus treat Mac OS X as a unix platform and hence use #10 (closed) as a newline separator.
The result is that
a) if text is assigned to a memo, FPC/Lazarus use #10 (closed) as line separator (Carbon properly interprets the #10 (closed) characters as newline characters)
b) if you press "return" in the middle of a text, Carbon will insert a #13 (closed)
c) if this character is inserted right before an existing #10 (closed) character, the resulting #13 (closed)#10 (closed) will be interpreted by Lazarus later on as a single Dos-style newline, so the inserted newline is lost
I've included a patch that replaces all #13 (closed) characters in the results obtained from Carbon edit controls with #10 (closed) characters.
Steps to reproduce:
- Open the attached project
- Select Memo1 in the inspector, and then edit the "Lines" property
- Place the cursor at the end of the third line (i.e., after "line."
- Press "return" to insert an empty line
- Click the "OK" button
- Open the "Lines" property editor again
You will see in step 6 that the newline you inserted in step 4 has disappeared
Mantis conversion info:
- Mantis ID: 16267
- OS: Mac OS X
- OS Build: 10.5.8
- Build: 23942
- Platform: PowerPC
- Version: 0.9.29 (SVN)
- Fixed in revision: 24618 (#26583a48)
- Monitored by: » jonas@freepascal.org (Jonas Maebe)