release 1.14pre1
[descalc.git] / 05_disp_stdout.pm
index 07be1da3ab411396d5bf3e9ceadbaec7573f2fd3..9e0d22d3499fd5b2a285a7b1868adcc8a97aa1e8 100644 (file)
@@ -16,7 +16,6 @@ use Term::ReadKey;
 push @{$hook{init}}, sub {
        ReadMode 3;  # cbreak mode
 
-#      print "\ec";  # reset (clear screen, go home)
 #      print "\e[4mDCT $::VERSION\e[24m ";  # print intro (underlined)
        END {
                ReadMode 0;
@@ -38,6 +37,22 @@ push @{$hook{showstack}}, sub {
        print "\n> ";  # prompt
 }; # showstack
 
+push @{$hook{showmenu}}, sub {
+       my $nr = -1;
+       for (grep exists $menu[0][$_], $menu[0][0]+1..$menu[0][0]+$set{menushow}) {
+               $nr++;
+               next unless defined $menu[0][$_];
+               my $sub = (my $s = $menu[0][$_]) =~ s/>[\w ]+$//;
+               print " $_:$s";
+               print ">" if $sub;  # indicate submenu
+       } # display menu txts
+       print "\n> ";
+}; # showmenu
+
+push @{$hook{showall}}, sub {
+#      print "\ec";  # reset (clear screen, go home)
+}; # showall
+
 push @{$hook{showentry}}, sub {
        print "\e[3G\e[K", $_[0];  # cursor to column #3; erase line
 }; # showentry