Menu

Single line comment/uncomment

cchris
2009-06-23
2012-11-13
  • cchris

    cchris - 2009-06-23

    Idea #17 on IdeaTorrent is about single line comment toggle without selecting the line.

    Some macros were proposed on IdeaTorrent. I'll chime in with mine (only one for toggling).

    <Ctrl+D>//in case something is selected, it won't be destroyed
    <Enter> //break line to restore cursor pos later
    <Ctrl+Shift+Backspace>//remove indent
    <Up Arrow>//back to line
    <Shitf+Right Arrow>//select something
    <Ctrl+Q>//toggle comment
    <End>
    <Delete>//join with remainder of line, restoring caret position

    Since the problem appears to be solved, ok to delete idea?

    CChris

     
    • Laci adi

      Laci adi - 2009-07-01

      Hello,

      I've did just that, but it doesn't work.
      It comments a line above my text in a really strange behaviour.
      If I have a line: 1234567890 , the commented result will be // 12//34567890  ?!
      Any ideas why this happens to me?
      I'm using the latest built, 543 unicode.

       
    • Laci adi

      Laci adi - 2009-07-01

      I forgot to mention that it also adds // characters in the line of code I was recording the action.
      If I open a new file and record it there, it adds the // in the first line of code I'm using it on, commenting HALF of the <?php tag. (ex.: <?p//hp ) Upon using the macro for many times, I get (<?p///////////////////////////hp)

       
    • cchris

      cchris - 2009-07-01

      Hmm it seems that Ctrl+Q in a macro does not to what it is supposed to on playback.  At least not always. Did the macros posted on IdeaTorrent do the job correctly?

      I'm starting to wonder if we shuldn't ditch the macro recording facility in Scintilla and design one based only on editor semantics. Recording raw Scintilla messages as it is being done currently raises plenty of issues like this. Not a trivial code upheaval. But it would add macro reliability and more flexibility (like querying parameters, save/restore settings etc).

      CChris

       
      • Laci adi

        Laci adi - 2009-07-01

        I don't know about IdeaTorrent macros, can you please point me there?

        I've tried editing the shortcuts.xml file directly and add Scintilla commands directly there, but it didn't work (maybe because scintilla has many action numbers for the same command: commentline).
        Maybe you can find the right command and post it here?
        It would be a great addition to Notepad++ as I always used 'NUMPAD -' to comment a line in Scite.

        Thx.
        Adi

         
    • cchris

      cchris - 2009-07-02

      I was referring to http://sourceforge.net/apps/ideatorrent/notepad-plus/ideatorrent/idea/17/

      As I mentioned already, you cannot use Ctrl+Q in a macro. The fix would be very beneficial, but heavy in development time. What you see in shortcuts.xml is a sequence of row messages (go to position xyz, insert "abc") with no semantics.

      If you use only a single language, or languages with the same comment marks, you can hardcode it as in the macros on IdeaTorrent.

      CChris

       
MongoDB Logo MongoDB