Skip to content

Commit e99f1d5

Browse files
committed
Fix: broken layout in search results' panels
1 parent d4c5d4a commit e99f1d5

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

src/searchcode/__app.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,23 @@
1818
import typing as t
1919

2020
import rich_click as click
21-
from rich.console import Console
2221
from rich.pretty import pprint
2322
from rich.syntax import Syntax
2423

2524
from . import License
2625
from .__lib import (
2726
__pkg__,
2827
__version__,
28+
console,
2929
update_window_title,
3030
clear_screen,
3131
print_jsonp,
3232
print_panels,
3333
)
3434
from .api import Searchcode
3535

36-
sc = Searchcode(user_agent=f"{__pkg__}-sdk/cli")
37-
3836
__all__ = ["cli"]
39-
40-
console = Console(highlight=True)
37+
sc = Searchcode(user_agent=f"{__pkg__}-sdk/cli")
4138

4239

4340
@click.group()
@@ -139,9 +136,7 @@ def search(
139136
clear_screen()
140137
update_window_title(text=query)
141138

142-
with console.status(
143-
f"Querying code index with search string: [green]{query}[/]..."
144-
):
139+
with console.status(f"Querying code index: [green]{query}[/]"):
145140
languages = languages.split(",") if languages else None
146141
sources = sources.split(",") if sources else None
147142

@@ -156,10 +151,6 @@ def search(
156151
callback=callback,
157152
)
158153

159-
console.print(
160-
f"🗸 Showing {len(response.results)} of {per_page} results for '{query}'"
161-
)
162-
163154
(
164155
print_jsonp(jsonp=response)
165156
if callback
@@ -177,7 +168,7 @@ def code(id: int):
177168
"""
178169
clear_screen()
179170
update_window_title(text=str(id))
180-
with console.status(f"Fetching data for code file with ID: [cyan]{id}[/]..."):
171+
with console.status(f"Fetching code file: [cyan]{id}[/]"):
181172
data = sc.code(id)
182173
lines = data.code
183174
language = data.language

src/searchcode/__lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from . import __pkg__, __version__
1212

13-
console = Console()
13+
console = Console(highlight=True)
1414

1515

1616
def print_jsonp(jsonp: str) -> None:

0 commit comments

Comments
 (0)