From e5aae7ed06eab4708e9b0bc4075fec72db5199ec Mon Sep 17 00:00:00 2001 From: ViditOstwal Date: Fri, 9 Oct 2026 18:34:50 +0530 Subject: [PATCH] Show the action search in green under the navigation hint. The line includes how many actions the query matched. --- lib/cli/src/crewai_cli/tui_picker.py | 12 +++++++++--- lib/cli/tests/test_tui_picker.py | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/cli/src/crewai_cli/tui_picker.py b/lib/cli/src/crewai_cli/tui_picker.py index 781068f17..9ac7d4f86 100644 --- a/lib/cli/src/crewai_cli/tui_picker.py +++ b/lib/cli/src/crewai_cli/tui_picker.py @@ -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 diff --git a/lib/cli/tests/test_tui_picker.py b/lib/cli/tests/test_tui_picker.py index ba6233460..a381ec771 100644 --- a/lib/cli/tests/test_tui_picker.py +++ b/lib/cli/tests/test_tui_picker.py @@ -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