mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 11:21:34 +00:00
LibLine: Correctly handle consumed code points in Editor
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
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
Notes:
github-actions[bot]
2025-07-22 16:50:18 +00:00
Author: https://github.com/gmta
Commit: 9bf250c8d1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5563
1 changed files with 2 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue