1
0
Fork 0

Merging upstream version 1.9.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 17:50:55 +01:00
parent cabf5668ae
commit 2e7632a5de
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
11 changed files with 96 additions and 25 deletions

View file

@ -23,6 +23,7 @@ from prompt_toolkit.shortcuts import PromptSession, CompleteStyle
from prompt_toolkit.styles.pygments import style_from_pygments_cls
from prompt_toolkit.document import Document
from prompt_toolkit.filters import HasFocus, IsDone
from prompt_toolkit.formatted_text import ANSI
from prompt_toolkit.layout.processors import (
HighlightMatchingBracketProcessor,
ConditionalProcessor,
@ -88,6 +89,7 @@ class LiteCli(object):
self.cli_style = c["colors"]
self.output_style = style_factory_output(self.syntax_style, self.cli_style)
self.wider_completion_menu = c["main"].as_bool("wider_completion_menu")
self.autocompletion = c["main"].as_bool("autocompletion")
c_dest_warning = c["main"].as_bool("destructive_warning")
self.destructive_warning = c_dest_warning if warn is None else warn
self.login_path_as_host = c["main"].as_bool("login_path_as_host")
@ -161,10 +163,11 @@ class LiteCli(object):
)
special.register_special_command(
self.execute_from_file,
"source",
".read",
"\\. filename",
"Execute commands from file.",
aliases=("\\.",),
case_sensitive=True,
aliases=("\\.", "source"),
)
special.register_special_command(
self.change_prompt_format,
@ -381,7 +384,8 @@ class LiteCli(object):
and len(prompt) > self.max_len_prompt
):
prompt = self.get_prompt("\\d> ")
return [("class:prompt", prompt)]
prompt = prompt.replace("\\x1b", "\x1b")
return ANSI(prompt)
def get_continuation(width, line_number, is_soft_wrap):
continuation = " " * (width - 1) + " "
@ -547,6 +551,9 @@ class LiteCli(object):
else:
complete_style = CompleteStyle.COLUMN
if not self.autocompletion:
complete_style = CompleteStyle.READLINE_LIKE
with self._completer_lock:
if self.key_bindings == "vi":