mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-10-12 02:12:31 +00:00
Show the action search in green under the navigation hint.
The line includes how many actions the query matched.
This commit is contained in:
@@ -15,6 +15,7 @@ _CORAL = "\033[38;2;255;90;80m" # #FF5A50
|
||||
_TEAL = "\033[38;2;31;121;130m" # #1F7982
|
||||
_BOLD = "\033[1m"
|
||||
_DIM = "\033[2m"
|
||||
_GREEN = "\033[1;32m"
|
||||
_RESET = "\033[0m"
|
||||
_HIDE_CURSOR = "\033[?25l"
|
||||
_SHOW_CURSOR = "\033[?25h"
|
||||
@@ -123,10 +124,15 @@ def _draw_multi(
|
||||
# otherwise leave the old rows visible underneath the matches.
|
||||
_clear_lines(previous_line_count or 1)
|
||||
extra_lines = 0
|
||||
if searchable:
|
||||
sys.stdout.write(f"\033[2K {_DIM}Search:{_RESET} {query}\n")
|
||||
extra_lines += 1
|
||||
sys.stdout.write(f"\033[2K{hint}\n")
|
||||
if searchable:
|
||||
match_count = ""
|
||||
if query:
|
||||
count = len(rows)
|
||||
noun = "match" if count == 1 else "matches"
|
||||
match_count = f" · {count} {noun}"
|
||||
sys.stdout.write(f"\033[2K {_GREEN}Search: {query}{match_count}{_RESET}\n")
|
||||
extra_lines += 1
|
||||
if searchable and query and not rows:
|
||||
sys.stdout.write(f"\033[2K {_DIM}No matching actions{_RESET}\n")
|
||||
extra_lines += 1
|
||||
|
||||
@@ -67,6 +67,7 @@ def test_search_redraw_shows_only_matching_rows(monkeypatch) -> None:
|
||||
|
||||
rendered = output.getvalue()
|
||||
assert "Create email draft" in rendered
|
||||
assert "1 match" in rendered
|
||||
assert "Send an email" not in rendered
|
||||
assert rendered.count("\033[2K") >= 6
|
||||
|
||||
@@ -89,6 +90,7 @@ def test_searchable_draw_shows_the_query_and_an_empty_match(monkeypatch) -> None
|
||||
assert "missing" in rendered
|
||||
assert "type to filter" in rendered
|
||||
assert "No matching actions" in rendered
|
||||
assert "0 matches" in rendered
|
||||
assert "Send an email" not in rendered
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user