@@ -5,6 +5,8 @@ program donut
5
5
implicit none (type, external )
6
6
7
7
character , parameter :: ESC = achar (27 )
8
+ character (3 ), parameter :: LF = ESC // " [d" ! < line feed
9
+ character (3 ), parameter :: TL = ESC // " [2J" ! < erase screen and move to top left
8
10
character , parameter :: TAB(0 :11 ) = [" ." , " ," , " -" , " ~" , " :" , " ;" , " =" , " !" , " *" , " #" , " $" , " @" ]
9
11
real (wp), parameter :: PI = 4 * atan (1 .)
10
12
@@ -22,6 +24,8 @@ program donut
22
24
character (:), allocatable :: dumpfn
23
25
logical :: dump
24
26
27
+ print * , ESC // " [?25l" ! < hide cursor
28
+
25
29
Nloop = 300
26
30
dump = .false.
27
31
do ii = 1 , command_argument_count()
@@ -49,7 +53,8 @@ program donut
49
53
50
54
if (dump) open (newunit= u, file= dumpfn, status= ' replace' , action= ' write' )
51
55
52
- write (stdout," (a)" , advance= " no" ) ESC // " [2J" ! < move cursor to top left
56
+ write (stdout," (a)" , advance= " no" ) TL
57
+ ! ! move cursor to top left
53
58
54
59
do ii = 1 ,Nloop
55
60
z= 0
@@ -82,7 +87,7 @@ program donut
82
87
j = j + 0.07
83
88
enddo
84
89
85
- write (stdout, " (a)" , advance= " no" ) ESC // " [d " ! < line feed
90
+ write (stdout, " (a)" , advance= " no" ) LF
86
91
87
92
do k= 0 , rows-2
88
93
print ' (81a)' , screen(k* cols:k* cols+ cols)
@@ -95,4 +100,6 @@ program donut
95
100
96
101
if (dump) close (u)
97
102
103
+ print * , ESC // " [?25h" ! < show cursor
104
+
98
105
end program
0 commit comments