1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 23:34:12 +03:00

Minor reorganisation in buffer.hh

This commit is contained in:
Maxime Coste 2015-06-25 13:36:23 +01:00
parent 26cfd6af9b
commit cc09c36fe0

View File

@ -171,6 +171,14 @@ private:
void on_option_changed(const Option& option) override; void on_option_changed(const Option& option) override;
ByteCoord do_insert(ByteCoord pos, StringView content);
ByteCoord do_erase(ByteCoord begin, ByteCoord end);
struct Modification;
void apply_modification(const Modification& modification);
void revert_modification(const Modification& modification);
struct LineList : BufferLines struct LineList : BufferLines
{ {
[[gnu::always_inline]] [[gnu::always_inline]]
@ -190,30 +198,23 @@ private:
}; };
LineList m_lines; LineList m_lines;
ByteCoord do_insert(ByteCoord pos, StringView content);
ByteCoord do_erase(ByteCoord begin, ByteCoord end);
String m_name; String m_name;
Flags m_flags; Flags m_flags;
struct Modification;
using UndoGroup = Vector<Modification, MemoryDomain::BufferMeta>; using UndoGroup = Vector<Modification, MemoryDomain::BufferMeta>;
using History = Vector<UndoGroup, MemoryDomain::BufferMeta>;
using History = Vector<UndoGroup, MemoryDomain::BufferMeta>;
History m_history; History m_history;
History::iterator m_history_cursor; History::iterator m_history_cursor;
UndoGroup m_current_undo_group; UndoGroup m_current_undo_group;
void apply_modification(const Modification& modification);
void revert_modification(const Modification& modification);
size_t m_last_save_undo_index; size_t m_last_save_undo_index;
Vector<Change, MemoryDomain::BufferMeta> m_changes; Vector<Change, MemoryDomain::BufferMeta> m_changes;
time_t m_fs_timestamp; time_t m_fs_timestamp;
// Values are just data holding by the buffer, so it is part of its // Values are just data holding by the buffer, they are not part of its
// observable state // observable state
mutable ValueMap m_values; mutable ValueMap m_values;
}; };