LibGUI: Select last word when double clicking at the end of a line

Fixes #6565.
This commit is contained in:
Rafał 2021-04-25 19:51:03 +02:00 committed by GitHub
parent c2f936b14c
commit 2d6be48c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-18 19:05:33 +09:00

View file

@ -628,7 +628,11 @@ TextPosition TextDocument::first_word_break_before(const TextPosition& position,
auto target = position;
auto line = this->line(target.line());
auto is_start_alphanumeric = isalnum(line.code_points()[target.column() - (start_at_column_before ? 1 : 0)]);
auto modifier = start_at_column_before ? 1 : 0;
if (target.column() == line.length())
modifier = 1;
auto is_start_alphanumeric = isalnum(line.code_points()[target.column() - modifier]);
while (target.column() > 0) {
auto prev_code_point = line.code_points()[target.column() - 1];