1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

GTextEditor: Add very basic automatic indentation.

This is off by default, but enabled by TextEditor. It simply inserts the
same number of leading spaces as the previous line when hitting Enter. :^)
This commit is contained in:
Andreas Kling 2019-04-25 22:56:09 +02:00
parent 8a3d00ac02
commit 71770e000b
5 changed files with 38 additions and 2 deletions

View file

@ -166,4 +166,14 @@ bool String::ends_with(const String& str) const
return !memcmp(characters() + (length() - str.length()), str.characters(), str.length());
}
String String::repeated(char ch, int count)
{
if (!count)
return empty();
char* buffer;
auto impl = StringImpl::create_uninitialized(count, buffer);
memset(buffer, ch, count);
return *impl;
}
}