mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:27:46 +00:00
GTextEditor: Support splitting lines at the cursor with the Return key.
This commit is contained in:
parent
a64b71fb3d
commit
43d56b6f3a
3 changed files with 30 additions and 6 deletions
20
AK/Vector.h
20
AK/Vector.h
|
@ -252,12 +252,22 @@ public:
|
|||
|
||||
void resize(ssize_t new_size)
|
||||
{
|
||||
ASSERT(new_size >= size());
|
||||
if (!new_size)
|
||||
if (new_size == size())
|
||||
return;
|
||||
ensure_capacity(new_size);
|
||||
for (ssize_t i = size(); i < new_size; ++i)
|
||||
new (m_impl->slot(i)) T;
|
||||
|
||||
if (!new_size) {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_size > size()) {
|
||||
ensure_capacity(new_size);
|
||||
for (ssize_t i = size(); i < new_size; ++i)
|
||||
new (m_impl->slot(i)) T;
|
||||
} else {
|
||||
for (int i = new_size; i < size(); ++i)
|
||||
m_impl->at(i).~T();
|
||||
}
|
||||
m_impl->m_size = new_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue