当前位置: 首页>>代码示例>>Python>>正文


Python Token.PartialKeyBinding方法代码示例

本文整理汇总了Python中prompt_toolkit.token.Token.PartialKeyBinding方法的典型用法代码示例。如果您正苦于以下问题:Python Token.PartialKeyBinding方法的具体用法?Python Token.PartialKeyBinding怎么用?Python Token.PartialKeyBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在prompt_toolkit.token.Token的用法示例。


在下文中一共展示了Token.PartialKeyBinding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _show_input_processor_key_buffer

# 需要导入模块: from prompt_toolkit.token import Token [as 别名]
# 或者: from prompt_toolkit.token.Token import PartialKeyBinding [as 别名]
def _show_input_processor_key_buffer(self, cli, new_screen):
        """
        When the user is typing a key binding that consists of several keys,
        display the last pressed key if the user is in insert mode and the key
        is meaningful to be displayed.
        E.g. Some people want to bind 'jj' to escape in Vi insert mode. But the
             first 'j' needs to be displayed in order to get some feedback.
        """
        key_buffer = cli.input_processor.key_buffer

        if key_buffer and _in_insert_mode(cli) and not cli.is_done:
            # The textual data for the given key. (Can be a VT100 escape
            # sequence.)
            data = key_buffer[-1].data

            # Display only if this is a 1 cell width character.
            if get_cwidth(data) == 1:
                cpos = new_screen.cursor_position
                new_screen.data_buffer[cpos.y][cpos.x] = \
                    _CHAR_CACHE[data, Token.PartialKeyBinding] 
开发者ID:chrisjim316,项目名称:Liljimbo-Chatbot,代码行数:22,代码来源:containers.py


注:本文中的prompt_toolkit.token.Token.PartialKeyBinding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。