1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:57:45 +00:00

LibLine: Use Core::EventLoop for outer read loop

This commit changes LibLine's internal structure to work in an event
loop, and as a result, also switches it to being a Core::Object.
This commit is contained in:
AnotherTest 2020-05-26 15:04:39 +04:30 committed by Andreas Kling
parent 8e6df3949d
commit 70a213a6ec
7 changed files with 583 additions and 517 deletions

View file

@ -65,7 +65,7 @@ private:
static bool s_dump_ast = false;
static bool s_print_last_result = false;
static OwnPtr<Line::Editor> s_editor;
static RefPtr<Line::Editor> s_editor;
static int s_repl_line_level = 0;
static bool s_fail_repl = false;
@ -510,7 +510,7 @@ int main(int argc, char** argv)
if (test_mode)
enable_test_mode(*interpreter);
s_editor = make<Line::Editor>();
s_editor = Line::Editor::construct();
signal(SIGINT, [](int) {
if (!s_editor->is_editing())

View file

@ -110,10 +110,9 @@ Core::EventLoop loop;
int run(Function<void(const char*, size_t)> fn)
{
if (interactive) {
Line::Editor editor;
editor.initialize();
auto editor = Line::Editor::construct();
for (;;) {
auto line_result = editor.get_line("> ");
auto line_result = editor->get_line("> ");
if (line_result.is_error())
break;