This subject has been 'answered' on various web resources, but I don't find it works for me; I get an extra space after tab-completion, using Term::ReadLine::Gnu even though I set the attribute 'completion_suppress_append' which allegedly works for Gnu readline. Well, it won't work for me on cygwin (latest 32-bit release) with perl 5.14.12. I can't tell if this is a cygwin issue or a perl issue - any ideas how to debug? - it's driving me potty!
use Term::ReadLine; my @commands = qw(one two three four five six seven eight nine ten); my $term = Term::ReadLine->new('test'); if (my $attr = $term->Attribs) { my $pkg = Term::ReadLine->ReadLine(); print "package is $pkg\n"; $term->ornaments(0); $attr->{basic_word_break_characters} = ". \t\n"; $attr->{completer_word_break_characters} = " \t\n"; $attr->{completion_function} = \&complete_word; $attr->{completion_suppress_append} = 1; # doesn't work! :( $attr->{completion_append_character} = "\0"; # nor this } while (1) { my $Command = $term->readline("Cmd>"); print "command:>$Command<\n"; } sub complete_word { my ($text, $line, $start) = @_; return grep(/^$text/, @commands); }
TIA!

In reply to term::readline::gnu extra spaces on completion by daverowntree

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.