1
0
Fork 0

Merging upstream version 1.29.2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 19:16:42 +01:00
parent 3180ec4213
commit f15fe4f59f
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
68 changed files with 3723 additions and 3336 deletions

View file

@ -6,52 +6,47 @@ from .packages import special
def create_toolbar_tokens_func(mycli, show_fish_help):
"""Return a function that generates the toolbar tokens."""
def get_toolbar_tokens():
result = [('class:bottom-toolbar', ' ')]
result = [("class:bottom-toolbar", " ")]
if mycli.multi_line:
delimiter = special.get_current_delimiter()
result.append(
(
'class:bottom-toolbar',
' ({} [{}] will end the line) '.format(
'Semi-colon' if delimiter == ';' else 'Delimiter', delimiter)
))
"class:bottom-toolbar",
" ({} [{}] will end the line) ".format("Semi-colon" if delimiter == ";" else "Delimiter", delimiter),
)
)
if mycli.multi_line:
result.append(('class:bottom-toolbar.on', '[F3] Multiline: ON '))
result.append(("class:bottom-toolbar.on", "[F3] Multiline: ON "))
else:
result.append(('class:bottom-toolbar.off',
'[F3] Multiline: OFF '))
result.append(("class:bottom-toolbar.off", "[F3] Multiline: OFF "))
if mycli.prompt_app.editing_mode == EditingMode.VI:
result.append((
'class:bottom-toolbar.on',
'Vi-mode ({})'.format(_get_vi_mode())
))
result.append(("class:bottom-toolbar.on", "Vi-mode ({})".format(_get_vi_mode())))
if mycli.toolbar_error_message:
result.append(
('class:bottom-toolbar', ' ' + mycli.toolbar_error_message))
result.append(("class:bottom-toolbar", " " + mycli.toolbar_error_message))
mycli.toolbar_error_message = None
if show_fish_help():
result.append(
('class:bottom-toolbar', ' Right-arrow to complete suggestion'))
result.append(("class:bottom-toolbar", " Right-arrow to complete suggestion"))
if mycli.completion_refresher.is_refreshing():
result.append(
('class:bottom-toolbar', ' Refreshing completions...'))
result.append(("class:bottom-toolbar", " Refreshing completions..."))
return result
return get_toolbar_tokens
def _get_vi_mode():
"""Get the current vi mode for display."""
return {
InputMode.INSERT: 'I',
InputMode.NAVIGATION: 'N',
InputMode.REPLACE: 'R',
InputMode.REPLACE_SINGLE: 'R',
InputMode.INSERT_MULTIPLE: 'M',
InputMode.INSERT: "I",
InputMode.NAVIGATION: "N",
InputMode.REPLACE: "R",
InputMode.REPLACE_SINGLE: "R",
InputMode.INSERT_MULTIPLE: "M",
}[get_app().vi_state.input_mode]