-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Cursor Fix #98
Cursor Fix #98
Conversation
I'm going to look at some easy issues to fix, marking as a draft for now. |
Found a bug in my code, fixing. |
Looks like you also need to run |
I think one of the bounds also needs to be adjusted, if you open a larger file there will be a line number in the status line. |
I found various regressions to the shortcuts as a result of the cursor change, I'll be working on it tomorrow. |
One issue I'm having is |
So this does work already on master, you should be able to go past the last char (technically onto the invisible |
That's interesting... I'll undo those changes then. |
The rest is quite an improvement though :) The off by one line number rendering fix explains why a single line without a trailing |
Ah, I see. Okay, so what's happening is that on the current master branch, it considers |
Amusingly, the fix for the bug was the same as the fix for let transaction =
Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| {
let max_to = doc.text().len_chars(); // This
let to = std::cmp::min(max_to, range.to() + 1); // And this
(range.from(), to, Some(text.clone()))
}); |
I think it works, but I'm not sure if there are remaining bugs. edit:
These are bugs that are also in the master branch, but it might be worth getting this pushed to fix the current panics and then let someone else fix that in a subsequent PR. |
helix-core/src/transaction.rs
Outdated
|
||
use Operation::*; | ||
assert_eq!( | ||
changes.changes, |
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.
You also want to test that len_after is correct
It's looking good, I'll do some testing today and then merge. |
A few issues:
Are you testing this on windows? I think that might explain some of the differences. I don't think we can rely on |
Agreed. Additionally, I'm wondering if there's a better solution to the cursor thing considering how many bugs are popping up as a result of it, and I can only imagine the nightmare that would happen if someone else had to change something and everything breaks. Since everything seems to be because of 1 off & bounding errors, I'll be looking into a better way to do that. Maybe a field or inline function that determines the "real" current character. |
I agree, there should be some sort of safe wrapper to clamp the range. We already achieve that on one end with Might be worth splitting some of the fixes out and getting them merged early, specifically the division by zero bug and possibly the Also, feel free to join us at https://matrix.to/#/#helix-community:matrix.org to discuss (make sure to join |
Unnecessary after 14830e7, though be aware that |
Fixes #58, #61, #73, & #74