T17 review fixes: hidden numbers draw, empty edits and read-only commands change nothing, hints stay in a ghost-cut row, the newest cursor leads, a composition undoes in one step, call keys carry their place, references count matches, trailing-space hits and **/ globs, name-only switcher marks, pin and remove stay on their button, settings show their places; decimals moves to typography::format
This commit is contained in:
1 parent
5545ce6458
commit
8ea952c6dc
20 files changed
+383
-85
No files matched your search
+14
-2
@@ -37,9 +37,12 @@ impl Selection {
|
||||
}
|
||||
}
|
||||
|
||||
/// Sorted by where they start, with overlapping selections joined into one.
|
||||
/// Sorted by where they start, overlapping selections joined into one; the last given, the primary, stays last.
|
||||
pub(crate) fn merged(mut all: Vec<Selection>) -> Vec<Selection> {
|
||||
assert!(!all.is_empty(), "an editor keeps at least one cursor");
|
||||
let primary = all
|
||||
.last()
|
||||
.expect("an editor keeps at least one cursor")
|
||||
.range();
|
||||
all.sort_by_key(|selection| selection.range().start);
|
||||
let mut out: Vec<Selection> = Vec::with_capacity(all.len());
|
||||
for next in all {
|
||||
@@ -59,6 +62,15 @@ pub(crate) fn merged(mut all: Vec<Selection>) -> Vec<Selection> {
|
||||
_ => out.push(next),
|
||||
}
|
||||
}
|
||||
let lead = out
|
||||
.iter()
|
||||
.position(|selection| {
|
||||
let range = selection.range();
|
||||
range.start <= primary.start && primary.end <= range.end
|
||||
})
|
||||
.expect("a merge keeps every cursor inside one");
|
||||
let lead = out.remove(lead);
|
||||
out.push(lead);
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user