mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibGUI: Prevent selecting empty line in TextEditor on double click (#6537)
This commit is contained in:
parent
4115fcc933
commit
c41c41cc0f
3 changed files with 16 additions and 0 deletions
|
@ -141,6 +141,18 @@ bool TextDocumentLine::ends_in_whitespace() const
|
|||
return isspace(code_points()[length() - 1]);
|
||||
}
|
||||
|
||||
bool TextDocumentLine::can_select() const
|
||||
{
|
||||
if (is_empty())
|
||||
return false;
|
||||
for (size_t i = 0; i < length(); ++i) {
|
||||
auto code_point = code_points()[i];
|
||||
if (code_point != '\n' && code_point != '\r' && code_point != '\f' && code_point != '\v')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t TextDocumentLine::leading_spaces() const
|
||||
{
|
||||
size_t count = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue