How to know cursor position index in an editor
I need to know the index of the cursor.
For example, instead of line 4 column 23, I want to know that I'm at the 256th character in the file.**
Notepad++ already has the feature you are looking for.
- Select all characters from the current cursor position to the start of the file using ctrl+shift+home
Look at the status bar where it says "Sel: characters|rows"
- The first value characters is the number of characters in the selection.
- The second value rows is the number of rows in the selection.
- The selection starts from the beginning of the file and ends where the cursor was previously .
- The value of characters is the "index" of the cursor.
Note that characters includes the end of line characters.
Press Ctrl+G and click the Offset
radio button. Your cursor position will be shown in the You are here:
line
Example: