Description: Strings that are longer than around 17k characters will have a new line automatically inserted when pasted when editing in the formula input (with Ctr-Shift-V - unformulated text). This happens each ~16k characters (if you paste a string of ~40k you will get two new lines). This is a problem if you paste - for example - a very long JSON file. Steps to Reproduce: 1. Generate a string of more than 17k (actual limit is a bit below 16385 but did not compute exactly) (example in extra_newline.txt, generated with "head -c 16385 < /dev/zero | tr '\0' 'a' > extra_newline.txt") 2. Click on empty cell, click on the formula input (or press F2), press Ctrl-Shift-V, select "Unformatted text"). Press Enter or click somewhere else. (result in extra_newline.ods) 3. Copy value in cell and paste in a text editor (or check content.xml in the ods) Actual Results: The string had a new line (and a character transformed to caps). Expected Results: The string is the same as the pasted string. Reproducible: Always User Profile Reset: No Additional Info: Keep the string as it is. Note: if you paste without going to the formula input (so, just click on cell and Ctrl-Shift-V) the cell will be displayed with the extra newline, but when copied back will be correct. If I check the actual file saved on disk it will contain the correct value (without the newline). This suggests that there is somewhere in the code a transformation that happens for both display (probably not that important these cells are not meant to be read) but also, more importantly while pasting when editing - which then is used as the correct value. But if there is no reason to such transformation (adding the newline), probably it should be removed.
Created attachment 193540 [details] Very long string example
Created attachment 193541 [details] Example of bad behavior
Code pointer: ImpEditEngine::ImpInsertText ( https://opengrok.libreoffice.org/xref/core/editeng/source/editeng/impedit2.cxx?r=f61ea135#2731 ).
For clarity, not sure if this should/could be fixed or just the documentation improved or warning added on paste when issues is hit. When trying to figure out if I am doing something wrong I stumbled upon https://wiki.documentfoundation.org/Faq/Calc/022 which does not describe sufficiently the maximum size related issues. Ideally someone understanding the code could update the wiki describing any limitations in a clear language (my current understanding would be "no line can be larger than ~16k and it will be forcefully split if larger"). The most frustrating was that it was really not obvious what was happening (you can for example paste a JSON larger than 16k if it is formatted with new lines and if you do not have any string larger than 16k, because then Calc will just split on the existing newlines).