How to get column & row numbers at cursor location ?



  • 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 ?



  • 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:

    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.



  • 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 !



  • 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.



  • 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.



  • 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.


Log in to reply