mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
Userland: Install LibLine's signal handlers in the JS repl
This commit is contained in:
parent
f946d6ce79
commit
586aa3b1de
1 changed files with 10 additions and 0 deletions
|
@ -42,6 +42,7 @@
|
||||||
#include <LibJS/Runtime/Shape.h>
|
#include <LibJS/Runtime/Shape.h>
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibLine/Editor.h>
|
#include <LibLine/Editor.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
Vector<String> repl_statements;
|
Vector<String> repl_statements;
|
||||||
|
@ -396,6 +397,15 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
editor = make<Line::Editor>();
|
editor = make<Line::Editor>();
|
||||||
|
|
||||||
|
signal(SIGINT, [](int) {
|
||||||
|
editor->interrupted();
|
||||||
|
});
|
||||||
|
|
||||||
|
signal(SIGWINCH, [](int) {
|
||||||
|
editor->resized();
|
||||||
|
});
|
||||||
|
|
||||||
editor->initialize();
|
editor->initialize();
|
||||||
editor->on_display_refresh = [syntax_highlight](Line::Editor& editor) {
|
editor->on_display_refresh = [syntax_highlight](Line::Editor& editor) {
|
||||||
auto stylize = [&](Line::Span span, Line::Style styles) {
|
auto stylize = [&](Line::Span span, Line::Style styles) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue