mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
GTextEditor: Start working on editing, starting with inserting newlines.
This commit is contained in:
parent
b4df33e453
commit
8425ea971a
3 changed files with 36 additions and 11 deletions
14
AK/Vector.h
14
AK/Vector.h
|
@ -159,6 +159,20 @@ public:
|
|||
m_impl->remove(index);
|
||||
}
|
||||
|
||||
void insert(int index, T&& value)
|
||||
{
|
||||
ASSERT(index <= size());
|
||||
if (index == size())
|
||||
return append(move(value));
|
||||
ensure_capacity(size() + 1);
|
||||
++m_impl->m_size;
|
||||
for (int i = size() - 1; i > index; --i) {
|
||||
new (m_impl->slot(i)) T(move(m_impl->at(i - 1)));
|
||||
m_impl->at(i - 1).~T();
|
||||
}
|
||||
new (m_impl->slot(index)) T(move(value));
|
||||
}
|
||||
|
||||
Vector& operator=(const Vector<T>& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue