re-calculate cursor column for all cursors on any insertion
This commit is contained in:
parent
35ff48c38f
commit
a268c673fa
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user