Menu

Column Mode Select replace all in selection

Dunks
2009-04-22
2012-11-13
  • Dunks

    Dunks - 2009-04-22

    Is there any way to:

    Column Mode Select then replace all in selection?

    Maybe there is a plugin I have tried searching but I cant find anything.

     
    • Bill Wire

      Bill Wire - 2009-04-22

      1. Hold down your Alt key, click and drag to create a "column mode selection"

      2. Replace - fill in your search and replace, check to box that says "In Selection"

      3. Click on the replace all button.

      not too difficult.

       
    • Dunks

      Dunks - 2009-04-23

      Only that "in selection" is grayed out when I create a "column mode selection"

       
      • Bill Wire

        Bill Wire - 2009-04-23

        What version are you using?  I've currently go 5.2 and it is not greyed out for me.

        Unfortunately however, I tried it and the in-selection counts all the lines selected as "in the selection" without restricting to just the columns so selected.  Seems like a bug.

         
    • Dunks

      Dunks - 2009-04-23

      I using 5.3.1 its probably grayed out because is not implemented properly yet, anyway thanks for the help.

       
    • mike_hinson

      mike_hinson - 2009-04-27

      Column mode is great but I have these two issues:

      1). in the following text I can't select the column containing word2 all the way down because the last row dosn't have that column yet. I need to be able to select the column to paste into it or use the column edit mode.

      A word1 word2
      B word1 word2
      C word1

      2). in the above example if I want to use colum eidt mode to insert text at the first column position, I cant do it unless I can select a column of zero width, which does not seem to be allowed.

      Is this the right place to report these issues please?
      Thanks.

       
      • Bill Wire

        Bill Wire - 2009-04-27

        Mike:
        The right place?  No.  The post you're replying to is only vaguely related to what you are posting about.  It is however the correct forum to request assistance and I guess it's OK for reporting a suspected bug.

        But to address your post before somebody jumps down your throat about bring up topics that have already been gone over before... (another story)

        The column-mode editing of N++ is rather weak at the moment.  There have been some discussions on improving it in an upcoming version.
        1. Selecting past the end-of-line on the last line in column-mode will be enabled in the future at some point.  As a work-around, you can blank-pad the last line.
        2. A zero-width selection is possible, but not terribly useful, and it is invisible.  If you want to insert text on all lines in column mode, you MUST use the column-editor to do so (Edit->Column Editor).  Text you type in the "text to insert" box will be inserted on all selected lines.

        -Bill Wire

         
    • mike_hinson

      mike_hinson - 2009-04-29

      Thanks Bill,
      First, sorry for posting in the wrong place.
      Sorry for not finding the previous discussion. The search seems very complicated to use & I have not figured out how to get results about N++ yet. sorry.

      The invisible selection of a zero-width colum is hard to use (because you can't see it), but it is very usefull for inserting text in a column. Thanks for letting me know that & also that the "Selecting past the end-of-line" is on the cards for a future version.

      Thanks.

       
    • cchris

      cchris - 2009-04-23

      For me, In Selection is not greyed out even when I have a column selection.

      Using the unicode v5.3.1.

      CChris

       
  • pole bridge

    pole bridge - 2012-05-28

    Replacement in column mode still not available in version 6.1.2. 
    I can click the "In selection" box, but when i then do a column mode select, my check mark in the "In selection" box disappears. 
    I suppose i can get what i want with a normal range of lines selection and a regex with the appropriate number of dots to space over to my start column.
    Eg.
    if i wanted to do a replacement in columns 5-6
    I could select a range of lines, or the whole doc
    Then replace  ^(….)xx  with \1yy
    The ^ says to start at the beginning of each line
    The parens say to remember what's in the parens
    The four dots represent the 4 chars to remember
    The xx is my search pattern in cols 5-6
    I replace with \1, the first four chars in the line, unchanged
    and yy, the replacement i wanted to begine with.

    So  
    abcdxx
    xxyyxx
    xxyyyy
    efghxx
    Becomes
    abcdyy         The x's become y's
    xxyyyy            The x's before col 4 are unchanged.
    xxyyyy
    efghyy

    Textpad, my other editor, will do a replacement in selected columns as we wish NPP would do, without regex's
    Becomes

    Becomes abcdyy

     
  • pole bridge

    pole bridge - 2012-05-28

    And of course a better choice for the selection pattern might be something like

    ^(.{4})xx

    where the ^(.{4}) says match and save the first four columns, then find xx in cols 5-6.

    The use of the counted dots is easier to read than actually typing the dots, especially if there are many.

     
  • Fool4UAnyway

    Fool4UAnyway - 2012-05-28

    If you have the Text FX plugin, you can use the Quick Find/Replace dialog, Ctrl+R.

    You can enter the column range in the #-# edit box.