()
| 17 | """Return a function that generates the toolbar tokens.""" |
| 18 | |
| 19 | def get_toolbar_tokens() -> list[tuple[str, str]]: |
| 20 | divider = ('class:bottom-toolbar', ' │ ') |
| 21 | |
| 22 | result = [("class:bottom-toolbar", "[Tab] Complete")] |
| 23 | dynamic = [] |
| 24 | |
| 25 | result.append(divider) |
| 26 | result.append(("class:bottom-toolbar", "[F1] Help")) |
| 27 | |
| 28 | if mycli.completer.smart_completion: |
| 29 | result.append(divider) |
| 30 | result.append(("class:bottom-toolbar", "[F2] Smart-complete:")) |
| 31 | result.append(("class:bottom-toolbar.on", "ON ")) |
| 32 | else: |
| 33 | result.append(divider) |
| 34 | result.append(("class:bottom-toolbar", "[F2] Smart-complete:")) |
| 35 | result.append(("class:bottom-toolbar.off", "OFF")) |
| 36 | |
| 37 | if mycli.multi_line: |
| 38 | result.append(divider) |
| 39 | result.append(("class:bottom-toolbar", "[F3] Multiline:")) |
| 40 | result.append(("class:bottom-toolbar.on", "ON ")) |
| 41 | else: |
| 42 | result.append(divider) |
| 43 | result.append(("class:bottom-toolbar", "[F3] Multiline:")) |
| 44 | result.append(("class:bottom-toolbar.off", "OFF")) |
| 45 | |
| 46 | if mycli.prompt_session.editing_mode == EditingMode.VI: |
| 47 | result.append(divider) |
| 48 | result.append(("class:bottom-toolbar", "Vi:")) |
| 49 | result.append(("class:bottom-toolbar.on", _get_vi_mode())) |
| 50 | |
| 51 | if mycli.toolbar_error_message: |
| 52 | dynamic.append(divider) |
| 53 | dynamic.append(("class:bottom-toolbar.transaction.failed", mycli.toolbar_error_message)) |
| 54 | mycli.toolbar_error_message = None |
| 55 | |
| 56 | if mycli.multi_line: |
| 57 | delimiter = special.get_current_delimiter() |
| 58 | if delimiter != ';' or show_initial_toolbar_help(): |
| 59 | dynamic.append(divider) |
| 60 | dynamic.append(('class:bottom-toolbar', '"')) |
| 61 | dynamic.append(('class:bottom-toolbar.on', delimiter)) |
| 62 | dynamic.append(('class:bottom-toolbar', '" ends a statement')) |
| 63 | |
| 64 | if show_initial_toolbar_help(): |
| 65 | dynamic.append(divider) |
| 66 | dynamic.append(("class:bottom-toolbar", "right-arrow accepts full-line suggestion")) |
| 67 | dynamic.append(divider) |
| 68 | dynamic.append(("class:bottom-toolbar", "/help for more")) |
| 69 | |
| 70 | if mycli.completion_refresher.is_refreshing(): |
| 71 | dynamic.append(divider) |
| 72 | dynamic.append(("class:bottom-toolbar", "Refreshing completions…")) |
| 73 | |
| 74 | schema_prefetcher = getattr(mycli, 'schema_prefetcher', None) |
| 75 | if schema_prefetcher is not None and schema_prefetcher.is_prefetching(): |
| 76 | dynamic.append(divider) |
nothing calls this directly
no test coverage detected