OS X上的Python/编辑线:£符号似乎与ed-prev-word绑定 [英] Python/editline on OS X: £ sign seems to be bound to ed-prev-word

查看:112
本文介绍了OS X上的Python/编辑线:£符号似乎与ed-prev-word绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac OS X上,我无法在Python交互式外壳程序中输入英镑符号(£).

On Mac OS X I can’t enter a pound sterling sign (£) into the Python interactive shell.

* Mac OS X 10.5.5
* Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17)
* European keyboard (£ is shift-3)

当我在Python交互式shell中键入shift-3时,我似乎调用了上一个word函数,即,光标将移动到该行上键入的最后一个"word"(即以空格分隔的项目)的开头.当我回到bash shell中时,按预期输入shift-3会产生一个£.

When I type shift-3 in the Python interactive shell, I seem to invoke the previous word function, i.e. the cursor will move to the start of the last "word" (i.e. space-delimited item) typed on the line. When I’m back in the bash shell, typing shift-3 just produces a £, as expected.

此版本的Python显然将editline用于其交互式shell,而不是readline.我猜测默认的编辑线键绑定之一会将Shift-3(或我键入shift-3时看到的任何编辑线)绑定到ed-prev-word命令.

This version of Python apparently uses editline for its interactive shell, as opposed to readline. I’m guessing that one of the default editline key bindings binds shift-3 (or whatever editline sees when I type shift-3) to the ed-prev-word command.

我在〜/.editrc文件中尝试了一些操作来删除此绑定,但它们没有任何作用:

I’ve tried a few things in my ~/.editrc file to remove this binding, and they don’t have any effect:

  • bind -r £
  • bind -r \243
  • bind -r \156
  • bind -r £
  • bind -r \243
  • bind -r \156

另一个导致总线错误的事件:

And another that causes a bus error:

  • bind £ \243

有什么想法吗?

推荐答案

这可能是一个编辑行问题; libedit可能不接受UTF-8字符:

This may be an editline issue; libedit may not accept UTF-8 characters:

  • http://tracker.firebirdsql.org/browse/CORE-362#action_11593
  • http://marc.info/?t=119056021900002&r=1&w=2

这篇关于OS X上的Python/编辑线:£符号似乎与ed-prev-word绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆