Skip to content

Commit 47337c0

Browse files
authored
Enable word wrap in code syntax (#40)
2 parents 9b92209 + 7c41c6a commit 47337c0

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "searchcode"
3-
version = "0.6.2"
3+
version = "0.6.3"
44
description = "Simple, comprehensive code search."
55
authors = ["Ritchie Mwewa <rly0nheart@duck.com>"]
66
license = "GPLv3+"

src/searchcode/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .api import Searchcode
2121

2222
__pkg__ = "searchcode"
23-
__version__ = "0.6.2"
23+
__version__ = "0.6.3"
2424
__author__ = "Ritchie Mwewa"
2525

2626
__all__ = ["Searchcode"]

src/searchcode/_cli/panels.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ def _make_syntax(code: str, language: str, **syntax_kwargs) -> Syntax:
4040
:return: A rich Syntax object for displaying code.
4141
:rtype: Syntax
4242
"""
43-
return Syntax(code=code, lexer=language, theme="dracula", **syntax_kwargs)
43+
return Syntax(
44+
code=code,
45+
lexer=language,
46+
theme="dracula",
47+
word_wrap=True,
48+
indent_guides=True,
49+
**syntax_kwargs,
50+
)
4451

4552

4653
def _make_syntax_panel(
@@ -71,7 +78,7 @@ def _make_syntax_panel(
7178

7279
def print_panels(
7380
data: t.Union[t.List[SimpleNamespace], SimpleNamespace, str], **kwargs
74-
) -> None:
81+
):
7582
"""
7683
Print panels for displaying code or structured file information.
7784
@@ -84,8 +91,6 @@ def print_panels(
8491
:type data: Union[List[SimpleNamespace], SimpleNamespace, str]
8592
:param kwargs: Additional optional keyword arguments (e.g., id for logging).
8693
:type kwargs: Any
87-
:return: None
88-
:rtype: None
8994
"""
9095
panels: t.List[Panel] = []
9196

@@ -117,9 +122,7 @@ def print_panels(
117122
lines_dict=lines.__dict__
118123
)
119124

120-
syntax = _make_syntax(
121-
code=code_string, language=language, word_wrap=False, indent_guides=True
122-
)
125+
syntax = _make_syntax(code=code_string, language=language)
123126

124127
header_text = (
125128
f"[bold]{filename}[/] ([blue]{repo}[/]) "

0 commit comments

Comments
 (0)