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


Python enums.SEARCH_BUFFER属性代码示例

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


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

示例1: _get_isearch_tokens

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def _get_isearch_tokens(cli):
    def before():
        if cli.search_state.direction == IncrementalSearchDirection.BACKWARD:
            text = 'reverse-i-search'
        else:
            text = 'i-search'

        return [(Token.Prompt.Search, '(%s)`' % text)]

    def text():
        return [(Token.Prompt.Search.Text, cli.buffers[SEARCH_BUFFER].text)]

    def after():
        return [(Token.Prompt.Search, '`: ')]

    return before() + text() + after() 
开发者ID:bkerler,项目名称:android_universal,代码行数:18,代码来源:prompt.py

示例2: __init__

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def __init__(self, vi_mode=False):
        token = Token.Toolbar.Search

        def get_before_input(cli):
            if not cli.is_searching:
                text = ''
            elif cli.search_state.direction == IncrementalSearchDirection.BACKWARD:
                text = ('?' if vi_mode else 'I-search backward: ')
            else:
                text = ('/' if vi_mode else 'I-search: ')

            return [(token, text)]

        super(SearchToolbarControl, self).__init__(
            buffer_name=SEARCH_BUFFER,
            input_processors=[BeforeInput(get_before_input)],
            default_char=Char(token=token),
            lexer=SimpleLexer(token=token.Text)) 
开发者ID:bkerler,项目名称:android_universal,代码行数:20,代码来源:toolbars.py

示例3: _create_search_buffer

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def _create_search_buffer(self) -> Buffer:
        return Buffer(name=SEARCH_BUFFER) 
开发者ID:prompt-toolkit,项目名称:python-prompt-toolkit,代码行数:4,代码来源:prompt.py

示例4: reverse_search_history

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def reverse_search_history(event):
    """
    Search backward starting at the current line and moving `up` through
    the history as necessary. This is an incremental search.
    """
    event.cli.current_search_state.direction = IncrementalSearchDirection.BACKWARD
    event.cli.push_focus(SEARCH_BUFFER)


#
# Commands for changing text
# 
开发者ID:bkerler,项目名称:android_universal,代码行数:14,代码来源:named_commands.py

示例5: __init__

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def __init__(self, preview_search=False, search_buffer_name=SEARCH_BUFFER,
                 get_search_state=None):
        self.preview_search = to_cli_filter(preview_search)
        self.search_buffer_name = search_buffer_name
        self.get_search_state = get_search_state or (lambda cli: cli.search_state) 
开发者ID:bkerler,项目名称:android_universal,代码行数:7,代码来源:processors.py

示例6: __init__

# 需要导入模块: from prompt_toolkit import enums [as 别名]
# 或者: from prompt_toolkit.enums import SEARCH_BUFFER [as 别名]
def __init__(self,
                 buffer_name=DEFAULT_BUFFER,
                 input_processors=None,
                 lexer=None,
                 preview_search=False,
                 search_buffer_name=SEARCH_BUFFER,
                 get_search_state=None,
                 menu_position=None,
                 default_char=None,
                 focus_on_click=False):
        assert input_processors is None or all(isinstance(i, Processor) for i in input_processors)
        assert menu_position is None or callable(menu_position)
        assert lexer is None or isinstance(lexer, Lexer)
        assert get_search_state is None or callable(get_search_state)
        assert default_char is None or isinstance(default_char, Char)

        self.preview_search = to_cli_filter(preview_search)
        self.get_search_state = get_search_state
        self.focus_on_click = to_cli_filter(focus_on_click)

        self.input_processors = input_processors or []
        self.buffer_name = buffer_name
        self.menu_position = menu_position
        self.lexer = lexer or SimpleLexer()
        self.default_char = default_char or Char(token=Token.Transparent)
        self.search_buffer_name = search_buffer_name

        #: Cache for the lexer.
        #: Often, due to cursor movement, undo/redo and window resizing
        #: operations, it happens that a short time, the same document has to be
        #: lexed. This is a faily easy way to cache such an expensive operation.
        self._token_cache = SimpleCache(maxsize=8)

        self._xy_to_cursor_position = None
        self._last_click_timestamp = None
        self._last_get_processed_line = None 
开发者ID:bkerler,项目名称:android_universal,代码行数:38,代码来源:controls.py


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