diff --git a/src/core/Buffer.h b/src/core/Buffer.h index 7fa2e9c..27ca7a6 100644 --- a/src/core/Buffer.h +++ b/src/core/Buffer.h @@ -21,10 +21,6 @@ public: return std::make_shared(&*m_gap_buffer, m_encoding); } auto get_string() { return m_gap_buffer->get_string(); } - void insert(Cursor & insert_cursor, uint32_t code_point) - { - m_gap_buffer->insert(insert_cursor, code_point); - } protected: bool m_eol_at_eof; diff --git a/src/core/GapBuffer.cc b/src/core/GapBuffer.cc index c560788..8dd2d4e 100644 --- a/src/core/GapBuffer.cc +++ b/src/core/GapBuffer.cc @@ -1,7 +1,6 @@ #include "GapBuffer.h" #include "System.h" #include -#include "Cursor.h" GapBuffer::GapBuffer(Encoding::Type encoding) { @@ -40,12 +39,11 @@ void GapBuffer::compact() /** * Insert code_point into the gap buffer at position position. * - * @param insert_cursor Cursor in the gap buffer to insert the code point at. + * @param position Position in the gap buffer to insert the code point at. * @param code_point The code point to insert. */ -void GapBuffer::insert(Cursor & insert_cursor, uint32_t code_point) +void GapBuffer::insert(size_t position, uint32_t code_point) { - size_t position = insert_cursor.iterator().offset(); check_grow(); move_gap(position); size_t size = Encoding::encode(code_point, m_encoding, &m_buffer[m_gap_position]); diff --git a/src/core/GapBuffer.h b/src/core/GapBuffer.h index 53dd372..a61278b 100644 --- a/src/core/GapBuffer.h +++ b/src/core/GapBuffer.h @@ -8,8 +8,6 @@ #include #include -class Cursor; - class GapBuffer { public: @@ -33,7 +31,7 @@ public: } size_t gap_size() const { return m_buffer_size - m_size; } void compact(); - void insert(Cursor & insert_cursor, uint32_t code_point); + void insert(size_t position, uint32_t code_point); std::string get_string(); Encoding::Type encoding() { return m_encoding; }