copy/paste and newlines

copy/paste and newlines

7
NewbieNewbie
7

    Feb 02, 2005#1

    I normally work on files in Unix file type. When I copy text (into the clipboard), it doesn't have CR/LF. This works fine if I'm pasting into an UltraEdit file.

    I have problems, though, when I try to paste into some other Windows applications (like Notepad and CRT).

    The problem is that my newline characters aren't interpreted as newlines...a multi-line copy ends up as a single line.

    My only workaround seems to be to go through Wordpad (!)...if I paste my UltraEdit clipboard into a Wordpad document, and then copy the text in Wordpad, it pastes into the "troublesome" applications correctly.

    I've searched high and low in the configuration options and haven't seen anything obvious there...

    Is there a way to get the contents on the clipboard buffer to have CR/LF?

    Thanks,
    :-Phil

    6,676585
    Grand MasterGrand Master
    6,676585

      Feb 03, 2005#2

      You should enable

      Automatically convert to DOS format

      and

      Save file as input format (UNIX/MAC/DOS)

      in the general configuration dialog. Then UltraEdit opens the unix file convert all LF for editing to CR LF, but still saves the file with only LF. The copied text to clipboard in this mode is MS-DOS, so no problems should exist anymore with other applications.
      Best regards from an UC/UE/UES for Windows user from Austria

      7
      NewbieNewbie
      7

        Feb 03, 2005#3

        Yep, that did the trick...it wasn't clear that the "automatically convert to DOS format" applies to Loading the file but not Saving the file. The other option that I have set (since I create a lot of Unix files on my PC) is to default filetype to Unix.

        I love this tool...

        Thanks for the help!

          Feb 10, 2005#4

          Actually, this doesn't quite work as expected. I have the setting "Unix/Mac file detection/conversion" set to "Automatically convert to DOS format", and also "Save file as input format (UNIX/MAC/DOS)" set to "on". This works great for my copy/paste problems.

          However, methinks a bug lurks.

          When I load a Unix file, the file mode (on the bottom status bar) says "Unix". I then save the file and close it. When I reopen the file, it is now in "DOS" format.

          The help for "Save file as input format" indicates the following:
          This option instructs UltraEdit to automatically save the file as the original format (UNIX/MAC) when saved unless it was manually converted after opening.
          Except that I did not manually convert the file...it was automatically converted, and the file mode when I saved it was Unix. However, it seems the CR/LF have also been saved with the file.

          Is this in fact a bug? I've upgraded to v11.00, though the same behaviour was in v10.20.

          Thanks,
          :-Phil

          6,676585
          Grand MasterGrand Master
          6,676585

            Feb 10, 2005#5

            Are the files really stored as DOS? If so, it is a bug. I still use v10.10c and edit all my html unix files with auto-conversation to DOS for editing and they are all still saved in unix format. Check following settings in the INI file:

            [Settings]
            Auto Convert Unix=1
            Auto Detect Unix=1
            Save File Format as Input=1

            Of course I have also set Default File Type=1 for new files as unix files, but this should have no influence. I tried opening, editing, saving, closing and re-opening a unix file without this setting and it also works as we both expect it. Maybe it is really a bug of the newer versions of UE.
            Best regards from an UC/UE/UES for Windows user from Austria

            7
            NewbieNewbie
            7

              Feb 11, 2005#6

              Got it...modified the .ini file directly with your above settings and no joy. The Configuration menu seems to differ from the .ini file; "Automatically convert to DOS format" was not enabled after modifying the .ini. Nor did copy/paste work.

              I wonder if 11.00 deprecated the .ini file? At any rate:

              Copy/paste only seems to work when I have the "Automatically convert to DOS format" enabled from the config. But when I save the file it ends up in DOS format, even though I have it set to "Save file as input format".

              I think I'll have a wander over to the bug forum now...

              Thanks,
              :-Phil

              3

                Sep 13, 2007#7

                I am having a problem with a copy (from Windows Live email) and paste (to UE) is losing the linefeed character. The same paste into Word will retain the linefeed. I can then copy (from Word) and paste (to UE) and the linefeed character is converted to CR\LF.

                UE version 13.10a+2.
                File format is DOS.
                Config: Conversions: On paste convert line endings to destination type is checked.

                6,676585
                Grand MasterGrand Master
                6,676585

                  Sep 14, 2007#8

                  I suggest following to find out what could be the problem.

                  Open in UltraEdit a new file, enter a space and use Edit - HEX Functions - Hex Edit to switch to hex editing mode.

                  Now copy in Windows Live a few lines of text to the clipboard. That lines should not contain any confidential text.

                  Back in UltraEdit paste the text into the temp file in hex edit mode.

                  Now use Edit - Select All and then Edit - HEX Functions - Hex Copy Select View.

                  Paste the clipboard content into a new post enclosed in the BBCode tags and I will look into it.

                  I'm mainly interested in the carriage returns (hex code 0D) and line-feeds (hex code 0A) and if the clipboard content was encoded in Unicode (lots of hex 00).
                  Best regards from an UC/UE/UES for Windows user from Austria

                  3

                    Sep 16, 2007#9

                    Here is a sample cut & paste:

                    Code: Select all

                    00000000h: 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D ; ----------------
                    00000010h: 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D ; ----------------
                    00000020h: 2D 2D 20 54 6F 64 61 79 27 73 20 45 6D 70 6F 77 ; -- Today's Empow
                    00000030h: 65 72 69 6E 67 20 51 75 65 73 74 69 6F 6E 2D 2D ; ering Question--
                    00000040h: 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D ; ----------------
                    00000050h: 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D ; ----------------
                    00000060h: 20 22 57 68 61 74 20 62 65 61 75 74 79 20 63 61 ;  "What beauty ca
                    00000070h: 6E 20 49 20 6E 6F 74 69 63 65 20 74 6F 64 61 79 ; n I notice today
                    00000080h: 2C 20 73 6F 6D 65 74 68 69 6E 67 20 49 20 6E 65 ; , something I ne
                    00000090h: 76 65 72 20 6E 6F 74 69 63 65 64 62 65 66 6F 72 ; ver noticedbefor
                    000000a0h: 65 3F 22 20                                     ; e?" 
                    And now a cut& paste of the text.
                    ---------------------------------- Today's Empowering Question---------------------------------- "What beauty can I notice today, something I never noticedbefore?"

                    Alright! The text didn't paste correctly here either.
                    Hmmmm......

                    Dropped it into Wordpad. Looks fine - cut&paste from Wordpad to here:
                    ----------------------------------
                    Today's Empowering Question
                    ----------------------------------

                    "What beauty can I notice today, something I never noticed
                    before?"


                    Okay, I am confused. (Like that's hard to do.)

                    6,676585
                    Grand MasterGrand Master
                    6,676585

                      Sep 17, 2007#10

                      As you can see on the hex code there is no 0D (CR) and no 0A (LF) in this ASCII text. This is just a long string without any line termination. I guess, Wordpad and MS Word are simply wrapping this very long at a specified number of characters or the text is copied as RTF (Rich Text Format) with hidden soft wrap tags which are then converted to real hard returns (line terminations) and next copy to clipboard.

                      You can verify the RTF speculation by using Edit - Paste Special - Raw RTF. This feature introduced with v13.10 is only available, when the text in the clipboard is in RTF.

                      Otherwise you need to insert the hard returns manually for example with Format - Reformat Paragraph after setting the options at Format - Paragraph Formatting - Paragraph Setup/Formatting.

                      Maybe Windows Live email has also a setting in which format a text is copied into the clipboard.
                      Best regards from an UC/UE/UES for Windows user from Austria

                      3

                        Sep 17, 2007#11

                        You got it! It is RTF (Rich Text Format)!

                        I tried the two Paste Special options (RTF & HTML) and that created the following lines:

                        Code: Select all

                        {\rtf1\ansi\ansicpg-1\deff0\deflang1033{\fonttbl{\f0\froman\fcharset0 Times New Roman;}{\f1\ftech\fcharset0 Symbol;}{\f2\fswiss\fcharset0 Arial;}{\f3\fswiss\fcharset0 Courier New;}{\f4\ftech\fcharset0 Wingdings;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\s1\sa100\sb100 Normal;}{\s2\sbasedon1\snext3 Definition Term;}{\s3\sbasedon1\li360\snext2 Definition List;}{\*\cs4\i1\additive Definition;}{\s5\sbasedon1\sa100\sb100\b1\fs48\kerning36\keepn\snext1\outlinelevel1 H1;}{\s6\sbasedon1\sa100\sb100\fs36\b1\keepn\snext1\outlinelevel2 H2;}{\s7\sbasedon1\sa100\sb100\fs28\b1\keepn\snext1\outlinelevel3 H3;}{\s8\sbasedon1\sa100\sb100\b1\fs24\keepn\snext1\outlinelevel4 H4;}{\s9\sbasedon1\sa100\sb100\fs20\b1\keepn\snext1\outlinelevel5 H5;}{\s10\sbasedon1\sa100\sb100\fs16\b1\keepn\snext1\outlinelevel6 H6;}{\s11\sbasedon1\i1\snext1 Address;}{\s12\sbasedon1\sa100\sb100\li360\ri360 Blockquote;}{\*\cs13\i1\additive CITE;}{\*\cs14\f3\fs20\additive CODE;}{\*\cs15\i1\ulnone\additive Emphasis;}{\*\cs16\cf1\ul\additive Hyperlink;}{\*\cs17\cf11\ul\additive FollowedHyperlink;}{\*\cs18\f3\b1\fs20\additive Keyboard;}{\s19\sbasedon1\f3\sa0\sb0\fs20\tx0\tx959\tx1918\tx2877\tx3836\tx4795\tx5754\tx6713\tx7672\tx8631\tx9590 Preformatted;}{\s20\f2\snext1\shidden\qc\fs16\v1\brdrt\brdrdb\brdrw6\brdrcf0 z-Bottom of Form;}{\s21\f2\snext1\shidden\qc\v1\fs16\brdrb\brdrdb\brdrw6\brdrcf0 z-Top of Form;}{\*\cs22\f3\additive Sample;}{\*\cs23\b1\additive Strong;}{\*\cs24\f3\fs20\additive Typewriter;}{\*\cs25\i1\additive Variable;}{\*\cs26\v1\cf5\additive HTML Markup;}{\*\cs27\v1\additive Comment;}}{\*\listtable{\list{\listname ;}\listid1{\listlevel\levelstartat1\leveljc0\levelnfc0\li720\fi-360{\leveltext\'02\'00.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li1440\fi-360{\leveltext\'02\'01.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li2160\fi-360{\leveltext\'02\'02.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li2880\fi-360{\leveltext\'02\'03.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li3600\fi-360{\leveltext\'02\'04.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li4320\fi-360{\leveltext\'02\'05.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li5040\fi-360{\leveltext\'02\'06.;}{\levelnumbers\'01;}}{\listlevel\levelstartat1\leveljc0\levelnfc0\li5760\fi-360{\leveltext\'02\'07.;}{\levelnumbers\'01;}}}}{\*\listoverridetable}{\info}{\*\userprops{{\propname HTML}\proptype11{\staticval 1}}{{\propname DocumentEncoding}\proptype30{\staticval utf-8}}}\margl1440\margr1440\margt1440\margb1440\sl-240\slmult0\deftab720\headery1440\footery1440\fet2\pgwsxn12240\pghsxn15840\viewkind5\ansicpg-1\pgwsxn12240\pghsxn15840\pard\s1\sa100\sb100\marglsxn1440\margrsxn1440\plain\fs24\line ----------------------------------\line Today's Empowering Quote\line ----------------------------------\line\line\par\pard}
                        
                        <BR>----------------------------------<BR> Today's Empowering Quote<BR>----------------------------------<BR> <BR>
                        
                        So, is there a simply one or two click way to "convert" either of these?
                        I guess I could paste special HTML and do a Replace All on the <BR> tags.

                        Thank you very much for your help.

                        6,676585
                        Grand MasterGrand Master
                        6,676585

                          Sep 18, 2007#12

                          In Outlook 2003 it is possible to convert a received RTF/HTML email temporarily to plain text and then copy the text as text. I guess, the same can be done also in Windows Live Mail. Maybe there is also an option to copy a text always in plain text instead of RTF or HTML.

                          However, here is a macro which would convert the RTF or HTML pasted text to plain text in UltraEdit. The macro property Continue if a Find with Replace not found or Continue if search string not found must be checked for this macro.

                          InsertMode
                          ColumnModeOff
                          HexOff
                          Top
                          StartSelect
                          Find MatchCase Select "\line"
                          IfSel
                          Delete
                          EndSelect
                          Bottom
                          Find MatchCase Up Select "\line"
                          IfSel
                          Delete
                          EndIf
                          EndSelect
                          Top
                          Find MatchCase "\line"
                          Replace All "^p"
                          Else
                          EndSelect
                          Bottom
                          StartSelect
                          Find MatchCase Up Select "<BR>"
                          IfSel
                          Delete
                          EndIf
                          EndSelect
                          Top
                          Find MatchCase Select "<BR>"
                          IfSel
                          Delete
                          EndIf
                          EndSelect
                          Find MatchCase "<BR>"
                          Replace All "^p"
                          EndIf

                          That macro works for your example, but it could fail on other because it just deletes everything from top of the file to first "\line" (RTF) or "<BR>" (HTML) and from bottom of the file to last "\line" or "<BR>" and last converts all "\line" or "<BR>" to DOS line terminations. So if the last line of an email has no line termination, too much will be deleted. And format tags inside the mail text are also not removed by this macro.
                          Best regards from an UC/UE/UES for Windows user from Austria