53MKnWboUIKj7JwCqIi4tx changeset

Changeset623034633066 (b)
ParentNone (a)
ab
0+class Term::Curses {
0+    has $.y is rw;
0+    has $.x is rw;
0+
0+    has $!stdscr;
0+
0+    method new(
0+        :$cbreak = True,
0+        :$echo = False,
0+        :$nl = False,
0+        :$intrflush = False,
0+        :$keypad = True,
0+        :$use_default_colors = True,
0+        :$start_color = True
0+    ) {
0+        #setlocale(0, "");
0+
0+        # TODO: use newterm() instead of initscr()?
0+        my $stdscr = initscr();
0+
0+        cbreak() if $cbreak;
0+        noecho() unless $echo;
0+        nonl() unless $nl;
0+        intrflush($stdscr, 0) unless $intrflush;
0+        keypad($stdscr, 1) if $keypad;
0+        if ($start_color and has_colors()) {
0+            use_default_colors() if $use_default_colors;
0+            start_color();
0+        }
0+
0+        self.bless(*, :$stdscr);
0+    }
0+
0+    submethod BUILD(:$!stdscr) {}
...
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
--- Revision None
+++ Revision 623034633066
@@ -0,0 +1,34 @@
+class Term::Curses {
+ has $.y is rw;
+ has $.x is rw;
+
+ has $!stdscr;
+
+ method new(
+ :$cbreak = True,
+ :$echo = False,
+ :$nl = False,
+ :$intrflush = False,
+ :$keypad = True,
+ :$use_default_colors = True,
+ :$start_color = True
+ ) {
+ #setlocale(0, "");
+
+ # TODO: use newterm() instead of initscr()?
+ my $stdscr = initscr();
+
+ cbreak() if $cbreak;
+ noecho() unless $echo;
+ nonl() unless $nl;
+ intrflush($stdscr, 0) unless $intrflush;
+ keypad($stdscr, 1) if $keypad;
+ if ($start_color and has_colors()) {
+ use_default_colors() if $use_default_colors;
+ start_color();
+ }
+
+ self.bless(*, :$stdscr);
+ }
+
+ submethod BUILD(:$!stdscr) {}