Anandan
Anandan

Reputation: 1013

How can prevent a space from being appended to the tab-completed word using Perl's Term::Readline?

I am using tab completion support of Term::ReadLine::Gnu module. Every time I do a tab, I get a space after the completed word.

For example:

If i have a word "complete" as a possible completion. After prompt I pressed tab and I am getting it like:

"complete "

where these is a space at the end of the completed word. What I want is:

"complete"

Is there any way to remove that space?

Upvotes: 2

Views: 343

Answers (2)

Hiroo
Hiroo

Reputation: 54

Set completion_suppress_append to 1 in a completion function.

See https://github.com/hirooih/perl-trg/issues/22.

Upvotes: -1

hobbs
hobbs

Reputation: 240294

Try this (untested) in your completion function:

my $attribs = $term->Attribs;
$attribs->{completion_suppress_append} = 1;

This corresponds to the rl_completion_suppress_append variable in GNU readline.

Upvotes: 7

Related Questions