aboutsummaryrefslogtreecommitdiff
path: root/module-test
diff options
context:
space:
mode:
Diffstat (limited to 'module-test')
-rw-r--r--module-test/line_test.cc14
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;
}