Community
    • Login

    How to get column & row numbers at cursor location ?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    6 Posts 3 Posters 4.5k Views 2 Watching
    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 Marlin1 Offline
      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
      • dailD Offline
        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 Marlin1 Offline
          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
          • chcgC Offline
            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 Marlin1 Offline
              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
              • chcgC Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors