From a025219a21254c8970e19a90bf31148d351f6579 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 21 Sep 2026 11:55:10 +0000 Subject: add raw input echo --- module-test/line_test.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'module-test') diff --git a/module-test/line_test.cc b/module-test/line_test.cc index 7bc16df..d71d088 100644 --- a/module-test/line_test.cc +++ b/module-test/line_test.cc @@ -2,6 +2,7 @@ * test line editor $ g++ \ module-test/line_test.cc \ + src/line/mode.cc \ -std=c++26 -Iinclude -Ithird_party/magic_enum/include \ -O0 -ggdb3 -fno-omit-frame-pointer -fno-inline -D_GLIBCXX_ASSERTIONS \ -o module-test/line_test.out @@ -11,6 +12,7 @@ #include #include +#include #include "line/mode.h" @@ -20,14 +22,8 @@ using namespace ov4; int main() { enable_raw(); - char c; - while (read(STDIN_FILENO, &c, 1) == 1) - { - if (c == 'q') break; - if (iscntrl(c)) - print("control: {}\r\n", static_cast(c)); - else - print("entered: {}\r\n", c); - } + string s = readline(); + disable_raw(); + cout << s << endl; return 0; } -- cgit v1.3.1-4-g156e