简体   繁体   English

OS X 上的 Python/editline:£ 符号似乎绑定到 ed-prev-word

[英]Python/editline on OS X: £ sign seems to be bound to ed-prev-word

On Mac OS XI can't enter a pound sterling sign (£) into the Python interactive shell.在 Mac OS XI 上,无法在 Python 交互式 shell 中输入英镑符号 (£)。

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

When I type shift-3 in the Python interactive shell, I seem to invoke the previous word function, ie the cursor will move to the start of the last “word” (ie space-delimited item) typed on the line.当我在 Python 交互式 shell 中键入 shift-3 时,我似乎调用了前一个单词函数,即光标将移动到该行上键入的最后一个“单词”(即空格分隔项)的开头。 When I'm back in the bash shell, typing shift-3 just produces a £, as expected.当我回到 bash shell 时,按预期输入 shift-3 只会产生一个 £。

This version of Python apparently uses editline for its interactive shell, as opposed to readline.这个版本的 Python 显然在其交互式 shell 中使用了 editline,而不是 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.我猜测默认的编辑行键绑定之一将 shift-3(或我键入 shift-3 时看到的任何编辑行)绑定到 ed-prev-word 命令。

I've tried a few things in my ~/.editrc file to remove this binding, and they don't have any effect:我在 ~/.editrc 文件中尝试了一些东西来删除这个绑定,但它们没有任何效果:

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

And another that causes a bus error:另一个导致总线错误的原因:

  • bind £ \\243

Any ideas?有任何想法吗?

This may be an editline issue;这可能是编辑行问题; libedit may not accept UTF-8 characters: libedit 可能不接受 UTF-8 字符:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM