As a suggestion, for the future monks who may read your question, please paste your code into your post (or a comment onto the post), for people to peruse. You may not have that code on your scratch pad forever, and people may be plagued by the same problem in the future. Another good suggestion is to surround it with <code></code> tags (In your case, the code was long and needed to be given <readmore> tags. I've taken the liberty and pasted the code here
# File Viewing Module for hex editor package Hex::FileSelect; use strict; use Win32::Console; use File::Spec; use Cwd; sub new { my $class = shift; my $self = { Title => 'Select File', #TitleBar text Start => getcwd(), #Start Dir CurDir => '', #Current Dir Dir => [], #Dir Contents Offset => 0, #Filelist display offset Highlighted => 0, #Highlighted file offset Console => new Win32::Console(), }; bless($self, $class); return $self; } # Returns a string representing the path to the chosen file. sub Run { my $self = shift; $self->{Console}->Size(80, 50); $self->{Console}->Window(1, 0, 0, 640, 480); $self->{Console}->Cursor(-1, -1, 100, 0); $self->{Console}->FillAttr($main::BG_BLACK | $main::FG_CYAN, 80 * +50, 0, 0); #Title Bar $self->{Console}->FillAttr($main::BG_BLUE | $main::FG_WHITE, 80, 0 +, 0); $self->{Console}->FillChar(' ', 80, 0, 0); $self->{Console}->WriteChar($self->{Title}, 0, 0); #Status Bar $self->{Console}->FillAttr($main::BG_BLUE | $main::FG_WHITE, 80, 0 +, 49); #Swap in display buffer $self->{Console}->Display(); #Read Start Directory $self->{CurDir} = $self->{Start}; $self->_DisplayCurDir(); $self->_LoadCurDir(); $self->_DisplayList(); $self->_StatusBar("I'm your status bar for today!"); return $self->_MainLoop(); } #Returns a path/filname or '' on cancel sub _MainLoop() { my($self) = @_; my $events; my @event; #0 Event Type (1 = keyboard) #1 Key Down (TRUE = Pressed, FALSE = Released) #2 Repeat #3 Virtual Key #4 Virtual Scan #5 ASCII Char (0 if non-character) #6 Control Key State while(1) { while($self->{Console}->GetEvents()) { @event = $self->{Console}->Input(); $self->_StatusBar("KC: $event[3] SC: $event[4]"); } 1; } } sub Title { my($self, $title) = @_; if(defined $title) { #Set Title $self->{Title} = $title; return; }else{ #Get Title return $self->{Title}; } } sub Start { my($self, $start) = @_; if(defined $start) { #Set Start $self->{Start} = $start; return; }else{ #Get Start return $self->{Start}; } } sub _DisplayCurDir { my($self) = @_; $self->{Console}->FillChar(' ', 80, 0, 1); $self->{Console}->WriteChar($self->{CurDir}, 0, 1) } sub _DisplayList { my($self) = @_; my $line = 2; #Range to display my $first = $self->{Offset}; my $last; if($first + 46 > @{ $self->{Dir} }) { $last = $#{ $self->{Dir} } }else{ $last = $first + 46; } $self->{Console}->FillChar(' ', 80 * 47, 0, 2); foreach( @{ $self->{Dir} }[$first .. $last] ) { if($_->[1]) { $self->{Console}->WriteChar("-> $_->[0]", 0, $line); }else{ $self->{Console}->WriteChar($_->[0], 3, $line); } $line++; last if($line > 49); } } sub _LoadCurDir { my($self) = @_; opendir(DIR, $self->{CurDir}) || die "Unable to open $self->{Start +}: $!\n"; my @dir = readdir(DIR); my $filenum = 0; closedir(DIR); foreach(@dir) { if(-d File::Spec->catfile($self->{CurDir}, $_)) { $self->{Dir}->[$filenum] = [$_, 1]; }else{ $self->{Dir}->[$filenum] = [$_, 0]; } $filenum++; } #Sort alphabetically @{ $self->{Dir} } = sort { $a->[0] cmp $b->[0] } @{ $self->{Dir} } +; #Put Dir's first my(@dirs, @files); foreach(@{ $self->{Dir} }) { if($_->[1]) { push(@dirs, $_); }else{ push(@files, $_); } } @{ $self->{Dir} } = (@dirs, @files); } sub _Highlight { my($self) = @_; $self->{Console}->FillAttr($main::BG_BLACK | $main::FG_CYAN, 80 * +47, 0, 2); $self->{Console}->FillAttr($main::BG_LIGHTRED | $main::FG_WHITE, 8 +0, 0, 2 + $self->{Highlighted} - $self->{Offset}); } sub _StatusBar { my($self, $text) = @_; $self->{Console}->FillChar(' ', 80, 0, 49); $self->{Console}->WriteChar($text, 0, 49); } 1;


    --jb

In reply to Re: Win32::Console Input Buffer Problem by JayBonci
in thread Win32::Console Input Buffer Problem by Android 18

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.