diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d91317..ef003de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Bug Fixes - Expand `~` in configured log file paths before opening the log. +- Correct the multiline toolbar hint to say a semi-colon runs the query. ### Internal diff --git a/litecli/clitoolbar.py b/litecli/clitoolbar.py index e3bc6ee..4d2adf7 100644 --- a/litecli/clitoolbar.py +++ b/litecli/clitoolbar.py @@ -15,7 +15,7 @@ def get_toolbar_tokens() -> list[tuple[str, str]]: result.append(("class:bottom-toolbar", " ")) if cli.multi_line: - result.append(("class:bottom-toolbar", " (Semi-colon [;] will end the line) ")) + result.append(("class:bottom-toolbar", " (Semi-colon [;] will run the query) ")) if cli.multi_line: result.append(("class:bottom-toolbar.on", "[F3] Multiline: ON ")) diff --git a/tests/test_clitoolbar.py b/tests/test_clitoolbar.py new file mode 100644 index 0000000..eb9d817 --- /dev/null +++ b/tests/test_clitoolbar.py @@ -0,0 +1,27 @@ +from unittest.mock import MagicMock + +from prompt_toolkit.enums import EditingMode + +from litecli.clitoolbar import create_toolbar_tokens_func + + +def _cli(multi_line): + cli = MagicMock() + cli.multi_line = multi_line + cli.prompt_app.editing_mode = EditingMode.EMACS + cli.completion_refresher.is_refreshing.return_value = False + return cli + + +def _text(tokens): + return "".join(text for _, text in tokens) + + +def test_multiline_toolbar_says_semicolon_runs_the_query(): + tokens = create_toolbar_tokens_func(_cli(True), lambda: False)() + assert "(Semi-colon [;] will run the query)" in _text(tokens) + + +def test_single_line_toolbar_has_no_semicolon_hint(): + tokens = create_toolbar_tokens_func(_cli(False), lambda: False)() + assert "Semi-colon" not in _text(tokens)