Userland: Install LibLine's signal handlers in the JS repl

This commit is contained in:
AnotherTest 2020-04-11 13:39:10 +04:30 committed by Andreas Kling
parent f946d6ce79
commit 586aa3b1de
Notes: sideshowbarker 2024-07-19 07:43:04 +09:00

View File

@ -42,6 +42,7 @@
#include <LibJS/Runtime/Shape.h>
#include <LibJS/Runtime/Value.h>
#include <LibLine/Editor.h>
#include <signal.h>
#include <stdio.h>
Vector<String> repl_statements;
@ -396,6 +397,15 @@ int main(int argc, char** argv)
}
editor = make<Line::Editor>();
signal(SIGINT, [](int) {
editor->interrupted();
});
signal(SIGWINCH, [](int) {
editor->resized();
});
editor->initialize();
editor->on_display_refresh = [syntax_highlight](Line::Editor& editor) {
auto stylize = [&](Line::Span span, Line::Style styles) {