re-calculate cursor column for all cursors on any insertion

This commit is contained in:
josh committed 2016-10-29 15:05:43 -04:00
1 parent 35ff48c38f
commit a268c673fa
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -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();
}
}
}
+1 -1
View File
@@ -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);
};