-
Notifications
You must be signed in to change notification settings - Fork 270
<C-n> flip fix #1082
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
base: master
Are you sure you want to change the base?
<C-n> flip fix #1082
Conversation
4cb51ef to
1c2128c
Compare
|
Why did you change PS: 3 newlines snuck in at the end of main.c. |
1c2128c to
fc76731
Compare
|
Thanks - I've addressed the newlines. I had to introduce I believe the distinction is useful since a range's beginning must come before its end. |
|
That part seems fine. I'm talking about all of the changes in the commit: |
|
You're probably right. It may be more confusing than before. |
diff --git a/main.c b/main.c
index 858af23..266d70c 100644
--- a/main.c
+++ b/main.c
@@ -1394,25 +1394,37 @@ static const char *selections_match_next(Vis *vis, const char *keys, const Arg *
if (!buf)
return keys;
+ bool flip;
bool match_all = arg->b;
Filerange primary = sel;
+ Selection *new_sel;
for (;;) {
+ flip = view_cursor_get(view) == primary.start;
sel = find_next(txt, sel.end, buf);
if (!text_range_valid(&sel))
break;
- if (selection_new(view, &sel, !match_all) && !match_all)
- goto out;
+ if (new_sel = selection_new(view, &sel, !match_all) {
+ if (flip)
+ view_selections_flip(new_sel);
+ if (!match_all)
+ goto out;
+ }
}
sel = primary;
for (;;) {
+ flip = view_cursor_get(view) == primary.start;
sel = find_prev(txt, sel.start, buf);
if (!text_range_valid(&sel))
break;
- if (selection_new(view, &sel, !match_all) && !match_all)
- break;
+ if (new_sel = selection_new(view, &sel, !match_all) {
+ if (flip)
+ view_selections_flip(new_sel);
+ if (!match_all)
+ break;
+ }
}
out:I'm considering applying it like this. It all seems correct to me, but indeed, it might not be helpful. Perhaps ctrl-n should simply change the current selection to be not flipped before doing anything? |
|
There's a coherence issue with
|
|
@jeremybobbin Is this still alive? Could we get rebase here for the current master, please? Thank you |
fc76731 to
b106b2f
Compare
roughly:
x/^static.*\)\s+\{$/ {
.,/^\}$/ g/Filerange sel/ {
x/\b(new)?sel\b/ x/sel/c/range/
}
}
raised in issue 1022: martanne#1022
b106b2f to
67cf6c4
Compare
|
@rnpnr ??? What is going on here? |
|
I don't think the issues mentioned above were ever resolved. |
|
The original issue was resolved.
|
|
@jeremybobbin So, this PR could be closed? |
Fixes: #1022
Unfortunately I had to change
Filerange seltoFilerange rangeinselections_match_nextfor clarity.This seemed to be a theme used in a number of other functions.
Also, though the behavior in this patch seems more correct,
I struggle to imagine a case wherein this fix is useful.