Word wrap, also, word wrap with indent

Word wrap, also, word wrap with indent

2
NewbieNewbie
2

    Feb 07, 2014#1

    I've just purchased UltraEdit (version 20.00.0.1056) after many years with PFE32 (and VDE before that).

    I'm trying to use word wrap and numbered lists.

    Here's how I've configured word wrap:

    Advanced | Configuration | Editor | Word Wrap/Tab Settings

    Wrap method:

    Default word wrap on for each file - CHECKED

    Wrap after column #, insert CR/LF
    Wrap column #: 70


    Question 1: Automatic word wrap on the paragraph as it is edited

    I type a long line:

    Code: Select all

    Four score and seven years ago our fathers brought on this continent,
    a new nation, conceived in Liberty
    
    It's one sentence, displayed on two lines.

    Then, I insert a word I omitted, "forth", on the first line.

    Code: Select all

    Four score and seven years ago our fathers brought forth on this 
    continent,
    a new nation, conceived in Liberty
    The first line wrapped to two lines, leaving a third line.

    This is a single paragraph. I'd like to have it wrap to column 70 as I edit the text without creating a superfluous third line.

    Can this be done automatically, without needing to press Ctrl+T to reformat the paragraph?


    Question 2: Automatic word wrap of the paragraph after insertion of an indentation

    I'll add a third line.

    Code: Select all

    Four score and seven years ago our fathers brought forth on this
    continent, a new nation, conceived in Liberty, and dedicated to the
    proposition that all men are created equal.
    I'll number the paragraph:

    Code: Select all

    10. Four score and seven years ago our fathers brought forth on this
    continent, a new nation, conceived in Liberty, and dedicated to the
    proposition that all men are created equal.
    I'll try to indent the second and third lines with all the lines wrapped at column number 70.

    It should look like this:

    Code: Select all

    10. Four score and seven years ago our fathers brought forth on this
        continent, a new nation, conceived in Liberty, and dedicated to 
        the proposition that all men are created equal.
    
    If I insert an indent of 4 spaces on the second and third lines (select the two lines | Format | Add Indents | 4), the lines are not wrapped to column 70 after the indent is added:

    Code: Select all

    10. Four score and seven years ago our fathers brought forth on this
        continent, a new nation, conceived in Liberty, and dedicated to the 
        proposition that all men are created equal.
    
    How can I produce a numbered list with indentation and respect the wrap at column 70? (Is indentation the wrong way to do this?)

    TIA.

    regards, AndyA

    6,602548
    Grand MasterGrand Master
    6,602548

      Feb 08, 2014#2

      The word wrap feature of UltraEdit works strictly based on lines and not on paragraphs like a word processing application.

      With the setting to really insert CR/LF into the file when a line becomes too long, the result is what you see as the word wrap feature never removes CR/LF as UltraEdit cannot determine if the CR/LF is on intention within the paragraph or just inserted to avoid a too long line.

      So it is necessary to execute the command Format - Reformat Paragraph to remove all line terminators within a paragraph and then insert again CR/LF according to the paragraph settings.

      I think, most users of UltraEdit using word wrap use one of the 2 soft wrap features and not the hard wrap feature with inserting CR/LF. If you are often editing text files like you have described, it might be better to execute once after loading a file the command Format - Convert CR/LFs to Wrap, edit the file with soft wrap at column 70, and use before final save of the file the command Format - Wrap to CR/LFs.

      The command Format - Reformat Paragraph can be also used to create a hanging indent for a paragraph with a number. You need to set at Format - Paragraph Formatting - Paragraph Setup/Formatting first the hanging indent before execute the reformat of either the current paragraph only or all paragraphs currently selected.

      If the configuration settings Auto indent new lines and Auto indent wrapped lines are enabled at Advanced - Configuration - Editor Display - Formatting, the hanging indent will be automatically kept on appending more text to the paragraph. You may also enable Reformat paragraph after paste when wrap settings set to add hard returns at specific column number in the same configuration dialog.

      Hm, for your kind of using word wrap feature it would be good if there would be one more formatting option which when enabled results in reformatting the entire paragraph not only on paste, but also on inserting CR/LF anywhere in the middle of the paragraph caused by inserting more characters within the paragraph. You may send such a feature request to IDM support.

      At the moment I can only suggest to assign a quickly to hit hotkey to the command for reformatting a paragraph to be able to quickly reformat the current paragraph if lines start looking as you described in your first example.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Feb 09, 2014#3

        Mofi,

        Thanks very much for your instructive reply. I'll try to modify my text entry habits to conform to UltraEdit's function.

        I'd like to assign a toolbar button to enable/disable the hanging indent in Format | Paragraph Formatting... | Paragraph Setup/Formatting... | Hanging indent

        The button would not change the length of the indent, just toggle it on and off.

        How would I go about this? I tried creating a macro, but the menu commands weren't recorded.

        I'd appreciate any suggestion you might have.

        regards, AndyA

        6,602548
        Grand MasterGrand Master
        6,602548

          Feb 09, 2014#4

          All commands opening a dialog for configuring something are not available as macro or script command, nor is there any access to configuration settings via macro or script. Therefore it is not possible to reconfigure the paragraph settings with a macro or script. UltraEdit macros/scripts are designed for reformatting content of a file and not for changing behavior of UltraEdit itself.

          Perhaps it would be better for you to write an UltraEdit script which reformats either the current paragraph (on nothing selected) or all selected paragraphs with your preferred paragraph settings and being additionally smart enough to auto-detect if a hanging indent is useful for each paragraph to reformat because of the paragraph is starting with a number.

          I think, it is not really difficult to code such an UltraEdit script for users familiar with writing JavaScript. The script is added next to the list of UltraEdit scripts with a hotkey assignment for fast execution.
          Best regards from an UC/UE/UES for Windows user from Austria