LibrAdline并未从分页上的Ctrl+ c上退出。输出状态(选项卡上可能完成)

发布于 2025-02-08 03:17:39 字数 1869 浏览 2 评论 0原文

我的应用程序使用libreadline自动完成时区字符串(在按下)timezone命令。
由于可能的完成情况很多,输出被__更多__
在此状态下,如果我按Q它可以很好地退出,但是如果我按ctrl+c行为如下所示。打印出来,但打印垃圾)。

$ timezone <tab>
Display all 200 possibilities? (y or n) y    
Africa/Maputo                   America/Moncton                 Asia/Kuwait                     Europe/Stockholm
Africa/Maseru                   America/Monterrey               Asia/Macau                      Europe/Tallinn
Africa/Mbabane                  America/Montevideo              Asia/Magadan                    Europe/Tirane
Africa/Mogadishu                America/Montreal                Asia/Makassar                   Europe/Uzhgorod
Africa/Monrovia                 America/Montserrat              Asia/Manila                     Europe/Vaduz
--More--^C
�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
^P^?"^TxU                       ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ��"^TxU                         ��"^TxU                         ^P�"^TxU
0�"^TxU                         ��"^TxU                         ��"^TxU                         @�"^TxU

顺便说一下,我的sigint处理程序功能如下,我正在使用rl_attempted_completion_function注册我自己的功能以提供可能的完成字符串char **

rl_initialize();
printf("\n");
rl_forced_update_display();

如何使ctrl+c完全按照分页上的按下q的行为?

My application uses libreadline to auto complete timezone strings (on pressing tab) for timezone command.
As there are lot of possible completions the output is paginated with __more__.
In this state if I press q it exits fine but if I press Ctrl+C the behavior is as shown below.. (it wont exit until all the entries in the buffer printed out, but printing junk).

$ timezone <tab>
Display all 200 possibilities? (y or n) y    
Africa/Maputo                   America/Moncton                 Asia/Kuwait                     Europe/Stockholm
Africa/Maseru                   America/Monterrey               Asia/Macau                      Europe/Tallinn
Africa/Mbabane                  America/Montevideo              Asia/Magadan                    Europe/Tirane
Africa/Mogadishu                America/Montreal                Asia/Makassar                   Europe/Uzhgorod
Africa/Monrovia                 America/Montserrat              Asia/Manila                     Europe/Vaduz
--More--^C
�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
^P^?"^TxU                       ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ^P�"^TxU                        ��"^TxU                         ��"^TxU
0�"^TxU                         ��"^TxU                         ��"^TxU                         ^P�"^TxU
0�"^TxU                         ��"^TxU                         ��"^TxU                         @�"^TxU

By the way my SIGINT handler function is as below, and I am using rl_attempted_completion_function to register my own function to provide possible completion strings char**.

rl_initialize();
printf("\n");
rl_forced_update_display();

How to make Ctrl+C to behave exactly as pressing q on pagination?.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文