Search code examples
delphicharline-breaks

Word wrap in TMemo at a plus (+) char


In my string i have an plus (+) char.

For example, string is

__VIEWSTATE=/wEPDwULLTIwMTY5NDMyMDAPZBYCZg9kFgICAQ9kFgxmD2QWAmYPFgIeC18hSXRlbUNvdW50AgMWBgIBD2QWAmYPFQEiPG5vYnI+PHNwYW4+0JLRhdC+0LQ8L3NwYW4+PC9ub2JyPmQCAw9kFgJmDxUBTDxub2JyPjxhIGhyZWY9J3NpZ251cC5hc3B4JyB0YXJnZXQ9J19zZWxmJz7QoNC10LPQuNGB0YLRgNCw0YbQuNGPPC9hPjwvbm9icj5kAgUPZBYCZg8VAUk8bm9icj48YSBocmVmPSdhYm91dC5hc3B4JyB0YXJnZXQ9J19zZWxmJz7QmNC90YTQvtGA0LzQsNGG0LjRjzwvYT48L25vYnI+ZAICD2QWBAIBDxYCHwACBRYKZg9kFgJmDxUBHjxsaT48Yj7QmtC

Now i add line to memo1 and get this:

WTF

Delphi inserts new line at random places. I`m try to remove all lines break:

viewstate:=StringReplace(viewstate, #10#13, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #13#10, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #10, ' ', [rfReplaceAll]);
viewstate:=StringReplace(viewstate, #13, ' ', [rfReplaceAll]);

But it`s no result. What is it?

P.S. I`m from Russia, so sorry for bad English.


Solution

  • Delphi isn't adding linebreaks. The memo is adding visual soft-breaks at separator characters (such as +). Set the memo's WordWrap property to false and it should resolve the problem.