For removing trailing normal spaces and horizontal tabs from the lines in clipboard before pasting the clipboard content into the file replace in your script file
Code: Select all
UltraEdit.clipboardContent = UltraEdit.clipboardContent.replace(/\r\n|\n\n|\n|\r/g,sLineTerm);
by
Code: Select all
UltraEdit.clipboardContent = UltraEdit.clipboardContent.replace(/[\t ]*(?:\r\n|\n\n|\n|\r)/g,sLineTerm);
It is interesting to read that you need to replace
\n\n in clipboard by just
\n to get the clipboard content copied on a Windows machine via Citrix correct pasted into text file on Mac. This could mean that the software used to copy text in a Windows text file on a Windows machine into Windows clipboard and next transmit the Windows clipboard content to Mac and copy it to clipboard of Mac replaces wrong all
\r by
\n instead of all
\r\n by just
\n. That is simply a wrong DOS/Windows to UNIX (and new MAC) line ending conversion done by this software. In this case the feature controlled in UltraEdit for Windows with configuration setting
On paste convert line endings to destination type (Unix/Mac/DOS) would be of no help on Mac as
\n\n must be interpreted by any text editor on Mac as two line terminations.
The clipboard content is pasted into a file in UltraEdit always without any modification byte-by-byte on pasting the clipboard content in hex edit mode. Please would you open a new file, insert a space, switch to hex edit mode showing now only 20 at top and paste the clipboard content into the file.
Are there really 0A 0A (or UTF-16 encoded 0A 00 0A 00) instead of OD 0A (or UTF-16 encoded 0D 00 0A 00) for each line termination in pasted byte stream?
Please note: You should not have the replace two times in the script. The clipboard content should not be modified on pasting clipboard content into a file opened in hex editing mode as in this case it is possible to paste also binary data into a file. A modification of the clipboard content with the replace function before paste would damage the binary data. It is also not recommended to modify clipboard content on pasting it into a text file with column mode editing currently enabled. This could result on wrong pasting behavior in column mode. The second clipboard content replace outside the IF condition should be removed for these reasons.