summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-05-26 15:04:39 +0430
committerAndreas Kling <kling@serenityos.org>2020-05-27 11:13:02 +0200
commit70a213a6ec19aeee99af6a747c5b12890c038690 (patch)
tree586baffec497398f75535d58e1ed206f569370ba /Userland
parent8e6df3949d2e885c1566c7a3f9cf14b38419bcbb (diff)
downloadserenity-70a213a6ec19aeee99af6a747c5b12890c038690.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/js.cpp4
-rw-r--r--Userland/test-crypto.cpp5
2 files changed, 4 insertions, 5 deletions
diff --git a/Userland/js.cpp b/Userland/js.cpp
index 24b8ff8e60..54c3bb20c9 100644
--- a/Userland/js.cpp
+++ b/Userland/js.cpp
@@ -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())
diff --git a/Userland/test-crypto.cpp b/Userland/test-crypto.cpp
index a209f473cd..6c701f7247 100644
--- a/Userland/test-crypto.cpp
+++ b/Userland/test-crypto.cpp
@@ -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;