如何使用 Perl 的 Term::Readline 防止将空格附加到制表符完成的单词上?

发布于 2024-08-09 08:59:03 字数 309 浏览 0 评论 0原文

我正在使用 Term::ReadLine::Gnu 的制表符补全支持模块。每次我执行制表符操作时,我都会在完成的单词后面出现一个空格。

例如:

如果我有一个词“完整”作为可能的完成。提示后我按下了选项卡,我是 得到它就像:

“完成”,

其中这些是完成的单词末尾的空格。我想要的是:

“完整”

有什么方法可以删除该空间吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

濫情▎り 2024-08-16 08:59:03

在你的完成函数中尝试这个(未经测试):

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

这对应于 GNU readline 中的 rl_completion_suppress_append 变量。

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.

少钕鈤記 2024-08-16 08:59:03

在完成函数中将completion_suppress_append设置为1。

请参阅https://github.com/hirooih/perl-trg/issues/22。

Set completion_suppress_append to 1 in a completion function.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文