-
Notifications
You must be signed in to change notification settings - Fork 261
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
check for EOF before unsetting row, col & line cache in view_coord_get #1087
check for EOF before unsetting row, col & line cache in view_coord_get #1087
Conversation
After the disaster of #1074, it would be probably prudent to explain slightly more why do you think that this PR works better than the other one. |
@mcepl "disaster" ..? Please try to keep a positive language when commenting . There really isn't much development going on here lately, and we don't want to discourage people who actually wants to contribute ! EDIT: i thought you referred to his contribution , but if you rather referred to the buggy code, then my mistake ! |
Personally I do not mind the language. :) If I didn't use structural regular expressions, I'd be using vim or neovim. The change from There is a case, however, where the position can be at the view's end & still be visible, and that's when EOF is in the view. |
True, and I am sorry if I am too direct, but how else should I call a commit which had to be withdrawn? A shining success? And of course it doesn’t mean anything about yourself personally, I do such disasters a dozen weekly. :( And, of course, I appreciate a lot that somebody finally started to look at the C part of vis.
Again, I am not the greatest C programmer myself, but doesn’t |
It doesn't have to be either a "disaster" or a "shining success", just try to be somewhat professional and ask for more information, in a polite way. No reason to address a failed attempt at fixing an issue like a "disaster", it doesn't encourage more attempts at fixing stuff, if we don't get it right the first time. Also please read the Github Community Guidelines if you have not. We want to have a positive community around this project. |
44719d6
to
d1c068b
Compare
Makes sense - from another function in view.c:406: bool eof = view->end == text_size(view->text);
if (view->line->len == 0 && eof && view->line->prev) I've changed the patch to match the above.
In mcepl's defense, #1074 introduced a bug which would be easily noticed by users who are opening a vis buffer for the first time, possibly leaving a bad impression. That aside, these sorts of issues should be covered in the test suite. Writing a test for that now. |
Isn’t this line a perfect candidate for refactoring (that’s why I was talking about macro, or perhaps function)?
Yes, a low coverage of our test suite is much larger problem. I think we should include https://github.com/martanne/vis-test to this repo and start to working more intensly on increasing the coverage, but that is aside of this particular issue. |
I've been using this for a day and it seems correct. It also fixes another unreported issue with the previous commit where starting a visual line selection and moving the cursor to the end of window would make it look like the selection was lost. I'm in favor of merging this rather than reverting the previous commit. |
Oh, I had #1074 already reverted, you mean, it could be kept around with this commit on the top? |
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.
Merged into https://git.sr.ht/~mcepl/vis/tree.
Applied here as well, thanks! |
fixes #1074 & #1084 & #1086
#1074
#1084
#1086