class euporie.core.widgets.file_browser.Buffer(completer: prompt_toolkit.completion.base.Completer | None = None, auto_suggest: prompt_toolkit.auto_suggest.AutoSuggest | None = None, history: prompt_toolkit.history.History | None = None, validator: prompt_toolkit.validation.Validator | None = None, tempfile_suffix: Union[str, Callable[[], str]] = '', tempfile: Union[str, Callable[[], str]] = '', name: str = '', complete_while_typing: Union[prompt_toolkit.filters.base.Filter, bool] = False, validate_while_typing: Union[prompt_toolkit.filters.base.Filter, bool] = False, enable_history_search: Union[prompt_toolkit.filters.base.Filter, bool] = False, document: prompt_toolkit.document.Document | None = None, accept_handler: Optional[Callable[[prompt_toolkit.buffer.Buffer], bool]] = None, read_only: Union[prompt_toolkit.filters.base.Filter, bool] = False, multiline: Union[prompt_toolkit.filters.base.Filter, bool] = True, on_text_changed: Optional[Callable[[prompt_toolkit.buffer.Buffer], None]] = None, on_text_insert: Optional[Callable[[prompt_toolkit.buffer.Buffer], None]] = None, on_cursor_position_changed: Optional[Callable[[prompt_toolkit.buffer.Buffer], None]] = None, on_completions_changed: Optional[Callable[[prompt_toolkit.buffer.Buffer], None]] = None, on_suggestion_set: Optional[Callable[[prompt_toolkit.buffer.Buffer], None]] = None)

The core data structure that holds the text and cursor position of the current input line and implements all text manipulations on top of it. It also implements the history, undo stack and the completion state.

  • completerCompleter instance.

  • historyHistory instance.

  • tempfile_suffix – The tempfile suffix (extension) to be used for the “open in editor” function. For a Python REPL, this would be “.py”, so that the editor knows the syntax highlighting to use. This can also be a callable that returns a string.

  • tempfile – For more advanced tempfile situations where you need control over the subdirectories and filename. For a Git Commit Message, this would be “.git/COMMIT_EDITMSG”, so that the editor knows the syntax highlighting to use. This can also be a callable that returns a string.

  • name – Name for this buffer. E.g. DEFAULT_BUFFER. This is mostly useful for key bindings where we sometimes prefer to refer to a buffer by their name instead of by reference.

  • accept_handler

    Called when the buffer input is accepted. (Usually when the user presses enter.) The accept handler receives this Buffer as input and should return True when the buffer text should be kept instead of calling reset.

    In case of a PromptSession for instance, we want to keep the text, because we will exit the application, and only reset it during the next run.


  • on_text_changed – When the buffer text changes. (Callable or None.)

  • on_text_insert – When new text is inserted. (Callable or None.)

  • on_cursor_position_changed – When the cursor moves. (Callable or None.)

  • on_completions_changed – When the completions were changed. (Callable or None.)

  • on_suggestion_set – When an auto-suggestion text has been set. (Callable or None.)


  • complete_while_typingFilter or bool. Decide whether or not to do asynchronous autocompleting while typing.

  • validate_while_typingFilter or bool. Decide whether or not to do asynchronous validation while typing.

  • enable_history_searchFilter or bool to indicate when up-arrow partial string matching is enabled. It is advised to not enable this at the same time as complete_while_typing, because when there is an autocompletion found, the up arrows usually browse through the completions, rather than through the history.

  • read_onlyFilter. When True, changes will not be allowed.

  • multilineFilter or bool. When not set, pressing Enter will call the accept_handler. Otherwise, pressing Esc-Enter is required.