aboutsummaryrefslogtreecommitdiff
path: root/module-test
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-21 10:54:49 +0000
committer_ov4 <ov4@ov4.org>2026-09-21 10:54:49 +0000
commit83fa0a85281118103b4f8bf82dcb25cacb42d982 (patch)
treeda185721a7332471d6b1da593b60a5cf794d28f0 /module-test
parentb63192d96dc57ab284d4238d114bdd935686dd70 (diff)
add raw mode
Diffstat (limited to 'module-test')
-rw-r--r--module-test/line_test.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/module-test/line_test.cc b/module-test/line_test.cc
new file mode 100644
index 0000000..7bc16df
--- /dev/null
+++ b/module-test/line_test.cc
@@ -0,0 +1,33 @@
+/*
+ * test line editor
+ $ g++ \
+ module-test/line_test.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
+ *
+ */
+
+
+#include <iostream>
+#include <print>
+
+#include "line/mode.h"
+
+using namespace std;
+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);
+ }
+ return 0;
+}