From 857622b40d0a5d3662f993caf386b163249f1c71 Mon Sep 17 00:00:00 2001 From: Ritchie Mwewa <74001397+rly0nheart@users.noreply.github.com> Date: Thu, 22 May 2025 01:52:49 +0200 Subject: [PATCH] Enable word wrap in code syntax --- pyproject.toml | 2 +- src/searchcode/__init__.py | 2 +- src/searchcode/_cli/panels.py | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cc43fa..7e6b845 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "searchcode" -version = "0.6.2" +version = "0.6.3" description = "Simple, comprehensive code search." authors = ["Ritchie Mwewa "] license = "GPLv3+" diff --git a/src/searchcode/__init__.py b/src/searchcode/__init__.py index f291e29..c1639bc 100644 --- a/src/searchcode/__init__.py +++ b/src/searchcode/__init__.py @@ -20,7 +20,7 @@ from .api import Searchcode __pkg__ = "searchcode" -__version__ = "0.6.2" +__version__ = "0.6.3" __author__ = "Ritchie Mwewa" __all__ = ["Searchcode"] diff --git a/src/searchcode/_cli/panels.py b/src/searchcode/_cli/panels.py index b958068..14cdf06 100644 --- a/src/searchcode/_cli/panels.py +++ b/src/searchcode/_cli/panels.py @@ -40,7 +40,14 @@ def _make_syntax(code: str, language: str, **syntax_kwargs) -> Syntax: :return: A rich Syntax object for displaying code. :rtype: Syntax """ - return Syntax(code=code, lexer=language, theme="dracula", **syntax_kwargs) + return Syntax( + code=code, + lexer=language, + theme="dracula", + word_wrap=True, + indent_guides=True, + **syntax_kwargs, + ) def _make_syntax_panel( @@ -71,7 +78,7 @@ def _make_syntax_panel( def print_panels( data: t.Union[t.List[SimpleNamespace], SimpleNamespace, str], **kwargs -) -> None: +): """ Print panels for displaying code or structured file information. @@ -84,8 +91,6 @@ def print_panels( :type data: Union[List[SimpleNamespace], SimpleNamespace, str] :param kwargs: Additional optional keyword arguments (e.g., id for logging). :type kwargs: Any - :return: None - :rtype: None """ panels: t.List[Panel] = [] @@ -117,9 +122,7 @@ def print_panels( lines_dict=lines.__dict__ ) - syntax = _make_syntax( - code=code_string, language=language, word_wrap=False, indent_guides=True - ) + syntax = _make_syntax(code=code_string, language=language) header_text = ( f"[bold]{filename}[/] ([blue]{repo}[/]) "