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

AK: Add String::copy(BufferType) helper.

This will create a String from any BufferType that has data() and size().
This commit is contained in:
Andreas Kling 2019-04-20 14:13:40 +02:00
parent 5eedb22834
commit ab94a6be00
11 changed files with 31 additions and 27 deletions

View file

@ -41,7 +41,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Opening %s: %s\n", path.characters(), file.error_string());
return 1;
}
text_editor->set_text(String::from_byte_buffer(file.read_all()));
text_editor->set_text(String::copy(file.read_all()));
}
auto new_action = GAction::create("New document", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [] (const GAction&) {