Tweak Buffer::Change layout

This commit is contained in:
Maxime Coste 2015-01-29 22:44:07 +00:00
parent ffff4711c5
commit 804a050c39
2 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ Buffer::Buffer(String name, Flags flags, BufferLines lines,
}
static_cast<BufferLines&>(m_lines) = std::move(lines);
m_changes.push_back({ Change::Insert, {0,0}, line_count(), true });
m_changes.push_back({ Change::Insert, true, {0,0}, line_count() });
if (flags & Flags::File)
{
@ -158,7 +158,7 @@ struct Buffer::Modification
void Buffer::reload(BufferLines lines, time_t fs_timestamp)
{
m_changes.push_back({ Change::Erase, {0,0}, back_coord(), true });
m_changes.push_back({ Change::Erase, true, {0,0}, back_coord() });
commit_undo_group();
if (not (m_flags & Flags::NoUndo))
@ -185,7 +185,7 @@ void Buffer::reload(BufferLines lines, time_t fs_timestamp)
m_last_save_undo_index = m_history_cursor - m_history.begin();
m_fs_timestamp = fs_timestamp;
m_changes.push_back({ Change::Insert, {0,0}, back_coord(), true });
m_changes.push_back({ Change::Insert, true, {0,0}, back_coord() });
}
void Buffer::commit_undo_group()
@ -313,7 +313,7 @@ ByteCoord Buffer::do_insert(ByteCoord pos, StringView content)
end = ByteCoord{ last_line, m_lines[last_line].length() - suffix.length() };
}
m_changes.push_back({ Change::Insert, begin, end, at_end });
m_changes.push_back({ Change::Insert, at_end, begin, end });
return begin;
}
@ -338,7 +338,7 @@ ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end)
next = is_end(begin) ? end_coord() : ByteCoord{begin.line, 0};
}
m_changes.push_back({ Change::Erase, begin, end, is_end(begin) });
m_changes.push_back({ Change::Erase, is_end(begin), begin, end });
return next;
}

View File

@ -158,11 +158,11 @@ public:
struct Change
{
enum Type { Insert, Erase };
enum Type : char { Insert, Erase };
Type type;
bool at_end;
ByteCoord begin;
ByteCoord end;
bool at_end;
};
ArrayView<Change> changes_since(size_t timestamp) const;