-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
50 lines (40 loc) · 1.16 KB
/
main.cc
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
#include "src/editor.cc"
#include "include/raw_mode.h"
// // this is a comment
Editor editor;
// // Changes the state of the terminal its initial state
// void disableRawMode()
// {
// tcsetattr(STDIN_FILENO, TCSAFLUSH, &editor.original_state_);
// system("tput rmcup");
// }
// // Changes the state of the terminal to raw mode
// void enableRawMode()
// {
// tcgetattr(STDIN_FILENO, &editor.original_state_);
// atexit(disableRawMode);
// struct termios raw_state = editor.original_state_;
// raw_state.c_iflag &= ~(IXON | ICRNL | BRKINT | INPCK | ISTRIP);
// raw_state.c_lflag &= ~(ECHO | ICANON | ISIG | IEXTEN);
// raw_state.c_oflag &= ~(OPOST);
// raw_state.c_cflag |= (CS8);
// raw_state.c_cc[VMIN] = 0;
// raw_state.c_cc[VTIME] = 1;
// system("tput smcup");
// tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw_state);
// }
int main(int argc, char *argv[])
{
RawMode raw_mode;
if (argc >= 2)
{
editor.OpenFile(argv[1]);
}
editor.SetStatusMessage("CTRL+Q = quit | CTRL+S = save | CTRL+F = search");
while (1)
{
editor.RefreshScreen();
editor.ProcessKey();
}
return 0;
}