Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 132437
Status: new
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: rob [...] themayfamily.me.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: POE::Wheel::ReadLine - autocompletion incorrect cursor position
Date: Tue, 28 Apr 2020 00:50:43 +0100
To: bug-POE [...] rt.cpan.org
From: Robert May <rob [...] themayfamily.me.uk>
v1.367 tested. Still appears to be present in v1.368. Running code below on Ubuntu 18.04 server. At prompt type se<TAB> and completion fills word 'server' but leaves cursor on the final 'e' and not after the word. Further <TAB> presses jump the cursor left. I'm currently working around this with a modification to rl_complete(), but I know this isn't the actual solution. snippet starting at line 2273. $self->rl_redraw_current_line() added after line 2279 if (scalar @poss == 1) { substr($self->[SELF_INPUT], $point, $self->[SELF_CURSOR_INPUT]) = $poss[ 0]; my $rest = substr($self->[SELF_INPUT], $point+length($lookfor)); print $stdout $rest; _curs_left(length($rest)-length($poss[0])); $self->[SELF_CURSOR_INPUT] += length($poss[0])-length($lookfor); $self->[SELF_CURSOR_DISPLAY] += length($poss[0])-length($lookfor); $self->rl_redraw_current_line(); return 1; } Thanks, Rob. Code displaying the issue: ------ code ------ #!/usr/bin/perl use warnings; use strict; use POE qw( Wheel::ReadLine ); sub handle_start { my ($kernel, $heap) = @_[KERNEL, HEAP]; # Start the terminal reader/writer. $heap->{stdio} = POE::Wheel::ReadLine->new( InputEvent => "got_terminal_stdin" ); my $attribs = $heap->{stdio}->attribs(); $attribs->{completion_function} = \&completion_function; $attribs->{'print-completions-horizontally'} = 'on'; $heap->{stdio}->get( "XXXX> " ); } ### Handle terminal STDIN. sub handle_terminal_stdin { my ($heap, $input, $exception) = @_[HEAP, ARG0, ARG1]; if (!defined $input) { # Exception die $exception; } # Handle input $input =~ s/^\s*//; if (length($input) > 0) { # ... } $heap->{stdio}->get(); return; } sub completion_function { return qw( server exit user whitelist backup start stop ); } POE::Session->create( inline_states => { _start => \&handle_start, got_terminal_stdin => \&handle_terminal_stdin, }, ); $poe_kernel->run(); exit 0;

Message body is not shown because it is too large.