aboutsummaryrefslogtreecommitdiff
path: root/module-test/line_test.cc
blob: a54085c7656bbd173e54c3c654e6f72c5f191751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

/*
 * test line editor
   $ g++ \
   module-test/line_test.cc \
   src/line/mode.cc \
   src/line/cursor.cc \
   src/line/getter.cc \
   src/history.cc \
   src/path.cc \
   src/util/string.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 <unistd.h>

#include "line/mode.h"
#include "line/cursor.h"
#include "line/getter.h"
#include "line/type.h"
#include "history.h"
#include "path.h"

using namespace std;
using namespace ov4;

int main()
{
    load_history();
    while (true)
    {
        print("shell $ ");
        enable_raw();
        T_position pos = get_cursor_position();
        cursor_row = pos.row;
        cursor_col = pos.col;
        prompt_pos = cursor_col;
        string s = readline();
        disable_raw();
        cout << "\n\n\n\n" << endl;
        cout << s << endl;
        if (s == "quit") break;
    }
    save_history();
    return 0;
}