Hard to explain: Cursor remembers placement?

2. Help
2007-01-13
2013-03-25
  • Hello,

      I have done as much searching as I can on this, but it is so hard to describe that I am not sure what to search for.

      I am brand new to Notepad++ and have really taken a shine to it. Since switching from TextPad after 3+ years, , I have found more modern features such as code-folding, auto-complete braces, etc. are invaluable. However, the one thing that TextPad does that I haven't found in any other text editor, is a certain cursor behavior.

      Say I have a number of lines that need a minor edit, for instance commenting out some php code. After adding a couple of forward slashes to comment the first line, then pressing the down arrow, the cursor lines up back at the beginning of the next line. Then I only have to add a couple more forward slashes to comment out the second line. Ditto for the next line, etc.

      Notepad++ and other editors will behave the same for the first line, but for following lines, the cursor is going to end up 2 characters into the line. So now, I have to press the left arrow twice to get back to the beginning spot.

      A few bits of info about this:

    - Yes, I really am that lazy that two left arrow presses is a problem. OK, not really, but so many years of relying on that feature has encoded it into my brain and I love it.

    - Yes, I know I could use a block comment to comment-out multiple lines, but this was an easy way to describe what I have been having so much trouble with...

    - TextPad doesn't always go back to the beginning of the line. It moves to the place the cursor was prior to the edit. For example, in the middle of a line 10 at character 25 I add another 10 characters, then press the down arrow. I end up at line 11, character 25. Other editors put me at line 11, character 35.

      Is this an option that can be turned on or in some way emulated? Man, will I feel silly if it's already there and I couldn't find it because I didn't know what I was looking for...

      Thanks for your time here, and a huge thank you for Notepad++!

     
    • Just curious... do people understand what I am trying to explain?

      I know it may seem a little odd, but now it's the only thing I miss about TextPad. Any help, please?

       
      • I know exactly what you mean about this.  Its been one of my favorite features with TextPad.  I have been trying to figure out how to describe this problem but couldn't find the words to make it descriptive enough.  You did a perfect job of it.

        Now, If there is someone out there ambitious enough to try to figure out how to make the cursor move like TextPad (or the option of, my guess is that some people would not like that type of cursor movement)

        Please take a look at it, anyone, maybe it would be great to have it in the next revision :)

         
    • DV
      DV
      2007-01-19

      It seems there is no such option in Notepad++. It can be implemented inside a plugin, for example, - you need to intercept VK_DOWN, VK_UP, VK_NEXT (Page Down) and VK_PRIOR (Page Up) and place a cursor at the position you want.

       
    • jmg_
      jmg_
      2007-01-22

      I have seen slightly strange cursor movements, and yes, I understand your comments.

      So, I've tried to duplicate this, and uncovered an interesting bug/interaction
      with the language Highlighters! It also depends on white spaces!

      Simplest to paste an example, of simple [insert space, down-arrow] repeat
      Normally, this should give a simple staircase, and in std-text it is, but
      change to C++, and down arrow now ALSO INCs the column counter, but ONLY
      on the space-after C++ comment case ?!.

      // 123456789  << Standard Text Enabled, std staircase
      //1 23456789
      //12 3456789
      //123 456789

      // 123456789 C++ Enabled
      //12 3456789  << oops, notice here cursor jumped one to right
      //123 456789  << but here it is ok
      //1234 56789  << and here it is ok

      So yes, certainly a bug, and probably in the highlighter interaction.
      Confirmed it is also in the VB highlighter, so expect it to be in all.

      Maybe everyone uses the SelectBlock.BlockComment/UnComment option,
      so never sees this quirk ? :)

       
      • MJG
        MJG
        2007-08-29

        That's a font-related quirk.  You can get rid of it by changing the default comment font from Comic Sans MS 8-point to something else.  Even if you just use 10-point here, it works as expected.

        I don't see this quirk in my C++, because my comment font is now the same non-proportional font as the normal text font.  --Joel

         
    • Ah... brilliant! Others understand what I was trying to explain.

      So, if I have this right: unfortunately, there doesn't seem to be the option. But on the bright side as DV__ says , apparently a plugin could be made to add it? Also on the bright side, maybe jmg_ has discovered a bug. If so, maybe when the bug (if it is one) is fixed, 'my' new feature is added with it?

      So now I just have to go learn how to make a plugin. Oh well... I'm always looking for a challenge. Thanks!

       
    • pshute
      pshute
      2007-09-12

      So you just want to add // in front of some lines?

      You could press Home and Down at the same time with your left hand, then // with your right hand. That would get you quickly through the changes.

      You could try the new column mode (alt+c) in v4.2.2, but that would add them to the blank lines too.

      You might be able to create a regex expression to do this with find/replace, then you'd just have to click Find or Repl&FindAgain each time.

       
    • I love this feature of Textpad too. It remembers the column at which you started typing; when you use the arrow keys to move down a line the cursor moves to that column on the next line.

      If more explanation is needed, here's an example inspired by what jmg posted. Start with 12345 on several lines. Then with the cursor after the 1, alternate <Space> and <Down> repeatedly.

      With current NP++ behaviour:
      1 2345
      12 345
      123 45
      1234 5

      Textpad behaviour:
      1 2345
      1 2345
      1 2345
      1 2345

      Hopefully that should be crystal clear for anyone who didn't get it :)

       
  • Longtrail
    Longtrail
    2013-03-25

    Seems a lot of people like it :-) Trying to bring it back in focus!