diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-03-30 22:42:50 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-31 13:21:46 +0200 |
commit | 6f407fff321652592d4d96cc3c9976ef6ed70e0b (patch) | |
tree | 574b4ca0e0669e9db1b5dbe3f338310d0d82f130 /Shell | |
parent | 5062a7d4cd6293b497db88b685648c52da471221 (diff) | |
download | serenity-6f407fff321652592d4d96cc3c9976ef6ed70e0b.zip |
LibLineEdit + Shell: Handle Termios internally and give a copy if asked
This moves the Termios logic inside LibLineEdit and allows users to
simply forget about the existence of termios if they so choose to :^)
Diffstat (limited to 'Shell')
-rw-r--r-- | Shell/main.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Shell/main.cpp b/Shell/main.cpp index acdf9df612..83f2a997ba 100644 --- a/Shell/main.cpp +++ b/Shell/main.cpp @@ -1031,14 +1031,11 @@ int main(int argc, char** argv) g.uid = getuid(); tcsetpgrp(0, getpgrp()); - tcgetattr(0, &g.default_termios); - g.termios = g.default_termios; - // Because we use our own line discipline which includes echoing, - // we disable ICANON and ECHO. - g.termios.c_lflag &= ~(ECHO | ICANON); - tcsetattr(0, TCSANOW, &g.termios); - - editor.initialize(g.termios); + + editor.initialize(); + g.termios = editor.termios(); + g.default_termios = editor.default_termios(); + editor.on_tab_complete_first_token = [&](const String& token) -> Vector<String> { auto match = binary_search(cached_path.data(), cached_path.size(), token, [](const String& token, const String& program) -> int { return strncmp(token.characters(), program.characters(), token.length()); |