forked from haberman/vtparse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathntest.c
More file actions
122 lines (95 loc) · 1.97 KB
/
ntest.c
File metadata and controls
122 lines (95 loc) · 1.97 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// #include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void clear(int what)
{
printf("\033[%dJ", what);
fflush(stdout);
}
void cursor_right(void)
{
printf("\033[C");
fflush(stdout);
}
void move(int y, int x)
{
printf("\033[%d;%dH", y, x);
fflush(stdout);
}
void scroll_down(void)
{
printf("\033D");
fflush(stdout);
}
void scroll_up(void)
{
printf("\033M");
fflush(stdout);
}
void scroll_reg(int start, int stop)
{
printf("\033[%d;%dr", start, stop);
fflush(stdout);
}
int main(void)
{
clear(2);
move(0, 0);
for (int i = 0; i < 100; i++) {
printf("haha ");
}
move(3, 20);
for (int i = 0; i < 1000; i++) {
//cursor_right();
printf("h");
fflush(stdout);
//usleep(1000000);
}
sleep(3);
clear(1);
sleep(3);
clear(2);
move(0, 0);
for (int i = 0; i < 100; i++) {
printf("haha ");
}
move(3, 20);
sleep(3);
clear(0);
sleep(3);
move(26, 1);
printf("Hallo");
move(25, 1);
printf("Hallo-scrollend");
move(1,1);
printf("First line");
move(2,1);
printf("Second Line");
move(6,10);
scroll_reg(2, 25);
move(22,10);
for (int i = 0; i < 100; i++) {
scroll_down();
sleep(1);
}
return 0;
/*
initscr();
refresh();
WINDOW *w = newwin(20, 40, 10, 10);
box(w, 0, 0);
wmove(w, 0, 0);
waddch(w, 'A');
WINDOW *w2 = derwin(w, 18, 38, 1, 1);
wrefresh(w2);
box(w2, 0, 0);
wmove(w2, 0, 0);
waddch(w2, 'B');
touchwin(w);
wrefresh(w);
refresh();
doupdate();
getch();
endwin(); */
}