diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-21 11:55:10 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-21 11:55:10 +0000 |
| commit | a025219a21254c8970e19a90bf31148d351f6579 (patch) | |
| tree | c5414dd347edcd6f943cee9948b0b890078b1927 /module-test | |
| parent | 83fa0a85281118103b4f8bf82dcb25cacb42d982 (diff) | |
add raw input echo
Diffstat (limited to 'module-test')
| -rw-r--r-- | module-test/line_test.cc | 14 |
1 files changed, 5 insertions, 9 deletions
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 <iostream> #include <print> +#include <unistd.h> #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<unsigned char>(c)); - else - print("entered: {}\r\n", c); - } + string s = readline(); + disable_raw(); + cout << s << endl; return 0; } |
