-
Notifications
You must be signed in to change notification settings - Fork 107
New Feature: Compute the cursor position #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few code style suggestions to comply with our code style guidelines
This will break when #131 is fixed. Instead of enumerating the entire string, could we use |
Ok, so I guess that I have to wait until the new render method is implemented. I will definitely think about how I can get the Should I discard this PR? |
No, don't discard it it can stay open |
Now that the viewport issue is fixed, it looks like there’s a better way to get the number of lines at the beginning of the visible area. Let me know if you’re still willing to work on this, and thank you for being so patient while we got everything else finished. |
Not a problem, I was occupied with exams anyways so I did not do too much there. I will work on this in the coming days. |
@thecoolwinter So I just reimplemented Screen.Recording.2023-02-19.at.22.04.48.movI will see what I can do about it, but I am a bit clueless right now. |
Oh that's a weird problem. Good catch though. I'll do some investigating too. Also, great work the changes look good! |
@thecoolwinter I have found a workaround for the last line. I had to add a bit more code to get it to work and swiftlint is giving me function_boy_length errors now. Should I ignore it or move the cursor-specific code to a separate new folder? |
What is the status of this? It has been open for over a month now and I want to make sure we aren't blocked. |
It is working as expected. I just need to know, whether I should allocate all the cursor logic to a separate file/folder since I am getting SwiftLint function_boy_length errors now. |
So sorry I missed the comments on this. You’ll have to move it to a new file. You can make a |
No Problem, I will do it shortly. |
…ged cursor position to binding
Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
Co-authored-by: Lukas Pistrol <l.pistrol@gmail.com>
…tLayoutManager guard
…tviewController+Cursor
@thecoolwinter Alright, I moved it over. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for all the work on this!
Just waiting for @lukepistrol to review b/c I can't merge the branch until all requested changes are resolved. |
In essence, the line is calculated by dividing the y-position of the text segment with the cursor by the line height:
However, this counts the preceding line wraps as lines too. As a result, I have to count the preceding line wraps with:
Unfortunately, this does scale with the line count of the file. So we might want to change that if we can come up with a better alternative in the future. As a first implementation, I think it works.