Convert paragraph to one line

c edwards
2009-03-31
2012-11-13
  • c edwards
    c edwards
    2009-03-31

    Is this action available either natively or thru a plugin?

     
    • cchris
      cchris
      2009-04-01

      You will understand that this depends on you define a paragraph. I'll assume it is a group of non blank lines followed by a blank line.

      In the Replace dialog, check Regular expression, then
      Search for: ([^\n\r]+)([^p][^p])
      Replace with: \1 (<--extra space must be entered)
      Replace all

      Now you have a sequence of lines with no blank lines, each line representng a paragraph. To insert a blank line between each pair:
      Search for: ([^\n\r]+)([^p][^p])
      Replace with: \1\2\2
      Replace all

      If working on Unix/OldMac files, you have to modify the second group to one class only. The ? operator is not supported.

      Also, you have to add an axtra step to merge consecutive blank lines, if needed. You may get the idea on how to do it from the above.

      Now the bad news: you cannot record this as a N++ macro and replay it properly. However, if you have a keyboard script manager like AutoIt or dm2, and replace all clicks by keyboard accelerators, that should work.

      CChris

       
    • c edwards
      c edwards
      2009-04-03

      Thank you for your help.
      Unfortunately, I need the function to be implemented as a macro.

      Cliff

       
    • cchris
      cchris
      2009-04-05

      Here is the problem:

      Internally, N++ uses the builtin ability of the Scintilla control to record messages sent to it. So, basically, you record and replay Scintila messages. This has been extended to some stuff that is not exactly Scintilla, but could fit anyway.

      Recording and replaying a search action means recording the options, active tab and closing button when the search is launched, and serialising the whole bunch to config.xml. This would be a welcome extension, but isn't exactly trivial.

      This is why I suggested you to use a keyboard macro third pparty replayer instead, using accelerators for everything. Note that this is not failproof, because the three checkboxes on the top left of the Find tab on the search box don't have an accelerator, so they should not be changed as part of the search action. At least I cannot see any for them.

      The same applies to any command that relies on a dialog box or external input source to define the action to be performed. Like changing some sort of preference.

      Don, or anyone familiar with the source, please feel free to correct any inaccuracy or worse in the above.

      CChris