parent
bbceae97a2
commit
52d3b60aaa
|
@ -337,6 +337,12 @@ Vector<Selection> compute_modified_ranges(Buffer& buffer, size_t timestamp)
|
||||||
return ranges;
|
return ranges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clamp(Selection& sel, const Buffer& buffer)
|
||||||
|
{
|
||||||
|
sel.anchor() = buffer.clamp(sel.anchor());
|
||||||
|
sel.cursor() = buffer.clamp(sel.cursor());
|
||||||
|
}
|
||||||
|
|
||||||
void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buffer, size_t timestamp)
|
void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buffer, size_t timestamp)
|
||||||
{
|
{
|
||||||
if (timestamp == buffer.timestamp())
|
if (timestamp == buffer.timestamp())
|
||||||
|
@ -366,10 +372,8 @@ void update_selections(Vector<Selection>& selections, size_t& main, Buffer& buff
|
||||||
compare_selections));
|
compare_selections));
|
||||||
}
|
}
|
||||||
for (auto& sel : selections)
|
for (auto& sel : selections)
|
||||||
{
|
clamp(sel, buffer);
|
||||||
sel.anchor() = buffer.clamp(sel.anchor());
|
|
||||||
sel.cursor() = buffer.clamp(sel.cursor());
|
|
||||||
}
|
|
||||||
selections.erase(merge_overlapping(selections.begin(), selections.end(),
|
selections.erase(merge_overlapping(selections.begin(), selections.end(),
|
||||||
main, overlaps), selections.end());
|
main, overlaps), selections.end());
|
||||||
}
|
}
|
||||||
|
@ -604,7 +608,11 @@ SelectionList selection_list_from_string(Buffer& buffer, StringView desc)
|
||||||
|
|
||||||
Vector<Selection> sels;
|
Vector<Selection> sels;
|
||||||
for (auto sel_desc : desc | split<StringView>(':'))
|
for (auto sel_desc : desc | split<StringView>(':'))
|
||||||
sels.push_back(selection_from_string(sel_desc));
|
{
|
||||||
|
auto sel = selection_from_string(sel_desc);
|
||||||
|
clamp(sel, buffer);
|
||||||
|
sels.push_back(sel);
|
||||||
|
}
|
||||||
return {buffer, std::move(sels)};
|
return {buffer, std::move(sels)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
:select 100.100,100.200<ret>
|
|
@ -0,0 +1 @@
|
||||||
|
foo
|
|
@ -0,0 +1 @@
|
||||||
|
foo
|
Loading…
Reference in New Issue
Block a user