Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to get column & row numbers at cursor location ?

    Plugin Development
    3
    6
    3330
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 12 Marlin
      12 Marlin last edited by

      I want to create a plugin (using C# script) to place a string starting from current cursor location to column 90 in the same line. For example, if cursor is located at (row 5, column 10), then the string will be started from (row 5, column 10) to (row 5, column 90).
      In a plugin, is there a way to get the column & row numbers at cursor location ?

      1 Reply Last reply Reply Quote 0
      • dail
        dail last edited by

        I’m not sure how much you know about Scintilla (which is what Notepad++ uses internally) but hit has a decent sized API that you can do anything you need. In your case it sounds like these would be the key ones to get started with:

        • SCI_GETCURRENTPOS
        • SCI_LINEFROMPOSITION
        • SCI_GETCOLUMN

        How these get called is up to how you are doing it in C# exactly. For example if you are using the newest C# plugin template then you’d can use this method for the first one I mentioned above.

        1 Reply Last reply Reply Quote 0
        • 12 Marlin
          12 Marlin last edited by

          Thks for your support & quick response !
          Yes, I’m new to notepad++. Thks for the info, I can create some simple scripts using Automation Plugin (NppScripts) now. Since I’m still using VS2013, the c# plugin template (for VS2015) cannot be used. Anyway, thks for your help !

          1 Reply Last reply Reply Quote 0
          • chcg
            chcg last edited by

            C# plugin template is probably still usable also from vs2013 as typically between vs2015 and vs2013 just the ToolsVersion differs from ToolsVersion=“14.0” -> ToolsVersion=“12.0” and at least the included demo is still a vs2013 project.

            1 Reply Last reply Reply Quote 0
            • 12 Marlin
              12 Marlin last edited by 12 Marlin

              Other than ToolsVersion, the C# plugin template has also used some other vs2015 only syntax, such as “using static” in ScintillaGateway.cs.

              Yesterday, I’ve resolved the problem by installing vs2015 express for desktop.

              1 Reply Last reply Reply Quote 0
              • chcg
                chcg last edited by

                For private use you could also install the Community edition, which has no restrictions (code analyis, addins,… as far as I remember) like the express edition.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright © 2014 NodeBB Forums | Contributors