Get char at end of line
See original GitHub issueHey, I am trying to get the start and end of a selection. However if the selection is on multiple lines, I want to only get the start and end of line n
.
However, using editor.charCoords
I would need the ch
value of the end of line n
, using getCursor
I can only (to may knowledge) get the ch
value of the start of the selection and the end. But if the end is line n+X
the ch
value is useless.
Is there any workaround? Any way I can get this value?
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
getchar() function and EOF - Stack Overflow
getchar () returns EOF when you get to the end of the file. It returns \n when you get to the end of...
Read more >How to get First and Last Character of String in Java? charAt ...
As explained in this article, the charAt() method can be used to retrieve an individual character from a given String. You just need...
Read more >How to get the last character of a string in JavaScript?
First count number of characters in a given string by using str.length function. Since the indexing starts from 0 so use str.charAt(str.length-1) ...
Read more >How to Remove the Last Character of a String? - Baeldung
In this quick tutorial, we're going to explore different techniques for removing the last character of a String.
Read more >String.Substring Method (System) - Microsoft Learn
To extract a substring that begins with a particular character or character sequence, call a method such as IndexOf or IndexOf to get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, that’s why you use
coordsChar
to get the actual end of the line (see the source forgoLineRight
). That’d give you the position after ‘cillum’, which is the one you want, if I understand things correctly.editor.getLine(n).length
seems to cover this?