Minor formatting fixes (very long lines)
This commit is contained in:
parent
20d20ae1dc
commit
e0424ba017
|
@ -97,7 +97,9 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return WindowAndSelections{ std::unique_ptr<Window>{new Window{buffer}}, DynamicSelectionList{buffer, { Selection{ {}, {} } } } };
|
return WindowAndSelections{ std::unique_ptr<Window>{new Window{buffer}},
|
||||||
|
DynamicSelectionList{buffer,
|
||||||
|
{ Selection{ {}, {} } } } };
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections)
|
void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections)
|
||||||
|
|
|
@ -47,7 +47,10 @@ std::vector<LineModification> LineChangeWatcher::compute_modifications()
|
||||||
}
|
}
|
||||||
next = res.erase(next, delend);
|
next = res.erase(next, delend);
|
||||||
|
|
||||||
const LineCount num_removed_from_added = std::min(num_removed, modif.new_line + modif.num_added - change.pos);
|
const LineCount num_added_after_pos =
|
||||||
|
modif.new_line + modif.num_added - change.pos;
|
||||||
|
const LineCount num_removed_from_added =
|
||||||
|
std::min(num_removed, num_added_after_pos);
|
||||||
modif.num_added -= num_removed_from_added;
|
modif.num_added -= num_removed_from_added;
|
||||||
modif.num_removed += num_removed - num_removed_from_added;
|
modif.num_removed += num_removed - num_removed_from_added;
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,11 @@ void on_buffer_change(const Buffer& buffer, SelectionList& sels,
|
||||||
BufferCoord begin, BufferCoord end, LineCount end_line)
|
BufferCoord begin, BufferCoord end, LineCount end_line)
|
||||||
{
|
{
|
||||||
auto update_beg = std::lower_bound(sels.begin(), sels.end(), begin,
|
auto update_beg = std::lower_bound(sels.begin(), sels.end(), begin,
|
||||||
[](const Selection& s, BufferCoord c) { return std::max(s.anchor(), s.cursor()) < c; });
|
[](const Selection& s, BufferCoord c)
|
||||||
|
{ return s.max() < c; });
|
||||||
auto update_only_line_beg = std::upper_bound(sels.begin(), sels.end(), end_line,
|
auto update_only_line_beg = std::upper_bound(sels.begin(), sels.end(), end_line,
|
||||||
[](LineCount l, const Selection& s) { return l < std::min(s.anchor(), s.cursor()).line; });
|
[](LineCount l, const Selection& s)
|
||||||
|
{ return l < s.min().line; });
|
||||||
|
|
||||||
if (update_beg != update_only_line_beg)
|
if (update_beg != update_only_line_beg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,10 @@ public:
|
||||||
|
|
||||||
memoryview<char> data() const { return memoryview<char>(std::string::data(), size()); }
|
memoryview<char> data() const { return memoryview<char>(std::string::data(), size()); }
|
||||||
|
|
||||||
String substr(ByteCount pos, ByteCount length = -1) const { return String{std::string::substr((int)pos, (int)length)}; }
|
String substr(ByteCount pos, ByteCount length = -1) const
|
||||||
|
{
|
||||||
|
return String{std::string::substr((int)pos, (int)length)};
|
||||||
|
}
|
||||||
String substr(CharCount pos, CharCount length = INT_MAX) const
|
String substr(CharCount pos, CharCount length = INT_MAX) const
|
||||||
{
|
{
|
||||||
auto b = utf8::advance(begin(), end(), (int)pos);
|
auto b = utf8::advance(begin(), end(), (int)pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user