mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibLine: Correctly handle consumed code points in Editor
We should not compare code point offsets to byte offsets, but compare the consumed code points to the input's length expressed in code points instead. Relates to #5547.
This commit is contained in:
parent
526615bc10
commit
9bf250c8d1
|
|
@ -1269,12 +1269,11 @@ ErrorOr<void> Editor::handle_read_event()
|
|||
insert(code_point);
|
||||
}
|
||||
|
||||
if (consumed_code_points == valid_bytes) {
|
||||
if (consumed_code_points == input_view.length()) {
|
||||
m_incomplete_data.clear();
|
||||
} else {
|
||||
auto bytes_to_drop = input_view.byte_offset_of(consumed_code_points + 1);
|
||||
for (size_t i = 0; i < bytes_to_drop; ++i)
|
||||
m_incomplete_data.take_first();
|
||||
m_incomplete_data.remove(0, bytes_to_drop);
|
||||
}
|
||||
|
||||
if (!m_incomplete_data.is_empty() && !m_finish)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user