diff --git a/src/core/PieceTable.cc b/src/core/PieceTable.cc index 8567566..d2fddc9 100644 --- a/src/core/PieceTable.cc +++ b/src/core/PieceTable.cc @@ -497,6 +497,11 @@ void PieceTable::insert_code_point(uint32_t code_point) uint8_t bytes = Encoding::encode(code_point, encoding, &m_append_buffer[m_append_buffer_index]); m_inserting_piece->length += bytes; m_append_buffer_index += bytes; + + for (auto cursor : m_cursors) + { + cursor->calculate_column(); + } } } diff --git a/src/core/PieceTable.h b/src/core/PieceTable.h index 4c847cf..9b4618d 100644 --- a/src/core/PieceTable.h +++ b/src/core/PieceTable.h @@ -135,6 +135,7 @@ public: } void warp_to_inserted_piece(Piece * piece); void warp_to_beginning_of_piece(Piece * piece); + void calculate_column(); protected: bool is_start_of_line(); @@ -142,7 +143,6 @@ public: Piece * prev_line() const; Piece * next_line() const; void init_column(); - void calculate_column(); void forward_to_column(uint32_t c); };