question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get char at end of line

See original GitHub issue

Hey, 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:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
marijnhcommented, Jul 13, 2016

Yes, that’s why you use coordsChar to get the actual end of the line (see the source for goLineRight). That’d give you the position after ‘cillum’, which is the one you want, if I understand things correctly.

1reaction
marijnhcommented, Jul 13, 2016

editor.getLine(n).length seems to cover this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found