1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 06:35:06 +00:00

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 :^)
This commit is contained in:
AnotherTest 2020-03-30 22:42:50 +04:30 committed by Andreas Kling
parent 5062a7d4cd
commit 6f407fff32
3 changed files with 19 additions and 19 deletions

View file

@ -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());