Thread: [poe-commits] SF.net SVN: poe: [1908] trunk/poe/lib/POE/Wheel/ReadLine.pm
Brought to you by:
rcaputo
From: <rc...@us...> - 2006-03-28 04:31:41
|
Revision: 1908 Author: rcaputo Date: 2006-03-27 20:31:29 -0800 (Mon, 27 Mar 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=1908&view=rev Log Message: ----------- Applied Jeff Pinyan's patch to fix tab completion when the only match for a prefix is the full string of the match. Prior to the patch, Wheel::ReadLine would just ring the terminal bell and not display any matches. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-03-27 17:41:50 UTC (rev 1907) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-03-28 04:31:29 UTC (rev 1908) @@ -2266,7 +2266,7 @@ curs_left(length($rest)-length($partial)); $self->[SELF_CURSOR_INPUT] += length($partial)-length($lookfor); $self->[SELF_CURSOR_DISPLAY] += length($partial)-length($lookfor); - return $self->rl_ding; + return $self->rl_ding if @poss == 1; } if ($self->[SELF_LAST] !~ /complete/ && !$self->option('show-all-if-ambiguous')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-04-01 07:37:19
|
Revision: 1918 Author: rcaputo Date: 2006-03-31 23:37:06 -0800 (Fri, 31 Mar 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=1918&view=rev Log Message: ----------- rt.cpan.org squashes indents in source code and patches, and some code made it into this module without indents. Fixed that. More importantly, document the EDITOR=vi gotcha. If you don't have an .inputrc, POE::Wheel::ReadLine checks out your EDITOR environment variable for clues as to the mode it uses. As a result, many people will get vi editing mode without expecting it. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-03-29 07:05:40 UTC (rev 1917) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-04-01 07:37:06 UTC (rev 1918) @@ -546,7 +546,9 @@ print $stdout $sp, normalize($self->[SELF_INPUT]); if ( $self->[SELF_CURSOR_INPUT] != length( $self->[SELF_INPUT]) ) { - curs_left( display_width($self->[SELF_INPUT]) - $self->[SELF_CURSOR_DISPLAY] ); + curs_left( + display_width($self->[SELF_INPUT]) - $self->[SELF_CURSOR_DISPLAY] + ); } } @@ -684,15 +686,15 @@ # Some platforms don't define this constant. unless (defined \&POSIX::B38400) { - eval "sub POSIX::B38400 () { 0 }"; + eval "sub POSIX::B38400 () { 0 }"; } # Get the terminal speed for Term::Cap. $ospeed = POSIX::B38400(); eval { - $termios = POSIX::Termios->new(); - $termios->getattr(); - $ospeed = $termios->getospeed() || POSIX::B38400(); + $termios = POSIX::Termios->new(); + $termios->getattr(); + $ospeed = $termios->getospeed() || POSIX::B38400(); }; # Get the current terminal's capabilities. @@ -707,22 +709,22 @@ $tc_left = "LE"; eval { $termcap->Trequire($tc_left) }; if ($@) { - $tc_left = "le"; - eval { $termcap->Trequire($tc_left) }; - if ($@) { - # try out to see if we have a better terminfo defun. - # it may well not work (hence eval the lot), but it's worth a shot - eval { - my @tc = `infocmp -C $term`; - chomp(@tc); - splice(@tc, 0, 1); # remove header line - $ENV{TERMCAP} = join("", @tc); - $termcap = Term::Cap->Tgetent( { TERM => $term, OSPEED => $ospeed } ); - $termcap->Trequire($tc_left); - }; + $tc_left = "le"; + eval { $termcap->Trequire($tc_left) }; + if ($@) { + # try out to see if we have a better terminfo defun. + # it may well not work (hence eval the lot), but it's worth a shot + eval { + my @tc = `infocmp -C $term`; + chomp(@tc); + splice(@tc, 0, 1); # remove header line + $ENV{TERMCAP} = join("", @tc); + $termcap = Term::Cap->Tgetent( { TERM => $term, OSPEED => $ospeed } ); + $termcap->Trequire($tc_left); + }; + } + die "POE::Wheel::ReadLine requires a termcap that supports LE or le" if $@; } - die "POE::Wheel::ReadLine requires a termcap that supports LE or le" if $@; - } # Terminal size. # We initialise the values once on startup, @@ -734,6 +736,7 @@ # Set up console using Term::ReadKey. ReadMode('ultra-raw'); + # And tell the terminal that we want to be in 'application' mode print $termcap->Tputs('ks' => 1) if $termcap->Tputs('ks'); @@ -994,7 +997,7 @@ if (exists $mapping->{binding}->{$raw_key}) { $fn = $mapping->{binding}->{$raw_key}; } - #print "\r\ninvoking $fn for $key\r\n";$self->repaint_input_line; + # print "\r\ninvoking $fn for $key\r\n";$self->repaint_input_line; if ($self->[SELF_COUNT] && !grep { $_ eq $fn } @fns_counting) { $self->[SELF_COUNT] = int($self->[SELF_COUNT]); $self->[SELF_COUNT] ||= 1; @@ -3335,13 +3338,26 @@ =head1 GOTCHAS / FAQ Q: Why do I lose my ReadLine prompt every time I send output to the - screen? +screen? A: You probably are using print or printf to write screen output. - ReadLine doesn't track STDOUT itself, so it doesn't know when to - refresh the prompt after you do this. Use ReadLine's put() method - to write lines to the console. +ReadLine doesn't track STDOUT itself, so it doesn't know when to +refresh the prompt after you do this. Use ReadLine's put() method to +write lines to the console. +Q: None of the editing keystrokes work. Ctrl-C displays "^c" rather +than generating an interrupt. The arrow keys don't scroll through my +input history. It's generally a bad experience. + +A: You're probably a vi/vim user. In the absence of a ~/.inputrc +file, POE::Wheel::ReadLine checks your EDITOR environment variable for +clues about your editing preference. If it sees /vi/ in there, it +starts in vi mode. You can override this by creating a ~/.inputrc +file containing the line "set editing-mode emacs", or adding that line +to your existing ~/.inputrc. While you're in there, you should +totally get acquainted with all the other cool stuff you can do with +.inputrc files. + =head1 AUTHORS & COPYRIGHTS Rocco Caputo - Original author. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-04-02 00:33:28
|
Revision: 1919 Author: rcaputo Date: 2006-04-01 16:33:21 -0800 (Sat, 01 Apr 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=1919&view=rev Log Message: ----------- Use the emacs input mode by default. Everybody expects the arrow keys to work, and vi power users probably know about .inputrc already. Get the delete key doing that backward-character-delete thang. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-04-01 07:37:06 UTC (rev 1918) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-04-02 00:33:21 UTC (rev 1919) @@ -296,6 +296,7 @@ C-]: character-search C-_: undo del: backward-delete-char +rubout: backward-delete-char M-C-g: abort M-C-h: backward-kill-word @@ -647,23 +648,29 @@ foreach my $l (split(//, $raw_key)) { if (ord($l) == 0x1B) { push(@text, 'Meta-'); - } elsif (ord($l) < 32) { + next; + } + if (ord($l) < 32) { push(@text, 'Control-' . chr(ord($l)+64)); - } elsif (ord($l) > 128) { + next; + } + if (ord($l) > 127) { my $l = ord($l)-128; if ($l < 32) { - $l = "Control-" . chr(ord($l)+64); + $l = "Control-" . chr($l+64); } push(@text, 'Meta-' . chr($l)); - } else { - push(@text, $l); + next; } + if (ord($l) == 127) { + push @text, "^?"; + next; + } + push(@text, $l); } return join("", @text); } - - # Calculate the display width of a string. The display width is # sometimes wider than the actual string because some characters are # represented on the terminal as multiple characters. @@ -755,7 +762,7 @@ my $convert_meta = 1; for (my $ord = 0; $ord < 256; $ord++) { my $str = chr($ord); - if ($ord > 126) { + if ($ord > 127) { if ($convert_meta) { $str = "^["; if (($ord - 128) < 32) { @@ -769,6 +776,9 @@ } elsif ($ord < 32) { $str = '^' . lc(chr($ord+64)); } + elsif ($ord == 127) { + $str = "^?"; # -><- chr(127); + } $normalized_character{chr($ord)} = $str; $normalized_extra_width[$ord] = length ( $str ) - 1; } @@ -994,9 +1004,11 @@ my ($self, $key, $raw_key) = @_; my $mapping = $self->[SELF_KEYMAP]; my $fn = $mapping->{default}; + if (exists $mapping->{binding}->{$raw_key}) { $fn = $mapping->{binding}->{$raw_key}; } + # print "\r\ninvoking $fn for $key\r\n";$self->repaint_input_line; if ($self->[SELF_COUNT] && !grep { $_ eq $fn } @fns_counting) { $self->[SELF_COUNT] = int($self->[SELF_COUNT]); @@ -1221,13 +1233,11 @@ $self->parse_inputrc($input); } } + if (!$self->option('editing-mode')) { - if (exists $ENV{EDITOR} && $ENV{EDITOR} =~ /vi/) { - $self->[SELF_OPTIONS]->{'editing-mode'} = 'vi'; - } else { - $self->[SELF_OPTIONS]->{'editing-mode'} = 'emacs'; - } + $self->[SELF_OPTIONS]->{'editing-mode'} = 'emacs'; } + if ($self->option('editing-mode') eq 'vi') { # by default, start in insert mode already $self->rl_set_keymap('vi-insert'); @@ -2917,15 +2927,15 @@ ); my %english_to_key = ( - 'space' => ' ', - 'esc' => '^[', - 'escape' => '^[', - 'tab' => '^I', - 'ret' => '^J', - 'return' => '^J', - 'newline' => '^M', - 'lfd' => '^L', - 'rubout' => '^?', + 'space' => " ", + 'esc' => "\e", + 'escape' => "\e", + 'tab' => "\cI", + 'ret' => "\cJ", + 'return' => "\cJ", + 'newline' => "\cM", + 'lfd' => "\cL", + 'rubout' => chr(127), ); sub init { @@ -2958,7 +2968,12 @@ return $seq; } -sub control { return chr(ord(uc($_[0]))-64) }; +sub control { + my $c = shift; + return chr(0x7F) if $c eq "?"; + return chr(ord(uc($c))-64); +} + sub meta { return "\x1B" . $_[0] }; sub bind_key { my ($self, $inseq, $fn) = @_; @@ -3155,9 +3170,8 @@ Bind a function to a named key sequence. The key sequence can be in any of the forms defined within readline(3). The function should either be a pre-registered name such as 'self-insert', or it should be -a reference to a function. The binding is made in the current -keymap. If you wish to change keymaps, then use the -rl_set_keymap method. +a reference to a function. The binding is made in the current keymap. +If you wish to change keymaps, then use the rl_set_keymap method. =item add_defun NAME FN This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-07-27 22:36:05
|
Revision: 2013 Author: rcaputo Date: 2006-07-26 23:16:55 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=2013&view=rev Log Message: ----------- Applied Nick Williams' patch to remove newlines from history read from a file and to truncate the loaded history to the maximum number of lines it should maintain. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-07-24 22:16:22 UTC (rev 2012) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-07-27 06:16:55 UTC (rev 2013) @@ -1151,12 +1151,15 @@ $file ||= "$ENV{HOME}/.history"; open(HIST, $file) or return undef; my @hist = <HIST>; + chomp(@hist); close(HIST); + if ((scalar @hist) > $lines) { open(HIST, ">$file") or return undef; if ($lines) { - splice(@hist, -$lines); - print HIST @{$self->[SELF_HIST_LIST]} = @hist; + splice(@hist, 0, (scalar @hist)-$lines); + @{$self->[SELF_HIST_LIST]} = @hist; + print HIST join("\n", @hist) . "\n"; } else { @{$self->[SELF_HIST_LIST]} = (); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-08-09 13:02:43
|
Revision: 2039 Author: rcaputo Date: 2006-08-09 06:02:33 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=2039&view=rev Log Message: ----------- Apply Nick Williams's patch to only enable raw input when POE::Wheel::ReadLine is expecting input. Ctrl+C, for example, will still thrown a SIGINT while a program is not waiting on a pending get(). I'm not sure this is great, but it's worth a try. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-09 03:40:41 UTC (rev 2038) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-09 13:02:33 UTC (rev 2039) @@ -741,12 +741,6 @@ # an up-to-date value). ($trk_cols, $trk_rows) = GetTerminalSize($stdout); - # Set up console using Term::ReadKey. - ReadMode('ultra-raw'); - - # And tell the terminal that we want to be in 'application' mode - print $termcap->Tputs('ks' => 1) if $termcap->Tputs('ks'); - # Configuration... # Some things are optional. eval { $termcap->Trequire( 'ce' ) }; @@ -1042,6 +1036,10 @@ # has changed ($trk_cols, $trk_rows) = GetTerminalSize($stdout); + ReadMode('ultra-raw'); + # Tell the terminal that we want to be in 'application' mode. + print $termcap->Tputs('ks' => 1) if $termcap->Tputs('ks'); + # Set up for the read. $self->[SELF_READING_LINE] = 1; $self->[SELF_PROMPT] = $prompt; @@ -1151,15 +1149,15 @@ $file ||= "$ENV{HOME}/.history"; open(HIST, $file) or return undef; my @hist = <HIST>; - chomp(@hist); close(HIST); + chomp(@hist); if ((scalar @hist) > $lines) { open(HIST, ">$file") or return undef; if ($lines) { splice(@hist, 0, (scalar @hist)-$lines); @{$self->[SELF_HIST_LIST]} = @hist; - print HIST join("\n", @hist) . "\n"; + print HIST "$_\n" foreach @hist; } else { @{$self->[SELF_HIST_LIST]} = (); } @@ -1779,6 +1777,7 @@ $self->[SELF_READING_LINE] = 0; $self->[SELF_HIST_INDEX] = @{$self->[SELF_HIST_LIST]}; $self->flush_output_buffer; + ReadMode('restore'); ($trk_cols, $trk_rows) = GetTerminalSize($stdout); if ($self->[SELF_KEYMAP]->{name} =~ /vi/) { $self->rl_set_keymap('vi-insert'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-09-01 01:09:15
|
Revision: 2082 http://svn.sourceforge.net/poe/?rev=2082&view=rev Author: rcaputo Date: 2006-08-31 18:09:10 -0700 (Thu, 31 Aug 2006) Log Message: ----------- POE::Wheel::ReadLine isn't supported on Windows. ActivePerl can only multiplex sockets. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-31 15:53:27 UTC (rev 2081) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-01 01:09:10 UTC (rev 2082) @@ -13,6 +13,10 @@ use POE qw( Wheel ); use POSIX (); +if ($^O eq "MSWin32") { + die "$^O cannot run " . __PACKAGE__; +} + # Things we'll need to interact with the terminal. use Term::Cap (); use Term::ReadKey qw( ReadKey ReadMode GetTerminalSize ); @@ -691,18 +695,10 @@ sub global_init { return if $initialised; - # Some platforms don't define this constant. - unless (defined \&POSIX::B38400) { - eval "sub POSIX::B38400 () { 0 }"; - } - # Get the terminal speed for Term::Cap. - $ospeed = POSIX::B38400(); - eval { - $termios = POSIX::Termios->new(); - $termios->getattr(); - $ospeed = $termios->getospeed() || POSIX::B38400(); - }; + $termios = POSIX::Termios->new(); + $termios->getattr(); + $ospeed = $termios->getospeed() || eval { POSIX::B38400() } || 0; # Get the current terminal's capabilities. $term = $ENV{TERM} || 'vt100'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-09-05 01:41:15
|
Revision: 2098 http://svn.sourceforge.net/poe/?rev=2098&view=rev Author: rcaputo Date: 2006-09-04 18:41:11 -0700 (Mon, 04 Sep 2006) Log Message: ----------- A cheezy hack to avoid destroying Wheel::ReadLine instances from within POE::Kernel's space. A proper fix would be to somehow break this wheel's circular references to $self so that DESTROY is triggered immediately when the user destroys the objects' last references. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-04 21:17:47 UTC (rev 2097) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-05 01:41:11 UTC (rev 2098) @@ -882,6 +882,12 @@ sub DESTROY { my $self = shift; + # TODO - This module keeps several references to $self in anonymous + # subroutines. These $self-references keep the wheel from dying + # until well after its parent session is gone. The following + # return() statement is a cheezy workaround for this problem. + return if $poe_kernel->get_active_session == $poe_kernel; + # Stop selecting on the handle. $poe_kernel->select($stdin); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-09-19 19:45:20
|
Revision: 2134 http://svn.sourceforge.net/poe/?rev=2134&view=rev Author: rcaputo Date: 2006-09-19 12:45:12 -0700 (Tue, 19 Sep 2006) Log Message: ----------- Remove the cheezy hack from r2098 that prevents terminals from being restored when programs exit. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-19 03:42:28 UTC (rev 2133) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-19 19:45:12 UTC (rev 2134) @@ -882,12 +882,6 @@ sub DESTROY { my $self = shift; - # TODO - This module keeps several references to $self in anonymous - # subroutines. These $self-references keep the wheel from dying - # until well after its parent session is gone. The following - # return() statement is a cheezy workaround for this problem. - return if $poe_kernel->get_active_session == $poe_kernel; - # Stop selecting on the handle. $poe_kernel->select($stdin); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-09-23 16:09:34
|
Revision: 2137 http://svn.sourceforge.net/poe/?rev=2137&view=rev Author: rcaputo Date: 2006-09-23 09:08:30 -0700 (Sat, 23 Sep 2006) Log Message: ----------- Document why this module refuses to run on MSWin32. At least two people have expressed confusion and concern about this so far. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-19 22:00:21 UTC (rev 2136) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-23 16:08:30 UTC (rev 2137) @@ -3388,6 +3388,22 @@ totally get acquainted with all the other cool stuff you can do with .inputrc files. +Q: Why doesn't POE::Wheel::ReadLine work on Windows? Term::ReadLine +does. + +A: POE::Wheel::ReadLine requires select(), because that's what POE +uses by default to detect keystrokes without blocking. About half the +flavors of Perl on Windows implement select() in terms of the same +function in the WinSock library, which limits select() to working only +with sockets. Your console isn't a socket, so select() doesn't work +with your version of Perl on Windows. + +Really good workarounds are possible but don't exist as of this +writing. They involve writing a special POE::Loop for Windows that +either uses a Win32-specific module for better multiplexing, that +polls for input, or that uses blocking I/O watchers in separate +threads. + =head1 AUTHORS & COPYRIGHTS Rocco Caputo - Original author. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-08-09 03:40:48
|
Revision: 2038 Author: rcaputo Date: 2006-08-08 20:40:41 -0700 (Tue, 08 Aug 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=2038&view=rev Log Message: ----------- If Wheel::ReadLine must die because it cannot open a private copy of STDIN or STDOUT, at least have it explain WHY the open failed! Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-08 15:37:27 UTC (rev 2037) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-09 03:40:41 UTC (rev 2038) @@ -28,10 +28,10 @@ # Private STDIN and STDOUT. my $stdin = gensym(); -open($stdin, "<&0") or die "Can't open private STDIN"; +open($stdin, "<&0") or die "Can't open private STDIN: $!"; my $stdout = gensym; -open($stdout, ">&1") or die "Can't open private STDOUT"; +open($stdout, ">&1") or die "Can't open private STDOUT: $!"; # Offsets into $self. sub SELF_INPUT () { 0 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-08-14 15:13:54
|
Revision: 2043 Author: rcaputo Date: 2006-08-14 08:09:07 -0700 (Mon, 14 Aug 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=2043&view=rev Log Message: ----------- Don't rely on STDIN and STDOUT being file descriptors 0 and 1, respectively. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-13 02:33:23 UTC (rev 2042) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-08-14 15:09:07 UTC (rev 2043) @@ -28,10 +28,10 @@ # Private STDIN and STDOUT. my $stdin = gensym(); -open($stdin, "<&0") or die "Can't open private STDIN: $!"; +open($stdin, "<&STDIN") or die "Can't open private STDIN: $!"; my $stdout = gensym; -open($stdout, ">&1") or die "Can't open private STDOUT: $!"; +open($stdout, ">&STDOUT") or die "Can't open private STDOUT: $!"; # Offsets into $self. sub SELF_INPUT () { 0 } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2006-09-05 05:47:51
|
Revision: 2103 http://svn.sourceforge.net/poe/?rev=2103&view=rev Author: rcaputo Date: 2006-09-04 22:47:42 -0700 (Mon, 04 Sep 2006) Log Message: ----------- POE::Wheel::Readline would delete twice as many characters as necessary on a kill-word command. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-05 03:19:08 UTC (rev 2102) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2006-09-05 05:47:42 UTC (rev 2103) @@ -1628,7 +1628,7 @@ sub rl_kill_word { my ($self, $key) = @_; if ($self->[SELF_CURSOR_INPUT] < length($self->[SELF_INPUT])) { - substr($self->[SELF_INPUT], $self->[SELF_CURSOR_INPUT]) =~ s/^(\W*\w*\W*)//; + substr($self->[SELF_INPUT], $self->[SELF_CURSOR_INPUT]) =~ /^(\W*\w*\W*)/; my $kill = $self->delete_chars($self->[SELF_CURSOR_INPUT], length($1)); push(@{$self->[SELF_KILL_RING]}, $kill); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2007-03-18 13:32:49
|
Revision: 2177 http://svn.sourceforge.net/poe/?rev=2177&view=rev Author: rcaputo Date: 2007-03-17 13:20:01 -0700 (Sat, 17 Mar 2007) Log Message: ----------- Lukas Mai discovered a bug in the include .inputrc directive and was kind enough to submit a patch. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2007-03-12 17:11:46 UTC (rev 2176) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2007-03-17 20:20:01 UTC (rev 2177) @@ -1258,7 +1258,7 @@ foreach my $line (split(/\n+/, $input)) { next if $line =~ /^#/; if ($line =~ /^\$(.*)/) { - my (@parms) = split(/[ +=]/,$1); + my (@parms) = split(/[ \t+=]/,$1); if ($parms[0] eq 'if') { my $bool = 0; if ($parms[1] eq 'mode') { @@ -1280,9 +1280,14 @@ pop(@cond); } elsif ($parms[0] eq 'include') { if ($depth > 10) { - print STDERR "WARNING: ignoring 'include $parms[1] directive, since we're too deep"; + print STDERR "WARNING: ignoring ``include $parms[1] directive, since we're too deep''"; } else { - $self->_parse_inputrc($input, $depth+1); + my $fh = gensym; + if (open $fh, "< $parms[1]\0") { + my $contents = do { local $/; <$fh> }; + close $fh; + $self->_parse_inputrc($contents, $depth+1); + } } } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rc...@us...> - 2008-03-23 01:19:42
|
Revision: 2293 http://poe.svn.sourceforge.net/poe/?rev=2293&view=rev Author: rcaputo Date: 2008-03-22 18:19:48 -0700 (Sat, 22 Mar 2008) Log Message: ----------- Fall back to an 80x25 terminal size if Term::ReadKey::GetTerminalSize fails. Modified Paths: -------------- trunk/poe/lib/POE/Wheel/ReadLine.pm Modified: trunk/poe/lib/POE/Wheel/ReadLine.pm =================================================================== --- trunk/poe/lib/POE/Wheel/ReadLine.pm 2008-03-22 22:22:40 UTC (rev 2292) +++ trunk/poe/lib/POE/Wheel/ReadLine.pm 2008-03-23 01:19:48 UTC (rev 2293) @@ -735,7 +735,8 @@ # the input state engine (so that we have valid values) and # before handing control back to the user (so that they get # an up-to-date value). - ($trk_cols, $trk_rows) = GetTerminalSize($stdout); + eval { ($trk_cols, $trk_rows) = GetTerminalSize($stdout) }; + ($trk_cols, $trk_rows) = (80, 25) if $@; # Configuration... # Some things are optional. @@ -1030,7 +1031,8 @@ return if $self->[SELF_READING_LINE]; # recheck the terminal size every prompt, in case the size # has changed - ($trk_cols, $trk_rows) = GetTerminalSize($stdout); + eval { ($trk_cols, $trk_rows) = GetTerminalSize($stdout) }; + ($trk_cols, $trk_rows) = (80, 25) if $@; ReadMode('ultra-raw'); # Tell the terminal that we want to be in 'application' mode. @@ -1779,7 +1781,8 @@ $self->[SELF_HIST_INDEX] = @{$self->[SELF_HIST_LIST]}; $self->_flush_output_buffer; ReadMode('restore'); - ($trk_cols, $trk_rows) = GetTerminalSize($stdout); + eval { ($trk_cols, $trk_rows) = GetTerminalSize($stdout) }; + ($trk_cols, $trk_rows) = (80, 25) if $@; if ($self->[SELF_KEYMAP]->{name} =~ /vi/) { $self->rl_set_keymap('vi-insert'); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |