Beispiel #1
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.prompter = Prompter()
     self.history = PromptToolkitHistory()
     self.pt_completer = PromptToolkitCompleter(self.completer, self.ctx)
     key_bindings_manager_args = {
         'enable_auto_suggest_bindings': True,
         'enable_search': True,
         'enable_abort_and_exit_bindings': True,
         }
     self.key_bindings_manager = KeyBindingManager(**key_bindings_manager_args)
     load_xonsh_bindings(self.key_bindings_manager)
Beispiel #2
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.prompter = Prompter()
     self.history = PromptToolkitHistory()
     self.pt_completer = PromptToolkitCompleter(self.completer, self.ctx)
     self.key_bindings_manager = KeyBindingManager(
         enable_auto_suggest_bindings=True,
         enable_search=True,
         enable_abort_and_exit_bindings=True,
         enable_vi_mode=Condition(lambda cli: builtins.__xonsh_env__.get('VI_MODE')),
         enable_open_in_editor=True)
     load_xonsh_bindings(self.key_bindings_manager)
Beispiel #3
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.prompter = Prompter()
     self.history = PromptToolkitHistory()
     self.pt_completer = PromptToolkitCompleter(self.completer, self.ctx)
     key_bindings_manager_args = {
         'enable_auto_suggest_bindings': True,
         'enable_search': True,
         'enable_abort_and_exit_bindings': True,
     }
     self.key_bindings_manager = KeyBindingManager(
         **key_bindings_manager_args)
     load_xonsh_bindings(self.key_bindings_manager)
     # This assumes that PromptToolkitShell is a singleton
     events.on_ptk_create.fire(self.prompter, self.history,
                               self.pt_completer, self.key_bindings_manager)
Beispiel #4
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     if ON_WINDOWS:
         winutils.enable_virtual_terminal_processing()
     self._first_prompt = True
     self.prompter = Prompter()
     self.history = PromptToolkitHistory()
     self.pt_completer = PromptToolkitCompleter(self.completer, self.ctx, self)
     key_bindings_manager_args = {
         'enable_auto_suggest_bindings': True,
         'enable_search': True,
         'enable_abort_and_exit_bindings': True,
     }
     self.key_bindings_manager = KeyBindingManager(**key_bindings_manager_args)
     load_xonsh_bindings(self.key_bindings_manager)
     # This assumes that PromptToolkitShell is a singleton
     events.on_ptk_create.fire(
         prompter=self.prompter,
         history=self.history,
         completer=self.pt_completer,
         bindings=self.key_bindings_manager,
     )
Beispiel #5
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.prompter = Prompter()
        self.history = PromptToolkitHistory()
        self.pt_completer = PromptToolkitCompleter(self.completer, self.ctx)

        key_bindings_manager_args = {
            'enable_auto_suggest_bindings': True,
            'enable_search': True,
            'enable_abort_and_exit_bindings': True,
            'enable_open_in_editor': True,
        }
        major, minor = ptk_version_info()[:2]
        self.new_vi_mode_flag = (major, minor) >= (1, 0) \
                                and ptk_version() != '<0.57'
        if not self.new_vi_mode_flag:
            # enable_vi_mode is deprecated acoording to prompt_toolset 1.0 document.
            key_bindings_manager_args['enable_vi_mode'] = Condition(
                lambda cli: builtins.__xonsh_env__.get('VI_MODE'))

        self.key_bindings_manager = KeyBindingManager(
            **key_bindings_manager_args)
        load_xonsh_bindings(self.key_bindings_manager)
Beispiel #6
0
def test_obj():
    history_obj = PromptToolkitHistory(load_prev=False)
    history_obj.append('line10')
    assert ['line10'] == history_obj.strings
    assert len(history_obj) == 1
    assert ['line10'] == [x for x in history_obj]
Beispiel #7
0
def test_obj():
    history_obj = PromptToolkitHistory(load_prev=False)
    history_obj.append('line10')
    yield assert_equal, ['line10'], history_obj.strings
    yield assert_equal, 1, len(history_obj)
    yield assert_equal, ['line10'], [x for x in history_obj]
Beispiel #8
0
def history_obj():
    """Instantiate `PromptToolkitHistory` and append a line string"""
    hist = PromptToolkitHistory(load_prev=False)
    hist.append('line10')
    return hist
Beispiel #9
0
def test_obj():
    history_obj = PromptToolkitHistory(load_prev=False)
    history_obj.append('line10')
    yield assert_equal, ['line10'], history_obj.strings
    yield assert_equal, 1, len(history_obj)
    yield assert_equal, ['line10'], [x for x in history_obj]